我有一个由多个图像创建的点云。我从中提取了一个平面,它也在三维坐标系中,这意味着我有该平面的平面方程。但是在所有原始图像中,平面都具有正常视图,即平面与观察平面不平行。但是,由于我有飞机的3D云,我想在XY平面上投影,也就是说我想让平面与观察平面平行并从中创建一个图像。在C ++ / OpenCV中执行此操作的算法或函数是什么?
答案 0 :(得分:1)
我不确定你究竟想要做什么,但这些可能对你有所帮助,我用棋盘做到了这一点:
std::vector<cv::Point2f> not_a_rect_shape; // In this vector you should save the x,y coordinates of your 3D rect
// the not_a_rect_shapecoordinates are from you source frame
// Define the destination image
quad = cv::Mat::zeros(300, 220, CV_8UC3); // the size is important, it depends on your application, I have to say that 300x220 isn't always the right one. you have to give more infomations!!
// these will be the parallel plane vector of point
quad_pts.push_back(cv::Point2f(0, 0));
quad_pts.push_back(cv::Point2f(quad.cols, 0));
quad_pts.push_back(cv::Point2f(quad.cols, quad.rows));
quad_pts.push_back(cv::Point2f(0,quad.rows));
transformationMatrix= cv::getPerspectiveTransform(not_a_rect_shape, quad_pts);// this is you transformation matirx
cv::warpPerspective(src, quad, transformationMatrix,quad.size(),CV_INTER_LINEAR,cv::BORDER_ISOLATED); // the flags could change
现在四帧应该是您正在寻找的! 我希望它有所帮助