//
//旋转矩阵 平移矩阵测试//
//
// 旋转矩阵R 转为旋转向量 rvecs
Mat rvecs; //旋转向量
Rodrigues(R,rvecs);
Point3f point3f;
Mat map1(img2.rows, img2.cols, CV_32FC1);
Mat map2(img2.rows, img2.cols, CV_32FC1);
Mat object_Matrix = (Mat_<double>(3, 1) << 0, 0, 0);
//对图像的坐标进行变换
for (int i = 0; i < img2.rows; i++)
{
for (int j = 0; j < img2.cols; j++)
{
object_Matrix.at<double>(0, 0) = i;
object_Matrix.at<double>(1, 0) = j;
object_Matrix.at<double>(2, 0) = 0;
object_Matrix = object_Matrix + T;
object_Matrix = R*object_Matrix;
map1.at<float>(i, j) = object_Matrix.at<double>(1, 0);
map2.at<float>(i, j) = object_Matrix.at<double>(0, 0);
}
}
Mat imgk;
remap(img1, imgk, map1, map2, CV_INTER_LINEAR);
OpenCV编程->图像三维空间旋转并投影到XY平面
最新推荐文章于 2024-06-20 21:25:38 发布