如上图:
//10*7的棋盘格:每行有10个角点,每列有7个角点
//每个棋盘格定为:30*30个像素,图像大小为330*240
//10*7的棋盘格:每行有10个角点,每列有7个角点
//每个棋盘格定为:30*30个像素,图像大小为330*240
void createCheckerBoard()
{
cv::Mat frame = cv::Mat::zeros(240, 330, CV_8UC1);
int nc = frame.channels();
int nWidthOfROI = 30;
for (int j = 0; j<frame.rows; j++)
{
uchar* data = frame.ptr<uchar>(j);
for (int i = 0; i<frame.cols*nc; i += nc)
{
if ((i / nc / nWidthOfROI + j / nWidthOfROI) % 2)
{
// bgr
data[i / nc*nc + 0] = 255;
//data[i / nc*nc + 1] = 255;
//data[i / nc*nc + 2] = 255;
}
}
}
imwrite("xx_base.jpg", frame);
return;
}