ICP visualize iterations

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

ICP visualize iterations

fadzic
Hi,

i started using PCL few weeks ago and I'm stuck at visualizing ICP iterations.

What I've been trying is visualize clout_out from this function in common/transforms.hpp:


template <typename PointT> void
pcl::transformPointCloud (const pcl::PointCloud<PointT> &cloud_in,
                          pcl::PointCloud<PointT> &cloud_out,
                          const Eigen::Matrix4f &transform)


with PCLVisualizer:


boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;

viewer->addPointCloud<pcl::PointXYZ>(cloud_out, "trans");


but this isnt working and I get this error:

error: no matching function for call to ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZ>&, const char [6])’


I'm trying to solve this for few days now without luck. If someone can help me with solution or tips I'll be very gratefull.
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

Merlyn
Hi,

If you take a close look at the definition of the addPointCloud of the pcl visualizer you need to define the text as a string, hence i would suggest declaring a string, assign the text to that and parse that value as argument. For eg

std::string text_cloud;

text_cloud="abcd";

viewer->addPointCloud<pcl::PointXYZ>(cloud_out, text_cloud);

Hope the above works.

Even I am kinda new here, so please forgive me if i am wrong.

Cheers,

 
fadzic wrote
Hi,

i started using PCL few weeks ago and I'm stuck at visualizing ICP iterations.

What I've been trying is visualize clout_out from this function in common/transforms.hpp:


template <typename PointT> void
pcl::transformPointCloud (const pcl::PointCloud<PointT> &cloud_in,
                          pcl::PointCloud<PointT> &cloud_out,
                          const Eigen::Matrix4f &transform)


with PCLVisualizer:


boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer;

viewer->addPointCloud<pcl::PointXYZ>(cloud_out, "trans");


but this isnt working and I get this error:

error: no matching function for call to ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZ>&, const char [6])’


I'm trying to solve this for few days now without luck. If someone can help me with solution or tips I'll be very gratefull.
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

Sergey
Administrator
Hi,

Merlyn wrote
i would suggest declaring a string, assign the text to that and parse that value as argument
This is not necessary, the compiler will implicitly create an std::string and pass it to the function.

fadzic wrote
error: no matching function for call to ‘pcl::visualization::PCLVisualizer::addPointCloud(pcl::PointCloud<pcl::PointXYZ>&, const char [6])’
Just read the error message carefully, it says everything. In PCL there are indeed no overloads of addPointCloud() function that accept a reference to point cloud. Each and every variant of addPointCloud() takes "const typename pcl::PointCloud<PointT>::ConstPtr&", which is a const reference to a const pointer to a point cloud. Kind of intricate, but this is C++.

So to solve your problem try to call the function as follows: viewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(), text_cloud);

Cheers,
Sergey
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

fadzic
Thank you. That did the trick....
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

Shawarma
Can you please post a sample snippet of declaring the cloud_in and cloud_out and how you got the iterations to work with Visualizer?

Can you see each ICP try? Or only the final cloud? I've been looking into getting to see each ICP iteration, but haven't been able to do so ...
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

fadzic
Sorry for late response.

I just changed the original common/transforms.hpp file and added

viewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(), text_cloud);

at the end of corresponding function. U need to pass *viewer somehow to that function and easiest way is to make global variable at the top of that file.... thats all.

And yes u can see every step but coz it happens very fast with small ammount of points in cloud u need to pause your app in order to see iterations (or u can add cloud of every iteration in different color...)
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

Shawarma
This post was updated on .
Hi Fadzic,

Thanks for your reply.

I did have a look at common/transforms.hpp. But I'm not sure what exactly you've changed in that hpp file?
viewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(), text_cloud);
Is what you've added in your main function right?
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

fadzic
I just added 

<quoteviewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(), text_cloud);

I dont know what function you are calling in your app but you can test that with simple printf (cout) in every funcion and find out which one you are calling.

U can also visuallize iterations in registration/impl/icp.hpp. After the icp function calls transformCloud() (from common/transforms.hpp) you can visualize clout_out, again with simple :

<quoteviewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(), text_cloud); 

Note that viewer must be declared as global variable (not a good solution but easiest one) in order to use it in your main and in icp.hpp.

On Thu, Jul 19, 2012 at 6:47 PM, Shawarma <[hidden email]> wrote:
Hi Fadzic,

Thanks for your reply.

I did have a look at common/transforms.hpp. But I'm not sure what exactly
you've changed in that hpp file?
<quoteviewer->addPointCloud<pcl::PointXYZ>(cloud_out.makeShared(),
text_cloud);

Is what you've added in your main function right?


--
View this message in context: http://www.pcl-users.org/ICP-visualize-iterations-tp4020127p4020553.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
Reply | Threaded
Open this post in threaded view
|

Re: ICP visualize iterations

Shawarma
fadzic,

Thanks for the reply. However I've given up on accomplishing this for now :(. Hopefully as I get more familiar with PCL, understanding might kick-in.