我可以将 FindChessboardCorners 函数用于小于 15 兆像素的图像,例如 2k x 1.5k.但是,当我在 DSLR 的图像上使用它时,分辨率为 3700x5300,它不起作用.
I can use FindChessboardCorners functions for images that less than 15 Mega pixel such like 2k x 1.5k. however when I use it on the image from DSLR, the resolution at 3700x5300, it doesn't work.
我尝试使用 resize() 直接缩小图像大小,然后它起作用了.
I tried to use resize() to reduce the image size directly, then it works.
显然,OpenCV 源代码中存在一些硬编码或错误.
Obviously there's some hard coded or bug in the OpenCV source code.
你能帮我弄清楚,或者告诉我一个补丁吗?
Could you help me to figure it out, or point me to a patch for this ?
我发现有人在 2006 年发布了类似的问题,这里,所以看起来问题仍然存在.
I found someone posted a similar issue in 2006, here, so it looks like the problem still remains.
我使用的代码就像
found = findChessboardCorners( viewGray, boardSize, ptvec,
CV_CALIB_CB_ADAPTIVE_THRESH + CV_CALIB_CB_FILTER_QUADS + CV_CALIB_CB_NORMALIZE_IMAGE + CV_CALIB_CB_FAST_CHECK);
更新
在这里澄清一下.我认为该算法适用于大图像分辨率,但是当棋盘占据图像的较大比例时它会失败.例如,当我在同一相机位置使用 50mm 固定镜头时,FindChessboardCorners 永远不会失败.我把它换成100mm固定镜头后,功能开始停止检测图案.我觉得跟比例或者焦距有关.
Just here to clarify. I think the algorithm works on large image resolution, but it fails when the chessboard occupy larger proportion of the image. For example, when I use a 50mm fixed lens on the same camera position, FindChessboardCorners never fails. After I change it to 100mm fixed lens, the function starts to stop detecting the pattern. I think it relates to the proportion or the focal length.
下图是 100mm 镜头的结果.
The image below is the 100mm lens result.
更新 2
我为大图像添加了一个锐化滤镜,它开始解决问题.
I added a sharpen filter to the large image, and it starts to fix the problem.
首先我使用
//do a sharpen filter for the large resolution image
if (viewGray.cols > 1500)
{
Mat temp ;
GaussianBlur(viewGray,temp, Size(0,0), 105) ; //hardcoded filter size, to be tested on 50 mm lens
addWeighted(viewGray, 1.8, temp, -0.8,0,viewGray) ; //hardcoded weight, to be tested.
//imwrite("test"+ imageList[k][i], viewGray) ;
}
found = findChessboardCorners( viewGray, boardSize, ptvec,
CV_CALIB_CB_ADAPTIVE_THRESH + CV_CALIB_CB_FILTER_QUADS + CV_CALIB_CB_NORMALIZE_IMAGE + CV_CALIB_CB_FAST_CHECK);
上传图片:
原始分辨率为 3744 x 5616 的 jpg 图片,如果本站强制转换,请确保您使用的分辨率正确.
A jpg image at original resolution 3744 x 5616, if this site force convert, then make sure you are using at the correct resolution.
几点.
这篇关于FindChessboardCorners 无法通过长焦距镜头检测非常大的图像上的棋盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!