PointCloudLibrary / PointCloudLibrary/pcl

[visualization] AreaPickingEvent.getPointsIndices() returns wrong indices

Open
#6,119 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: bug status: triage
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

My Environment:

  • OS: Windows 11
  • Compiler: MSVC2019_64
  • PCL Version 1.12.1
  • VTK 9.1.0
  • Qt 5.15.2

Problem

I integrated the areapickingevent under the visualization module in my Qt program, and tried to get the point cloud index of my selected area through getPointsIndices. But after I visualized the resulting point cloud, I found that the point cloud index was wrong.

8a9d95690be3ac89b38d439f3856130

The green box in the picture above is the part I selected.

f144d201a00337c93d1b5182146f25e

The green box in the above picture is the result of the selected point cloud visualization.

Code

void PCL_test::pp_callback_AreaSelect(const pcl::visualization::AreaPickingEvent& event, void* args)
{
	PCL_test* p = (PCL_test*)args;
	std::vector<int > indices;
	if (event.getPointsIndices(indices) == -1)
		return;

	p->selected_3D_points->clear();

	qDebug() << "Pointcloud area size: " << indices.size() << endl;
	for (int i = 0; i < indices.size(); ++i)
	{
		qDebug() << "Selected point[" << i + 1 << "] indice" << indices[i] << ":" << p->cloudptr->points.at(indices[i]).x << ", " << p->cloudptr->points.at(indices[i]).y << ", " << p->cloudptr->points.at(indices[i]).z << endl;
		p->selected_3D_points->points.push_back(p->cloudptr->points.at(indices[i]));
	}
	//qDebug() << "Select points size: " << p->selected_3D_points->width << "*" << p->selected_3D_points->height << endl;

	//*p->cloudptr = *p->selected_3D_points;
	pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZI> cloud_color(p->selected_3D_points, 0, 255, 0);
	p->cloud_viewer->removeShape("pick");
	p->cloud_viewer->addPointCloud(p->selected_3D_points, cloud_color, "pick");
	p->cloud_viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "pick");
	p->ui.qvtkwidget_cloudviewer->update();
}

Additional context
I found that getPointsIndices does not have any parameters for viewing angle settings, and I don't know what other factors will affect the accuracy of point cloud selection. In addition, I would like to add that I did not see any specific point cloud selection operation instructions in the official documentation, such as "press x first, then use the left mouse button to select, and then press x to visualize the selection results". I hope the official can add more detailed introductions in subsequent updates. Thanks a lot.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pcl::visualization::AreaPickingEvent::getPointsIndices and the pp_callback_AreaSelect callback shown in the issue. Reproduce the area selection using the documented visualization interaction, then compare returned indices with the selected point cloud and review the AreaPickingEvent documentation. Done means the indices match the selected area and the required selection steps are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.