资源简介
基于opencv的已知左右图像坐标求空间中三维坐标,以及已知空间坐标求其在左右图像中的二维坐标。

代码片段和文件信息
//opencv2.4.9 vs2012
#include
#include
#include
using namespace std;
using namespace cv;
Point2f xyz2uv(Point3f worldPointfloat intrinsic[3][3]float translation[1][3]float rotation[3][3]);
Point3f uv2xyz(Point2f uvLeftPoint2f uvRight);
//图片对数量
int PicNum = 14;
//左相机内参数矩阵
float leftIntrinsic[3][3] = {4037.82450 0 947.65449
0 3969.79038 455.48718
0 0 1};
//左相机畸变系数
float leftDistortion[1][5] = {0.18962 -4.05566 -0.00510 0.02895 0};
//左相机旋转矩阵
float leftRotation[3][3] = {0.912333 -0.211508 0.350590
0.023249 -0.828105 -0.560091
0.408789 0.519140 -0.750590};
//左相机平移向量
float leftTranslation[1][3] = {-127.199992 28.190639 1471.356768};
//右相机内参数矩阵
float rightIntrinsic[3][3] = {3765.83307 0 339.31958
0 3808.08469 660.05543
0 0 1};
//右相机畸变系数
float rightDistortion[1][5] = {-0.24195 5.97763 -0.02057 -0.01429 0};
//右相机旋转矩阵
float rightRotation[3][3] = {-0.134947 0.989568 -0.050442
0.752355 0.069205 -0.655113
-0.644788 -0.126356 -0.753845};
//右相机平移向量
float rightTranslation[1][3] = {50.877397 -99.796492 1507.312197};
int main()
{
//已知空间坐标求成像坐标
/*Point3f point(700220530);
cout<<“左相机中坐标:“< cout< cout<<“右相机中坐标:“< cout<
//已知左右相机成像坐标求空间坐标
//Point2f l = xyz2uv(pointleftIntrinsicleftTranslationleftRotation);
//Point2f r = xyz2uv(pointrightIntrinsicrightTranslationrightRotation);
Point2f l =(2000 1000);
Point2f r =(10001000);
Point3f worldPoint;
worldPoint = uv2xyz(lr);
cout<<“空间坐标为:“<
system(“pause“);
return 0;
}
//************************************
// Description: 根据左右相机中成像坐标求解空间坐标
// Method: uv2xyz
// FullName: uv2xyz
// Access: public
// Parameter: Point2f uvLeft
// Parameter: Point2f uvRight
// Returns: cv::Point3f
// Author: 小白
// Date: 2017/01/10
// History:
//************************************
Point3f uv2xyz(Point2f uvLeftPoint2f uvRight)
{
// [u1] |X| [u2] |X|
//Z*|v1| = Ml*|Y| Z*|v2| = Mr*|Y|
// [ 1] |Z| [ 1] |Z|
// |1| |1|
Mat mLeftRotation = Mat(33CV_32FleftRotation);
Mat mLeftTranslation = Mat(31CV_32FleftTranslation);
Mat mLeftRT = Mat(34CV_32F);//左相机M矩阵
hconcat(mLeftRotationmLeftTranslationmLeftRT);
Mat mLeftIntrinsic = Mat(33CV_32FleftIntrinsic);
Mat mLeftM = mLeftIntrinsic * mLeftRT;
//cout<<“左相机M矩阵 = “<
Mat mRightRotation = Mat(33CV_32FrightRotation);
Mat mRightTranslation = Mat(31CV_32FrightTranslation);
Mat mRightRT = Mat(34CV_32F);//右相机M矩阵
hconcat(mRightRotationmRightTranslationmRightRT);
Mat mRightIntrinsic = Mat(3
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 80384 2018-11-12 17:44 xyz2uv\Debug\myfirst_opencv.exe
文件 419016 2018-11-12 17:44 xyz2uv\Debug\myfirst_opencv.ilk
文件 2108416 2018-11-12 17:44 xyz2uv\Debug\myfirst_opencv.pdb
文件 26563 2018-11-08 19:15 xyz2uv\girl.jpg
文件 1322 2018-11-12 17:43 xyz2uv\myfirst_opencv\Debug\cl.command.1.tlog
文件 19944 2018-11-12 17:43 xyz2uv\myfirst_opencv\Debug\CL.read.1.tlog
文件 802 2018-11-12 17:43 xyz2uv\myfirst_opencv\Debug\CL.write.1.tlog
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
文件 2 2018-11-12 17:44 xyz2uv\myfirst_opencv\Debug\li
............此处省略51个文件信息
相关资源
- 基于OpenCV的数字识别468815
- 使用opencv去掉二值化图像中黑色面积
- opencv环境配置
- win10 64位下编译的opencv4.5.5库,opencv
- NVIDIAOpticalFlowSDK-79c6cee80a2df9a196f20afd6
- opencv_contrib-3.4.0.zip
- opencv2.4.9源码分析——SIFT
- 用两个摄像头实现,双目标定,双目
- opencv_traincascade训练分类器,手势识别
- opencv3.0交叉编译用parallel.cpp
- 基于opencv的图像识别识别图像中的色
- 基于openCV的识别特定颜色区域
- 基于OpenCV的分水岭算法实现
- QT+opencv+OCR 身份证号码,银行卡号识别
- opencv视频特定颜色区域识别
- 把RGB转换为HSV和HSI然后根据黄色和蓝
- opencv视觉测距
- 基于Qt和opencv的身份证号码识别系统
- opencv_ffmpeg249.dll
- SfM稀疏三维点云重建--完整工程文件
- 基于opencv的数人头程序源代码
- 利用OpenCV中的Stitcher类实现全景图像拼
- opencv实现的sift算法源码,包含了图像
- openCV 上的小波变换
- 基于OPENCV的车牌识别系统设计
- 617张国内车牌60-17bmp图片用于OpenCV正样
- hog特征提取,c版本代码
- 基于Qt5.8+OpenCV3.2的Basler多相机触发开
- 基于Opencv实现的图像纠偏
- ImageWatch2019.vsix
评论
共有 条评论