opencv棋盘格照片
时间: 2023-10-15 16:02:57 浏览: 108
opencv棋盘格照片是用于相机标定的一种图案,可以通过OpenCV库或MATLAB创建。棋盘格有两种形状可供选择,分别是7*10方形和16*16正方形。创建棋盘格照片的代码示例如下:
```cpp
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) {
data[i / nc * nc + 0 = 255;
data[i / nc * nc + 1 = 255;
data[i / nc * nc + 2 = 255;
}
}
}
imwrite("xx_base.jpg", frame);
```
以上代码会生成一张名为"xx_base.jpg"的棋盘格照片,其尺寸为330*240像素。该照片中的棋盘格由每个格子大小为30*30像素组成,每行有10个角点,每列有7个角点。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [OpenCV相机标定棋盘格](https://download.csdn.net/download/weixin_40753822/13211021)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [opencv 制作棋盘格图](https://blog.csdn.net/zfjBIT/article/details/90898121)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文