I'm using the PCL library to do a registration using two point clouds. The two point clouds are displayed in two different windows using the viewports v1
and v2
. A third window is displayed beneath the two windows to display the registered cloud, using the viewport v3
. All of the viewports are used by a single PCLVisualizer
named m_viewer
. The workflow is to select point correspondences in v1
and v2
to do the registration which will be shown in v3
. Following a picture of the program:
Now I'm trying to implement a feature that highlights points the user clicks on. So if the user clicks on a point in viewport v1
or v2
, it will be highlighted in a function markSelectedPoint
using a white color.
I want to store the highlighted points in two different point clouds markedPointsCloudLeft
and markedPointsCloudRight
.
To update the visualization of the point cloud, in PCL I have to call updatePointCloud
. As far as I know, in PCL it would look like this:
m_viewer->updatePointCloud(markedPointsCloudLeft, white, "marked cloud left");
or
m_viewer->updatePointCloud(markedPointsCloudRight, white, "marked cloud right");
So if I click on the left viewport v1
, markedPointsCloudLeft
should be updated, the same thing goes for the right one. And here is my problem:
If I click on any of the point clouds, I have to tell markSelectedPoints
which one I clicked at. To do that, I need either the id of the viewport where the cloud is or which point cloud the selected point belongs to. So, for example, if I'm clicking on the left point cloud, I have to tell markSelectedPoints
I'm referring to v1
or that the point belongs to markedPointsCloudLeft
. Until now, I haven't found any function or method in PCL to this data.
Do you have an idea how I could achieve this? Or is there another workaround to get this data? Thanks in advance!