提问人:lonewolf 提问时间:11/7/2023 更新时间:11/7/2023 访问量:20
从 opencv reprojectImageTo3D 获取超大量级 XYZ
Getting extremely large magnitude XYZ from opencv reprojectImageTo3D
问:
我正在尝试使用立体视觉生成 3D 世界坐标。
我正在获得差异图,这是我处理它的方式。
left_ret, leftFrame = left_camera.read()
fixedLeft = cv2.remap(leftFrame, leftMapX, leftMapY, cv2.INTER_LINEAR)
fixedRight = cv2.remap(rightFrame, rightMapX, rightMapY, cv2.INTER_LINEAR)
grayLeft = cv2.cvtColor(fixedLeft, cv2.COLOR_BGR2GRAY)
grayRight = cv2.cvtColor(fixedRight, cv2.COLOR_BGR2GRAY)
disparity = stereoMatcher.compute(grayLeft, grayRight).astype(np.float32)/16.0
image_publisher.publish(bridge.cv2_to_imgmsg(disparity.astype(np.float32), "32FC1"))
使用视差图,我用它来获取 3D 坐标。cv::reprojectImageTo3D
pcl::PointXYZ point;
try {
disparity_map = cv_bridge::toCvShare(msg, "32FC1")->image;
cv::Mat depth_image = cv::Mat::zeros(disparity_map.size().height, disparity_map.size().width, CV_32FC3);
cv::reprojectImageTo3D(disparity_map, depth_image, Q);
for (int i = 0; i < depth_image.rows; i++) {
for (int j = 0; j < depth_image.cols; j++) {
auto intensity = depth_image.at<cv::Vec3f>(i, j);
std::cout << intensity << std::endl;
}
}
问题:
它返回
[-27.7079, 2.54654e+23, -0.469625]
[-27.7079, 2.54654e+23, -0.469625]
[-27.7079, 6.43e+24, -0.469625]
[-27.7079, 6.43e+24, -0.469625]
[-27.7079, 6.43e+24, -0.469625]
[-27.7079, 6.4247e+24, -0.469625]
[-27.7079, 6.4247e+24, -0.469625]
[-27.7079, 6.4247e+24, -0.469625]
[-27.7079, 6.41939e+24, -0.469625]
[-27.7079, 6.4247e+24, -0.469625]
[-27.7079, 6.43e+24, -0.469625]
[-27.7079, 2.54654e+23, -0.469625]
现在,这些值的大小没有意义。 我到底做错了什么?
答: 暂无答案
评论