Closed Wallbraker closed 2 years ago
I am also facing the same issue on Ubuntu 20.04.
Same problem on Pop (Ubuntu) 20.10 with OpenCV 3.4.12. Seems to come from OpenCvVisualizer3d::visualizeMesh3D getting empty color and tcoord matrices, changing
src/visualizer/OpenCvVisualizer3D.cpp:623
// No points/mesh to visualize.
if (map_points_3d.rows == 0 || polygons_mesh.rows == 0) {
return;
}
to
// No points/mesh to visualize.
if (map_points_3d.rows == 0
|| polygons_mesh.rows == 0
|| colors.rows == 0
|| tcoords.rows == 0
) {
return;
}
solved the problem for me.
The above fix doesn't show any mesh, applying this patch allows me to show uncoloured mesh.
diff --git a/src/visualizer/OpenCvVisualizer3D.cpp b/src/visualizer/OpenCvVisualizer3D.cpp
index bab1f821..751bc29c 100644
--- a/src/visualizer/OpenCvVisualizer3D.cpp
+++ b/src/visualizer/OpenCvVisualizer3D.cpp
@@ -613,11 +613,13 @@ void OpenCvVisualizer3D::visualizeMesh3D(const cv::Mat& map_points_3d,
color_mesh = true;
}
+ bool tcoords_mesh = false;
if (tcoords.rows != 0) {
CHECK_EQ(map_points_3d.rows, tcoords.rows)
<< "Map points and tcoords should have same number of rows. One"
"tcoord per map point.";
CHECK(!texture.empty());
+ tcoords_mesh = true;
}
// No points/mesh to visualize.
@@ -629,7 +631,7 @@ void OpenCvVisualizer3D::visualizeMesh3D(const cv::Mat& map_points_3d,
cv_mesh.cloud = map_points_3d.t();
cv_mesh.polygons = polygons_mesh;
cv_mesh.colors = color_mesh ? colors.t() : cv::Mat();
- cv_mesh.tcoords = tcoords.t();
+ cv_mesh.tcoords = tcoords_mesh ? tcoords.t() : cv::Mat();
cv_mesh.texture = texture;
// Plot mesh.
This or using Opencv 3.4.2 (on 20.04) works on my side.
Description:
Command:
Console output:
Additional files: Please attach all the files needed to reproduce the error.
Please give also the following information:
Merge pull request #128 from MIT-SPARK/feature/updated_realsense_params