• 大小: 7.15MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-23
  • 语言: 其他
  • 标签: opencv3.0  改进  

资源简介

详见后补充说明http://blog.csdn.net/qq_15947787/article/details/51441031

资源截图

代码片段和文件信息

//运行环境 VS2012+opencv3.0
#include 
#include 
using namespace std;
using namespace cv;

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

    /************************************************************************  
           读取每一幅图像,从中提取出角点,然后对角点进行亚像素精确化  
    *************************************************************************/   
    cout<<“开始提取角点………………“< //以下三行为需要手动修改的参数
    int image_count=  14;                   //图像数量
    Size board_size = Size(96);            //定标板上每行、列的角点数
int x_expand = 0y_expand = 200; //xy方向的扩展(x横向,y纵向),适当增大可以不损失原图像信息

    vector corners;                //缓存每幅图像上检测到的角点
    vector>  corners_Seq;   //保存检测到的所有角点/   
    vector  image_Seq;
int successImageNum = 0; //成功提取角点的棋盘图数量
bool conner_flag = true; //所有图像角点提取成功为true,其余为false
    for( int i = 0;  i != image_count ; i++)
    {
        cout<<“img“<        string imageFileName;
        std::stringstream StrStm;
        StrStm<        StrStm>>imageFileName;
        imageFileName += “.jpg“;
        cv::Mat imageSrc = imread(“img“+imageFileName); 
Mat image;//边界扩展后的图片
copyMakeBorder(imageSrcimage(int)(y_expand/2)(int)(y_expand/2)(int)(x_expand/2)(int)(x_expand/2)BORDER_CONSTANT);
        /* 提取角点 */   
        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<<“img“<            conner_flag = false;
break;
        } 
        else
        {   
            /* 亚像素精确化 */
            cornerSubPix(imageGray corners Size(11 11) Size(-1 -1) TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER 30 0.1));
            /* 绘制检测到的角点并保存 */
            Mat imageTemp = image.clone();
            for (int j = 0; j < corners.size(); j++)
            {
                circle( imageTemp corners[j] 10 Scalar(00255) 2 8 0);
            }
            string imageFileName;
            std::stringstream StrStm;
            StrStm<            StrStm>>imageFileName;
            imageFileName += “_corner.jpg“;
            imwrite(imageFileNameimageTemp);
            cout<<“img“<
successImageNum = successImageNum + 1;
            corners_Seq.push_back(corners);
        }   
        image_Seq.push_back(image);
    }   
if (!conner_flag)//如果有提取失败的标定图,退出程序
{
system(“pause“);
return 0;
}
    cout<<“角点提取完成!“<    /************************************************************************  
           摄像机定标  
    *************************************************************************/   
    cout<<“开始定标………………“< Size square_size = Size(2020

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

     文件     130403  2016-05-19 09:12  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\a.jpg

     文件       5249  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\caliberation_result.txt

     文件       7712  2016-10-24 22:07  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj

     文件        941  2016-05-21 18:06  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj.filters

     文件        164  2016-10-24 22:07  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj.user

     文件     171355  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img1.jpg

     文件     169629  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img10.jpg

     文件     163033  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img11.jpg

     文件     175824  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img12.jpg

     文件     179415  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img13.jpg

     文件     181908  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img14.jpg

     文件     179746  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img2.jpg

     文件     177284  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img3.jpg

     文件     179744  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img4.jpg

     文件     177735  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img5.jpg

     文件     184323  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img6.jpg

     文件     188708  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img7.jpg

     文件     164818  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img8.jpg

     文件     170484  2016-05-19 09:04  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\img9.jpg

     文件     342231  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\TestOutput1 y=0.jpg

     文件     392961  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\TestOutput2 y=200.jpg

     文件       2108  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\cl.command.1.tlog

     文件      11310  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\CL.read.1.tlog

     文件        592  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\CL.write.1.tlog

     文件        130  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\ConsoleApplication1.lastbuildstate

     文件       3768  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\ConsoleApplication1.log

     文件          2  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-cvtres.read.1.tlog

     文件          2  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-cvtres.write.1.tlog

     文件          2  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-rc.read.1.tlog

     文件          2  2016-10-24 23:29  3.0鱼眼标定校正 改进\ConsoleApplication1\ConsoleApplication1\x64\Debug\link-rc.write.1.tlog

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

评论

共有 条评论