OpenCV實現(xiàn)相機標定板
更新時間:2021年04月16日 11:42:16 作者:房東丟的貓
這篇文章主要為大家詳細介紹了OpenCV實現(xiàn)相機標定板,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文實例為大家分享了OpenCV實現(xiàn)相機標定板的具體代碼,供大家參考,具體內(nèi)容如下
1.代碼實現(xiàn)
#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紙鋪滿的方式打印出來,貼在一個剛體的板子上,即可用于相機標定。
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
相關文章
C++ 數(shù)據(jù)類型強制轉化的實現(xiàn)
這篇文章主要介紹了C++ 數(shù)據(jù)類型強制轉化的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2021-02-02

