OpenCV相机标定板 OpenCV实现相机标定板

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

OpenCV相机标定板 OpenCV实现相机标定板

房东丢的猫   2021-04-16 我要评论
想了解OpenCV实现相机标定板的相关内容吗,房东丢的猫在本文为您仔细讲解OpenCV相机标定板的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:OpenCV,相机,标定板,下面大家一起来学习吧。

1.代码实现

#include <opencv.hpp>
#include "highgui.h"
#include "cxcore.h"

using namespace cv;

int main0(int argc, char *argv[])
{
    int width = 140;//width and heigth of single square
    int height = 140;
        IplImage *src = cvCreateImage(cvSize(width*(10+1),width*(6+1)), IPL_DEPTH_8U, 1);//in the CalibrationAndTest.cpp ,there is a param called boardsize(10,6), causing here:(10+1),(6+1)
        cvZero(src);
        for (int i = 0; i < src->height; i++)
        {
            for (int j = 0; j < src->width; j++)
            {
                if ((i / width + j / height) % 2 != 0)
                {
                    src->imageData[i*src->widthStep + j * src->nChannels] = 255;
                }
            }
        }

        //cvNamedWindow("src");
        cvShowImage("src", src);

        //cvSaveImage("ChessBoard.bmp", src, 0);
        cvWaitKey(0);

        return 0;
}

2.效果展示

3.使用说明

将该程序生成的图片使用A4纸铺满的方式打印出来,贴在一个刚体的板子上,即可用于相机标定。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们