资源简介

opencv 鱼眼镜头标定校正 ,见链接http://blog.csdn.net/qq_15947787/article/details/51441031

资源截图

代码片段和文件信息

#include 
#include 
using namespace std;
using namespace cv;

int main()
{
ofstream fout(“caliberation_result.txt“);  /**    保存定标结果的文件     **/

/************************************************************************  
           读取每一幅图像,从中提取出角点,然后对角点进行亚像素精确化  
    *************************************************************************/   
    cout<<“开始提取角点………………“<    int image_count=  4;                    /****    图像数量     ****/   
    Size image_size;                         /****     图像的尺寸      ****/   
    Size board_size = Size(69);            /****    定标板上每行、列的角点数       ****/  
vector corners;                  /****    缓存每幅图像上检测到的角点       ****/
vector>  corners_Seq;    /****  保存检测到的所有角点       ****/   
vector  image_Seq;


int count = 0;
for( int i = 0;  i != image_count ; i++)
{
cout<<“frame #“< string imageFileName;
std::stringstream StrStm;
StrStm< StrStm>>imageFileName;
imageFileName += “.jpg“;
        cv::Mat image = imread(“img“+imageFileName); 
image_size = image.size();
//image_size = Size(image.cols  image.rows);
        /* 提取角点 */   
Mat imageGray;
cvtColor(image imageGray  CV_RGB2GRAY);
bool patternfound = findChessboardCorners(image board_size cornersCALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE+ 
CALIB_CB_FAST_CHECK );
        if (!patternfound)   
        {   
            cout<<“can not find chessboard corners!\n“;   
            exit(1);   
        } 
else
{   
            /* 亚像素精确化 */
cornerSubPix(imageGray corners Size(11 11) Size(-1 -1) TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER 30 0.1));
count = count + corners.size();
            corners_Seq.push_back(corners);
        }   
image_Seq.push_back(image);
    }   
    cout<<“角点提取完成!\n“; 
    /************************************************************************  
           摄像机定标  
    *************************************************************************/   
    cout<<“开始定标………………“<    Size square_size = Size(2020);                                      /**** 实际测量得到的定标板上每个棋盘格的大小   ****/  
vector>  object_Points;                                      /****  保存定标板上角点的三维坐标   ****/


    Mat image_points = Mat(1 count  CV_32FC2 Scalar::all(0));          /*****   保存提取的所有角点   *****/   
vector  point_counts;                                          /*****    每幅图像中角点的数量    ****/   
Mat intrinsic_matrix = Mat(33 CV_32FC1 Scalar::all(0));                /*****    摄像机内参数矩阵    ****/   
    Mat distortion_coeffs = Mat(14 CV_32FC1 Scalar::all(0));            /* 摄像机的4个畸变系数:k1k2p1p2 */ 
    vector rotation_vectors;                                      /* 每幅图像的旋转向量 */  
vector translation_vectors;                                  /* 每幅图像的平移向量 */  
     
    /* 初始化定标板上角点的三维坐标 */     
    for (i

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    2098615  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\1_d.jpg

     文件    1046300  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\2_d.jpg

     文件     929969  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\3_d.jpg

     文件    1003446  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\4_d.jpg

     文件       1992  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\caliberation_result.txt

     文件       7858  2016-05-17 17:16  鱼眼标定\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj

     文件        941  2016-05-17 17:16  鱼眼标定\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj.filters

     文件    1502939  2016-05-17 16:17  鱼眼标定\ConsoleApplication1\ConsoleApplication1\img1.jpg

     文件    1436127  2016-05-17 20:59  鱼眼标定\ConsoleApplication1\ConsoleApplication1\img2.jpg

     文件    1311878  2016-05-17 20:59  鱼眼标定\ConsoleApplication1\ConsoleApplication1\img3.jpg

     文件    1390039  2016-05-17 20:59  鱼眼标定\ConsoleApplication1\ConsoleApplication1\img4.jpg

     文件    1343139  2016-05-17 16:17  鱼眼标定\ConsoleApplication1\ConsoleApplication1\test.jpg

     文件     968935  2016-05-17 22:45  鱼眼标定\ConsoleApplication1\ConsoleApplication1\TestOutput.jpg

     文件        684  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\cl.command.1.tlog

     文件      13198  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\CL.read.1.tlog

     文件        490  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\CL.write.1.tlog

     文件         93  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\ConsoleApplication1.lastbuildstate

     文件       3455  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\ConsoleApplication1.log

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-cvtres.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-cvtres.write.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-rc.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-rc.write.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460-cvtres.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460-cvtres.write.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460-rc.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460-rc.write.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.11460.write.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.1564-cvtres.read.1.tlog

     文件          2  2016-05-17 22:44  鱼眼标定\ConsoleApplication1\ConsoleApplication1\x64\Debug\link.1564-cvtres.write.1.tlog

............此处省略28个文件信息

评论

共有 条评论