Open NickLaurenson-Visionick opened 2 weeks ago
cv::rgbd::registerDepth segfault in case the depth resolution is greater than the rgb resolution.
cv::rgbd::registerDepth
This is caused by a wrong argument used in the contructor here, and could be fixed as follow:
--- a/modules/rgbd/src/depth_registration.cpp +++ b/modules/rgbd/src/depth_registration.cpp @@ -146,7 +146,7 @@ namespace rgbd // Apply the initial projection to the input depth Mat_<Point3f> transformedCloud; { - Mat_<Point3f> point_tmp(outputImagePlaneSize,Point3f(0.,0.,0.)); + Mat_<Point3f> point_tmp(unregisteredDepth.size(),Point3f(0.,0.,0.)); for(int j = 0; j < unregisteredDepth.rows; ++j) {
#include <opencv2/opencv.hpp> #include <opencv2/rgbd.hpp> int main() { // Example of a 1000x1000 depth image we want to register into a 600x600 color image // Define the intrinsic matrices cv::Matx33d intrinsics_depth(100, 0, 500, 0, 100, 500, 0, 0, 1); cv::Matx33d intrinsics_color(100, 0, 300, 0, 100, 300, 0, 0, 1); cv::Mat dist_coef_color; // Empty distortion coefficients cv::Matx44d extrinsics = cv::Matx44d::eye(); // Create a depth image with resolution 1000x1000 cv::Mat depth(1000, 1000, CV_64F); // Define the output resolution int width = 300; int height = 300; // Register depth cv::Mat registered_depth(cv::Size(width, height), CV_64F); cv::rgbd::registerDepth(intrinsics_depth, intrinsics_color, dist_coef_color, extrinsics, depth, cv::Size(width, height), registered_depth, false // Depth dilation ); return 0; }
System information (version)
Detailed description
cv::rgbd::registerDepth
segfault in case the depth resolution is greater than the rgb resolution.This is caused by a wrong argument used in the contructor here, and could be fixed as follow:
Steps to reproduce
Issue submission checklist