Point cloud viewer does not automatically show loaded point cloud

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

Point cloud viewer does not automatically show loaded point cloud

Filip Rooms

Dear all,

A small question to the list. I have been using PCL for a few months now and really like it a lot.

Just a small question that is currently puzzling me: when loading a point cloud and setting everything in the viewer,
I just can see what I want to see after first clicking in the viewer, while I would like to see the scene automatically as soon as it is ready...

I already tried longer timings in the spinOnce, setting its flag to true. I also tried calling updateCamera (gives warning that it is deprecated) and updatePointCloud...

My viewer code is as follows:

int PointCloudViewer::ViewRGB(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud)
{
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
    m_viewer.addPointCloud<pcl::PointXYZRGB>(cloud, rgb, "sample cloud");
    m_viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
    m_viewer.addCoordinateSystem(1.0);
    m_viewer.setCameraPosition(m_camera_pos_x, m_camera_pos_y, m_camera_pos_z, m_camera_up_x, m_camera_up_y, m_camera_up_z);
    
    while (!m_viewer.wasStopped())
    {
        m_viewer.spinOnce(100);  // tried also longer timings and setting the flag to true here
    }
    return 0;
}
Any suggestions much appreciated.

Kind regards,

Filip Rooms



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

Re: Point cloud viewer does not automatically show loaded point cloud

Sérgio Agostinho
Although I have the feeling this will be useless, see if adding this method before you add the coordinate system makes a difference.

Cheers


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

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Point cloud viewer does not automatically show loaded point cloud

Filip Rooms

Dear Sergio,

Thanks for your answer, but unfortunately adding the method initCameraParameters(); before addCoordinateSystem(1.0); did not make any difference.

The point cloud I loaded displays nicely, but only after I clicked the viewer window (as before)...


On 18-Aug-16 13:42, Sérgio Agostinho wrote:
Although I have the feeling this will be useless, see if adding this method before you add the coordinate system makes a difference.

Cheers



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


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

Re: Point cloud viewer does not automatically show loaded point cloud

noname
In reply to this post by Filip Rooms
hi,

have you tried adapting http://pointclouds.org/documentation/tutorials/cloud_viewer.php, e.g. using showCloud? basically using the CloudViewer-interface instead of PCLVisualizer's? could the issue maybe be related to this sentence from the link "The PCLVisualizer is the back end of the CloudViewer, but its running in its own thread. To access it you must use callback functions, to avoid the visualization concurrency issues."?

kind regards

On 18.08.2016 13:26, Filip Rooms wrote:

Dear all,

A small question to the list. I have been using PCL for a few months now and really like it a lot.

Just a small question that is currently puzzling me: when loading a point cloud and setting everything in the viewer,
I just can see what I want to see after first clicking in the viewer, while I would like to see the scene automatically as soon as it is ready...

I already tried longer timings in the spinOnce, setting its flag to true. I also tried calling updateCamera (gives warning that it is deprecated) and updatePointCloud...

My viewer code is as follows:

int PointCloudViewer::ViewRGB(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud)
{
    pcl::visualization::PointCloudColorHandlerRGBField<pcl::PointXYZRGB> rgb(cloud);
    m_viewer.addPointCloud<pcl::PointXYZRGB>(cloud, rgb, "sample cloud");
    m_viewer.setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, "sample cloud");
    m_viewer.addCoordinateSystem(1.0);
    m_viewer.setCameraPosition(m_camera_pos_x, m_camera_pos_y, m_camera_pos_z, m_camera_up_x, m_camera_up_y, m_camera_up_z);
    
    while (!m_viewer.wasStopped())
    {
        m_viewer.spinOnce(100);  // tried also longer timings and setting the flag to true here
    }
    return 0;
}
Any suggestions much appreciated.

Kind regards,

Filip Rooms




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


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