• 大小: 12.12MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-18
  • 语言: 其他
  • 标签: opencv3.0  

资源简介

鱼眼标定校正 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=  12;                    /****    图像数量     ****/    
    Size board_size = Size(96);            /****    定标板上每行、列的角点数       ****/  
    vector corners;                  /****    缓存每幅图像上检测到的角点       ****/
    vector>  corners_Seq;    /****  保存检测到的所有角点       ****/   
    vector  image_Seq;
int successImageNum = 0; /**** 成功提取角点的棋盘图数量 ****/

    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); 
        /* 提取角点 */   
        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“;  
            continue;
            exit(1);   
        } 
        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<<“frame corner#“<
            count = count + corners.size();
successImageNum = successImageNum + 1;
            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_coun

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

     文件     272123  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\10_corner.jpg

     文件     234879  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\10_d.jpg

     文件     283137  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\11_corner.jpg

     文件     229531  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\11_d.jpg

     文件     277407  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\12_corner.jpg

     文件     237454  2016-12-02 21:48  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\12_d.jpg

     文件     272237  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\1_corner.jpg

     文件     215057  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\1_d.jpg

     文件     272727  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\2_corner.jpg

     文件     237377  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\2_d.jpg

     文件     281331  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\3_corner.jpg

     文件     238317  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\3_d.jpg

     文件     285018  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\4_corner.jpg

     文件     255614  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\4_d.jpg

     文件     264594  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\5_corner.jpg

     文件     224656  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\5_d.jpg

     文件     283855  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\6_corner.jpg

     文件     255666  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\6_d.jpg

     文件     292579  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\7_corner.jpg

     文件     267760  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\7_d.jpg

     文件     264245  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\8_corner.jpg

     文件     215486  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\8_d.jpg

     文件     282667  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\9_corner.jpg

     文件     235064  2016-12-02 21:47  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\9_d.jpg

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

     文件       4529  2016-12-02 21:48  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\caliberation_result.txt

     文件       7712  2016-12-02 19:36  3.0鱼眼标定校正\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.vcxproj

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

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

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

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

评论

共有 条评论