资源简介
opencv相机标定,加上图像坐标到世界坐标的转化
代码片段和文件信息
//#include
//#include
//#include “cv.h“
//#include
//#include
//#include
//#include “atlstr.h“
#include “opencv2/core/core.hpp“
#include “opencv2/imgproc/imgproc.hpp“
#include “opencv2/calib3d/calib3d.hpp“
#include “opencv2/highgui/highgui.hpp“
#include
#include
using namespace std;
using namespace cv;
const int imageWidth = 1600; //摄像头的分辨率
const int imageHeight = 1200;
const int boardWidth = 7; //横向的角点数目
const int boardHeight = 7; //纵向的角点数据
const int boardCorner = boardWidth * boardHeight; //总的角点数据
const int frameNumber =13; //相机标定时需要采用的图像帧数
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 boardwidth int 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(colIndex * squaresize rowIndex * squaresize 0));
}
}
for (int imgIndex = 0; imgIndex < imgNumber; imgIndex++)
{
obj.push_back(imgpoint);
}
}
/*设置相机的初始参数 也可以不估计*/
void CalibrationEvaluate(void)//标定结束后进行评价
{
double err=0;
double total_err=0;
//calibrateCamera(objRealPoint corners Size(imageWidth imageHeight) intrinsic distortion_coeff rvecs tvecs 0);
cout << “每幅图像的定标误差:“ << endl;
for (int i = 0; i < corners.size(); i++)
{
vector image_points2;
vector tempPointSet = objRealPoint[i];
projectPoints(tempPointSet rvecs[i] tvecs[i] intrinsic distortion_coeff image_points2);
vector tempImagePoint = corners[i];
Mat tempImagePointMat = Mat(1 tempImagePoint.size() CV_32FC2);
Mat image_points2Mat = Mat(1 image_points2.size() CV_32FC2);
for (int j = 0; j < tempImagePoint.size(); j++)
{
image_points2Mat.at(0 j) = Vec2f(image_points2[j].x image_points2[j].y);
tempImagePointM
相关资源
- 张正友相机标定Opencv实现
- Kinect相机标定
- 计算机双目立体视觉_)高宏伟
- opencv 张正友相机标定源代码及标定照
- 相机标定单目、双目.zip
- 海康威视标定
- opencv2.4.9 相机定标及图像矫正
- 基于opencv的鱼眼相机标定和透视投影
- 相机标定和鸟瞰图生成_vs2017.rar
- 相机标定代码相机标定代码
- 相机标定时使用的标定板
- halcon相机标定
- 圆形标定板排序.rar
- 相机标定棋盘图
- 张正友标定法原版
- 超详细 halcon 相机标定 !!
- 相机标定源代码
- 坐标纸.rar
- 张正友相机标定棋盘格pdf文件
- opencv4.0+相机标定+Qt5.9
- 基于改进粒子群算法的相机标定优化
- 全自动化的使用opencv的标定程序
- 张氏相机标定法源码+标定板制作代码
- AutoCAD制作的相机标定板 A3(30mm),
- 张正友相机标定Opencv实现(完整程序
- halcon相机标定及机器人手眼标定
评论
共有 条评论