基于opencv的双目标定

在于双目测距接触几个月之后,逐渐对双目测距熟悉起来(OpenCV实现),尤其是在写程序的时候,不会像以前那么毛毛躁躁,在CSDN上看过很多大神的博客,也慢慢的开始尝试着依据大神的东西按照自己的想法写一些简单的程序。对于双目测距的原理我就不做过多的叙述,很多大神有些的很详细的博客。我把今天的程序分享出来只是为了能让刚接触双目的小可爱们快速了解双目标定的实现过程,有什么问题的话可以留言交流哦。

#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
VideoCapture cap;
Mat frame;
Mat Roil;
Mat Roir;
char key;
bool camera;
const int imageWidth = 320;                             //摄像头的分辨率  
const int imageHeight = 240;
const int boardWidth = 7;                               //横向的角点数目  
const int boardHeight = 5;    //纵向的角点数据
const int frameNumber = 13;                             //相机标定时需要采用的图像帧数  
const int squareSize = 25;
const Size boardSize = Size(boardWidth, boardHeight);
Size imageSize = Size(imageWidth, imageHeight);
vector<vector<Point2f> > imagePoints;
vector<int> usefulImgIndeces;
vector<Mat> images_L;
vector<Mat> images_R;
vector<vector<Point2f>> imagePointL;                    //左边摄像机所有照片角点的坐标集合  
vector<vector<Point2f>> imagePointR;
vector<vector<Point3f>> objRealPoint;

vector<Point2f> cornerL;                              //左边摄像机某一照片角点坐标集合  
vector<Point2f> cornerR;                              //右边摄像机某一照片角点坐标集合  
vector<Point2f> corner;
Mat imageL, imageR;
Mat cameraMatrix_L ;
Mat distCoeffs_L;
Mat cameraMatrix_R;
Mat distCoeffs_R ;
Mat image_l;
Mat image_r;
Mat undistort_l;
Mat undistort_r;
Mat grayimagesl;
Mat grayimagesr;
Mat rectifyImageL, rectifyImageR;
Mat R, T, E, F;
Mat Rl, Rr, Pl, Pr, Q;
Mat mapLx, mapLy, mapRx, mapRy;                         
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值