在畸变校正中需要用到图像中四个角点的坐标,当固定好硬件后,便可使用鼠标来调试软件的矫正参数。使摄像头实时播放图像,在播放界面选择要校正的图像点位
当选择点数等于4个时突出8校正功能,并保存校正参数。
实现的功能如下图:

源码如下:
int calibration_image(int camera_index) {
if (!camera_capture.isOpened()) {
if (camera_play(camera_index) != 0) {
return -1;
}
}
Mat cap_frame;
bool first_flag = true;
mark_position.clear();
//camera_capture.set(CAP_PROP_SETTINGS, 1);
while (1)
{
if (!first_flag) {
int property = getWindowProperty("usb camera", 0);
if (property == -1) {
destroyAllWindows();
return 0;
}
}
first_flag = false;
camera_capture >> cap_frame;
cam
本文介绍如何在畸变校正过程中利用USB摄像头实时获取图像的四个角点坐标。通过鼠标调试,当选择四个角点后,启用8点校正功能并保存校正参数。该实现能展示摄像头的实时图像并方便地进行点位选择。
订阅专栏 解锁全文
19

被折叠的 条评论
为什么被折叠?



