资源简介
opencv 单目 摄像头 标定 带图片
代码片段和文件信息
#include
#include
#include
// OpenCV
#include
#include
#include
#include
using namespace std;
using namespace cv;
const int imageWidth = 640; //摄像头的分辨率
const int imageHeight = 480;
const int boardWidth = 5; //横向的角点数目
const int boardHeight = 4; //纵向的角点数据
const int boardCorner = boardWidth * boardHeight; //总的角点数据
const int frameNumber = 12; //相机标定时需要采用的图像帧数
const int squareSize = 20; //标定板黑白格子的大小 单位mm
const Size boardSize = Size(boardWidth boardHeight); //
Mat intrinsic; //相机内参数
Mat distortion_coeff; //相机畸变参数
vector rvecs; //旋转向量
vector tvecs; //平移向量
vector> corners; //各个图像找到的角点的集合 和objRealPoint 一一对应
vector> objRealPoint; //各副图像的角点的实际物理坐标集合
vector corner; //某一副图像找到的角点
Mat rgbImage grayImage;
/*计算标定板上模块的实际物理坐标*/
void calRealPoint(vector>& obj int boardwidthint boardheight int imgNumber int squaresize)
{
// Mat imgpoint(boardheight boardwidth CV_32FC3Scalar(000));
vector imgpoint;
for (int rowIndex = 0; rowIndex < boardheight; rowIndex++)
{
for (int colIndex = 0; colIndex < boardwidth; colIndex++)
{
// imgpoint.at(rowIndex colIndex) = Vec3f(rowIndex * squaresize colIndex*squaresize 0);
imgpoint.push_back(Point3f(rowIndex * squaresize colIndex * squaresize 0));
}
}
for (int imgIndex = 0; imgIndex < imgNumber; imgIndex++)
{
obj.push_back(imgpoint);
}
}
/*设置相机的初始参数 也可以不估计*/
void guessCameraParam(void )
{
/*分配内存*/
intrinsic.create(3 3 CV_64FC1);
distortion_coeff.create(5 1 CV_64FC1);
/*
fx 0 cx
0 fy cy
0 0 1
*/
intrinsic.at(00) = 256.8093262; //fx
intrinsic.at(0 2) = 160.2826538; //cx
intrinsic.at(1 1) = 254.7511139; //fy
intrinsic.at(1 2) = 127.6264572; //cy
intrinsic.at(0 1) = 0;
intrinsic.at(1 0) = 0;
intrinsic.at(2 0) = 0;
intrinsic.at(2 1) = 0;
intrinsic.at(2 2) = 1;
/*
k1 k2 p1 p2 p3
*/
distortion_coeff.at(0 0) = -0.193740; //k1
distortion_coeff.at(1 0) = -0.378588; //k2
distortion_coeff.at(2 0) = 0.028980; //p1
distortion_coeff.at(3 0) = 0.008136; //p2
distortion_coeff.at(4 0) = 0; //p3
}
void outputCameraParam(void )
{
/*保存数据*/
//cvSave(“cameraMatrix.xml“ &intrinsic);
//cvSave(“cameraDistoration.xml“ &distortion_coeff);
//cvSave(“rotatoVector.xml“ &rvecs);
//cvSave(“translationVector.xml“ &tvecs);
/*输出数据*/
cout << “fx :“ << intrinsic.at(0 0) << endl << “fy :“ << intrinsic.at(1 1) << endl;
cout << “cx :“ << intrinsic.at(0 2) << endl << “cy :“ << intrinsic.at(1 2) << endl;
cout << “k1 :“ << distortion_coeff.at
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 28542 2009-11-06 19:34 03.jpg
文件 30202 2009-11-06 19:34 04.jpg
文件 29695 2009-11-06 19:34 05.jpg
文件 25192 2009-11-06 19:34 06.jpg
文件 26076 2009-11-06 19:35 07.jpg
文件 33800 2009-11-06 19:35 08.jpg
文件 33484 2009-11-06 19:35 09.jpg
文件 32192 2009-11-06 19:36 10.jpg
文件 35004 2009-11-06 19:37 11.jpg
文件 33999 2009-11-06 19:38 12.jpg
文件 6062 2016-05-23 21:49 CalibrationOpenCV3.cpp
文件 28056 2009-11-06 19:33 01.jpg
文件 26742 2009-11-06 19:33 02.jpg
----------- --------- ---------- ----- ----
369046 13
- 上一篇:基于django的网页倒计时
- 下一篇:在树莓派上创建无线热点
相关资源
- ippicv_2017u2_lnx_intel64_20170418.tgz
- DirectShow虚拟摄像头工程
- cxcore.lib的生成工程
- Caffe安装支持文件
- opencv调用摄像头捕捉并进行人脸识别
- opencv+串口通讯
- 图像处理源码 opencv图像处理源码
- 基于USB摄像头的条形码识别
- 摄像头串口调试助手
- 基于51单片机和OV7670摄像头的颜色跟踪
- arm板上实现usb摄像头采集及显示(q
- 基于labview通过usb摄像头采集图像子
- opencv2.4.9opencv_createsamples.exe和opencv_h
- CCD摄像头程序,舵机,电机控制程序
- LSD-直线检测源码
- 128芯片摄像头采集程序
- 小觅代码实现
- Opencv 特征点提取 代码
- Opencv 各种特征点提取和匹配
- opencv调用摄像头并截图保存
- KinectV2 opencv qt 实现平面测量
- opencv_createsamples.exe opencv_traincascade.
- 树莓派摄像头资料和例程
- CvvImage类
- OpenCv视频采集
- 智能车摄像头组完整程序
- OPENCV人脸检测程序可直接运行
- kinect深度图像去噪
- 恩智浦摄像头双车程序
- 用OpenCV实现Photoshop算法(九): 高反差
评论
共有 条评论