Problem with picking points in PCLVisualizer

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

Problem with picking points in PCLVisualizer

negative
Greetings. I have been using PCL from some time for analysis of point clouds obtained with our 3D scanner (structured light). It has been great and very easy to use. However I've recently came across some strange thing in PCLVisualizer, namely point picking. Usually it works very well, but sometimes it gives really odd results - it selects points far from the clicked ones. Moreover, when I click repeatedly in the same point on screen, the selected point is different with each click and, sooner or later it converges to really clicked one. This situation seems to change after camera movement but I haven't noticed any regularity.

I provide exemplary cloud of points in pcd format:
http://3dve.pl/out.zip

but here you can see this phenomenon in avi files:
http://3dve.pl/capture.avi
http://3dve.pl/PointPicking.avi

You can notice, especially in capture.avi that (at the beginning of the movie), the cursor stays at the same place and after clicking the mouse the violet sphere is moving.

I draw the sphere inside PointPickingCallback:
void PointPickingCallback(const pcl::visualization::PointPickingEvent& event, void* cookie)
{
        int idx = event.getPointIndex ();
        if (idx == -1)
                return;
        // Get the point that was picked
        ogxPoint picked_pt;
        event.getPoint (picked_pt.x, picked_pt.y, picked_pt.z);
       
        pcl::visualization::PCLVisualizer * v_visualizer = (pcl::visualization::PCLVisualizer*)(cookie);
        v_visualizer->removeShape("PickedPoint");

        v_visualizer->addSphere(picked_pt, 10.0, 1.0, 0.0, 1.0, "PickedPoint", 0);
}

Thank you in advance for any help.

best regards
Maciek Karaszewski
Reply | Threaded
Open this post in threaded view
|

Re: Problem with picking points in PCLVisualizer

Radu B. Rusu
Administrator
Maciek,

We are using VTK point pickers, so it might be that the problem lies within VTK itself. Have you tried asking on
vtk-users@ for an explanation?

Cheers,
Radu.


On 07/04/2012 05:25 AM, negative wrote:

> Greetings. I have been using PCL from some time for analysis of point clouds
> obtained with our 3D scanner (structured light). It has been great and very
> easy to use. However I've recently came across some strange thing in
> PCLVisualizer, namely point picking. Usually it works very well, but
> sometimes it gives really odd results - it selects points far from the
> clicked ones. Moreover, when I click repeatedly in the same point on screen,
> the selected point is different with each click and, sooner or later it
> converges to really clicked one. This situation seems to change after camera
> movement but I haven't noticed any regularity.
>
> I provide exemplary cloud of points in pcd format:
> http://3dve.pl/out.zip http://3dve.pl/out.zip
>
> but here you can see this phenomenon in avi files:
> http://3dve.pl/capture.avi http://3dve.pl/capture.avi
> http://3dve.pl/PointPicking.avi http://3dve.pl/PointPicking.avi
>
> You can notice, especially in capture.avi that (at the beginning of the
> movie), the cursor stays at the same place and after clicking the mouse the
> violet sphere is moving.
>
> I draw the sphere inside PointPickingCallback:
> void PointPickingCallback(const pcl::visualization::PointPickingEvent&
> event, void* cookie)
> {
> int idx = event.getPointIndex ();
> if (idx == -1)
> return;
> // Get the point that was picked
> ogxPoint picked_pt;
> event.getPoint (picked_pt.x, picked_pt.y, picked_pt.z);
>
> pcl::visualization::PCLVisualizer * v_visualizer =
> (pcl::visualization::PCLVisualizer*)(cookie);
> v_visualizer->removeShape("PickedPoint");
>
> v_visualizer->addSphere(picked_pt, 10.0, 1.0, 0.0, 1.0, "PickedPoint", 0);
> }
>
> Thank you in advance for any help.
>
> best regards
> Maciek Karaszewski
>
>
> --
> View this message in context: http://www.pcl-users.org/Problem-with-picking-points-in-PCLVisualizer-tp4019970.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: Problem with picking points in PCLVisualizer

negative
Greetings. Yes, I know that point picking is based on VTK picker, but no, I didn't ask there yet. I posted this problem here because I wanted to know if anyone using PCL ever had similar problem.

Thank you for answering.

best regards
Maciek Karaszewski
Reply | Threaded
Open this post in threaded view
|

Re: Problem with picking points in PCLVisualizer

andersgb1
Hi,

I have a somewhat related problem:

When having more than one point cloud added to the visualizer, my callback function messes up because I'm trying to operate on one of the point clouds only. But the picking is performed on everything in the view. This effectively makes it impossible for me to get the grabbed index from the right point cloud, since the PointPickingEvent object does not contain information (the id string) of the selected cloud.

Could this be your problem also?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with picking points in PCLVisualizer

Sergey
Administrator
Hi,

I also had a problem with PCLVisualizer recently. It is unrelated with the other two problems mentioned in this thread, though it could be described as "Problem with picking points in PCLVisualizer". Just in case someone else have the same issue, here is what it is about and the solution I found.

I visualize a single point cloud with PCLVisualizer. When I click points, the indices returned inside the PointPickingEvent do not correspond to the points in the point cloud. That is, when I print the coordinates of the picked point and the coordinates of the point in point cloud at the specified index, I get different numbers.

The reason for this behavior is that the point cloud has points with NaNs. PCLVisualizer only displays points that are not NaNs, and the index it returns corresponds to the set of points being displayed, not the original point cloud.

The solution is to remove NaN points with `removeNaNFromPointCloud()` before displaying the point cloud.

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

Re: Problem with picking points in PCLVisualizer

wguo
This post has NOT been accepted by the mailing list yet.
This post was updated on .
I can't pick a point in the pcl_manual_registration program.  What's wrong?

Reply | Threaded
Open this post in threaded view
|

Re: Problem with picking points in PCLVisualizer

Faris
This post has NOT been accepted by the mailing list yet.
In reply to this post by Sergey

thank you~
coding,going