[visualization] PCLVisualizer::addCorrespondences/updateCorrespondences does not show all correspondences
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cpp
- Lĩnh vực
- computer-graphics, computer-vision
Hướng nghiên cứu
Bắt đầu với trình tái hiện mwe.cpp và phần triển khai addCorrespondences()/updateCorrespondences() trong visualization/include/pcl/visualization/impl/pcl_visualizer.hpp, bao gồm cả khu vực được tham chiếu quanh dòng 1259. So sánh hành vi kết xuất của nó với vòng lặp addLine() đang hoạt động và điều tra lý do không phải mọi correspondence được lặp qua đều trở nên hiển thị; hoàn tất khi tất cả correspondence được hiển thị thông qua các API correspondence.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
I use Registration::registerVisualizationCallback() to show correspondences. The code employs PCLVisualizer::addCorrespondences(). This does not lead to all correspondences getting shown. If instead I iterate over all correspondences manually and addLine() for each, all are shown as expected. Somewhere inside PCLVisualizer, items get lost.
Expected behavior
All correspondences passed to addCorrespondences() function should be shown.
Current Behavior
Not all correspondences passed to addCorrespondences() function are shown.
To Reproduce
mwe.cpp
#include <pcl/io/pcd_io.h>
#include <pcl/registration/icp.h>
#include <pcl/visualization/pcl_visualizer.h>
using namespace std;
using namespace pcl;
using namespace pcl::visualization;
using PointT = PointXYZ;
using CloudT = PointCloud<PointT>;
using namespace Eigen;
struct RegistrationVisualizer {
pcl::visualization::PCLVisualizer::Ptr optimization_viewer;
RegistrationVisualizer();
void visualize_registration(pcl::Registration<PointT, PointT> ®);
};
int main(int argc, char *argv[]) {
Matrix4f transformation;
transformation << 1, 0, 0, 6.7, 0, 1, 0, 12.3, 0, 0, 1, 0.7, 0, 0, 0, 1;
CloudT::Ptr source{new CloudT};
CloudT::Ptr target{new CloudT};
io::loadPCDFile("../scene_filtered.pcd", *target);
io::loadPCDFile("../template.pcd", *source);
IterativeClosestPoint<PointT, PointT> icp;
icp.setInputSource(source);
icp.setInputTarget(target);
icp.setMaxCorrespondenceDistance(0.1);
RegistrationVisualizer regvis;
regvis.visualize_registration(icp);
icp.align(*source, transformation);
return 0;
}
RegistrationVisualizer::RegistrationVisualizer() {
optimization_viewer = pcl::make_shared<pcl::visualization::PCLVisualizer>();
optimization_viewer->setWindowName("Correspondences");
}
void RegistrationVisualizer::visualize_registration(
pcl::Registration<PointT, PointT> ®) {
using namespace pcl;
using namespace pcl::visualization;
std::function<
pcl::Registration<PointT, PointT>::UpdateVisualizerCallbackSignature>
callback([this](const CloudT &c1, const pcl::Indices &idxs1,
const CloudT &c2, const pcl::Indices &idxs2) {
if (!idxs1.size() || !idxs2.size()) {
return;
}
// turn idxs into one correspondence vector
Correspondences correspondences;
for (size_t i = 0; i < idxs1.size(); ++i) {
correspondences.push_back(Correspondence(idxs1[i], idxs2[i], 1));
}
// viewer needs ptrs, not values (expensiveish)
const CloudT::Ptr c1_correspondences = c1.makeShared();
const CloudT::Ptr c2_correspondences = c2.makeShared();
if (!this->optimization_viewer->updatePointCloud<PointT>(
c1_correspondences, "c1")) {
this->optimization_viewer->addPointCloud<PointT>(c1_correspondences,
"c1");
this->optimization_viewer->setPointCloudRenderingProperties(
PCL_VISUALIZER_COLOR, 0, 1, 1, "c1");
this->optimization_viewer->setPointCloudRenderingProperties(
PCL_VISUALIZER_POINT_SIZE, 3, "c1");
}
if (!this->optimization_viewer->updateText("Source", 10, 10)) {
this->optimization_viewer->addText("Source", 10, 10, 20, 0, 1, 1);
}
if (!this->optimization_viewer->updatePointCloud<PointT>(
c2_correspondences, "c2")) {
this->optimization_viewer->addPointCloud<PointT>(c2_correspondences,
"c2");
this->optimization_viewer->setPointCloudRenderingProperties(
PCL_VISUALIZER_COLOR, 1, 1, 0, "c2");
this->optimization_viewer->setPointCloudRenderingProperties(
PCL_VISUALIZER_POINT_SIZE, 3, "c2");
}
if (!this->optimization_viewer->updateText("Target", 10, 40)) {
this->optimization_viewer->addText("Target", 10, 40, 20, 1, 1, 0);
}
// works as expected
/* int c = 0; */
/* for (const auto& corr : correspondences) { */
/* const auto p1 = c1_correspondences->points[corr.index_query]; */
/* const auto p2 = c2_correspondences->points[corr.index_match]; */
/* const string name = "line" + to_string(c); */
/* this->optimization_viewer->removeShape(name); */
/* this->optimization_viewer->addLine(p1, p2, 1, 0, 0, name); */
/* c++; */
/* } */
// many lines missing
if (!this->optimization_viewer->updateCorrespondences<PointT>(
c1_correspondences, c2_correspondences, correspondences)) {
this->optimization_viewer->addCorrespondences<PointT>(
c1_correspondences, c2_correspondences, correspondences,
"correspondences");
}
this->optimization_viewer->setShapeRenderingProperties(
PCL_VISUALIZER_LINE_WIDTH, 5, "correspondences");
this->optimization_viewer->spin();
});
reg.registerVisualizationCallback(callback);
}
CMakeLists.txt
cmake_minimum_required(VERSION 3.19.8)
set(CMAKE_CXX_STANDARD 20)
find_package(PCL REQUIRED)
add_executable(mwe mwe.cpp)
target_link_libraries(mwe ${PCL_LIBRARIES})
target_include_directories(mwe PRIVATE ${PCL_INCLUDE_DIRS})
pcds:
First screenshot is using updateCorrespondences(). Notice how on the right there are no correspondences.
Second screenshot I add them by hand with addLine(). Many correspondences on the right.
Your Environment (please complete the following information):
- OS: macos 12.6.5
- Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202) (arm)
- PCL Version 1.13 (4d8f60706c5d97c4a5b3b3da65f107cc7716ce1e)
I'm at a loss here. I don't know VTK, but the code in addCorrespondences() does not look wrong. I could verify that in https://github.com/PointCloudLibrary/pcl/blob/master/visualization/include/pcl/visualization/impl/pcl_visualizer.hpp#L1259, the full number of found correspondences is iterated, but somehow not everything shows up.
This led me on a merry chase as I had first assumed the correspondence estimation to somehow fail, but it seems to be just the visualization.
- Ngôn ngữ chính
- C++
- Star
- 11.2k
- Fork
- 4.7k
- Merge trung bình
- 6 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PointCloudLibrary/pcl
-
kind: bug status: triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
PointCloudLibrary/pcl#6536 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
PointCloudLibrary/pcl#6509 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
kind: bug status: triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PointCloudLibrary/pcl#6537 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[cmake] QHULL/FLANN dll missing when linking single moduleCó thể đã có người làm @SIDDARTHAREDDY8 đã nhận 6 ngày trước. Đang mởkind: bug module: cmake
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 50/100
PointCloudLibrary/pcl#6522 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
kind: bug status: triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PointCloudLibrary/pcl#6395 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của PointCloudLibrary/pcl
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
HarperFast/rocksdb-js#1131 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/daemon bug good first issue platform/linux priority/p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ToshiNamura/Deimos#5 ·
-
needs-format
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Niko1221/Strata#6251 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[Bug]: NP 管理器文件编辑器里删除键无效Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
metasequoiaime/msime#11666 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
patrick-hudson/put.gd-desktop#1679 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày