xyz-intensity data visualization in Visualizer

classic Classic list List threaded Threaded
10 messages Options
Hui
Reply | Threaded
Open this post in threaded view
|

xyz-intensity data visualization in Visualizer

Hui
Hi, guys, I am still a beginner of using PCL. Recently, I tried to visualize the xyzi PCD using visualizer; however, I could not get what I expected, actually, no point is visible. Following is what I modified based on the code in tutorial.

...
pcl::PointCloud<pcl::PointXYZI>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZI>);
if (pcl::io::loadPCDFile<pcl::PointXYZI> ("test.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }

boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new pcl::visualization::PCLVisualizer ("3D Viewer"));
  viewer->setBackgroundColor (0, 0, 0);
  pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> single_color(cloud, 0, 255, 0);
  viewer->addPointCloud<pcl::PointXYZI> (cloud, single_color, "sample cloud");
  viewer->setPointCloudRenderingProperties (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud");
  viewer->addCoordinateSystem (1.0);
  viewer->initCameraParameters ();

while (!viewer->wasStopped ())
  {
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (100000));
  }

Any good suggestion on my mistake is welcome. Thanks a lot.

By the way, I could visualize it using CloudViewer.


Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

Radu B. Rusu
Administrator
Dear Hui,

The problem is that you're using a "PointCloudColorHandlerCustom" which only serves the purpose of coloring all data
with a user given color (0, 255, 0 = R).

Try changing your code and use a "PointCloudColorHandlerGenericField" instead. I've updated the documentation at
http://docs.pointclouds.org/trunk/classpcl_1_1visualization_1_1_point_cloud_color_handler_generic_field.html to make
this clearer.

Cheers,
Radu.
--
Point Cloud Library (PCL) - http://pointclouds.org

On 08/17/2011 11:06 AM, Hui wrote:

> Hi, guys, I am still a beginner of using PCL. Recently, I tried to visualize
> the xyzi PCD using visualizer; however, I could not get what I expected,
> actually, no point is visible. Following is what I modified based on the
> code in tutorial.
>
> ...
> pcl::PointCloud<pcl::PointXYZI>::Ptr cloud (new
> pcl::PointCloud<pcl::PointXYZI>);
> if (pcl::io::loadPCDFile<pcl::PointXYZI>  ("test.pcd", *cloud) == -1) //*
> load the file
>    {
>      PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
>      return (-1);
>    }
>
> boost::shared_ptr<pcl::visualization::PCLVisualizer>  viewer (new
> pcl::visualization::PCLVisualizer ("3D Viewer"));
>    viewer->setBackgroundColor (0, 0, 0);
>    pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI>
> single_color(cloud, 0, 255, 0);
>    viewer->addPointCloud<pcl::PointXYZI>  (cloud, single_color, "sample
> cloud");
>    viewer->setPointCloudRenderingProperties
> (pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud");
>    viewer->addCoordinateSystem (1.0);
>    viewer->initCameraParameters ();
>
> while (!viewer->wasStopped ())
>    {
>      viewer->spinOnce (100);
>      boost::this_thread::sleep (boost::posix_time::microseconds (100000));
>    }
>
> Any good suggestion on my mistake is welcome. Thanks a lot.
>
> By the way, I could visualize it using CloudViewer.
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/xyz-intensity-data-visualization-in-Visualizer-tp3262431p3262431.html
> Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Hui
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

Hui
Thanks, I could use it to visualize the intensity now.
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

Humanoid
Could you please post the changed code? I am not able to visualize the intensity values using visualizer.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

Shawarma
Hi Humanoid,

  pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> single_color(cloud, 0, 255, 0);
  viewer->addPointCloud<pcl::PointXYZI> (cloud, single_color, "sample cloud");
Try this instead:

pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> intensity_distribution(cloud, "intensity");
viewer->addPointCloud<pcl::PointXYZI> (cloud, intensity_distribution, "sample cloud");
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

Humanoid
Thanks a lot Shawarma. . I am able to work with it now.
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

strawberry
In reply to this post by Shawarma
Hi,
why do i have error in this statement "visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> intensity_distribution(cloud,"intensity");"?
i cannot visualize the intensity data.
could you help me? thanks.

 
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

ccccccx
In reply to this post by Shawarma
Thanks a lot. I can visualize the PointXYZI file.

But there is still a problem.

The point visualized on the screen are colorful(red,yellow,green,blue...).
How can I visualize the point just like PolyWorks with white(only grayscale)

Look forward to your reply.

Thanks again!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

ccccccx
In reply to this post by Hui
Would you mind showing me the visualization result ?



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: xyz-intensity data visualization in Visualizer

ccccccx
In reply to this post by Hui
###################################Code#################################

#include<iostream>
#include<pcl\point_cloud.h>
#include<pcl\point_types.h>
#include<pcl\io\io.h>
#include<pcl\io\pcd_io.h>
#include<pcl\visualization\cloud_viewer.h>
using namespace std;

int main(){
        pcl::PointCloud<pcl::PointXYZI>::Ptr cloud (new
pcl::PointCloud<pcl::PointXYZI>);
if (pcl::io::loadPCDFile<pcl::PointXYZI> ("test.pcd", *cloud) == -1) //*
load the file
  {
    PCL_ERROR ("Couldn't read file test_pcd.pcd \n");
    return (-1);
  }

  boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer (new
pcl::visualization::PCLVisualizer ("3D Viewer"));
  viewer->setBackgroundColor (0, 0, 0);
  pcl::visualization::PointCloudColorHandlerGenericField<pcl::PointXYZI>
intensity_distribution(cloud, "intensity");
viewer->addPointCloud<pcl::PointXYZI> (cloud, intensity_distribution,
"sample cloud");
  viewer->setPointCloudRenderingProperties
(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud");
  viewer->addCoordinateSystem (1.0);
  viewer->initCameraParameters ();

while (!viewer->wasStopped ())
  {
    viewer->spinOnce (100);
    boost::this_thread::sleep (boost::posix_time::microseconds (100000));
  }
}

###################################Result#################################
<http://www.pcl-users.org/file/t499136/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20171214105417.jpg>


The colorful result is not what I want. I want the Point visualized with
grayscale, just like Polyworks.

Anyone know what's the problem and how to modify?

Thanks!



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users