FindChessboardCorners 无法通过长焦距镜头检测非常大的图像上的棋盘 [英] FindChessboardCorners cannot detect chessboard on very large images by long focal length lens

查看:46
本文介绍了FindChessboardCorners 无法通过长焦距镜头检测非常大的图像上的棋盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将 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.

推荐答案

几点.

  1. 如您所见,缩小尺寸有助于检测器.这是因为 OpenCV 中用于查找角点的角点检测过滤器具有固定大小,并且卷积掩码的大小可能太小而无法检测到您的角点 - 全尺寸图像在该比例下实际上可能看起来平滑",特别是稍微模糊的地方.但是,通过缩小比例,您会舍弃一些角落位置的准确性.
  2. 出于同样的原因,锐化也有帮助.然而,它也违背了准确性,因为它会增加角落的子像素位置的偏差 - 即使在没有噪声的理想情况下也是如此.为了让自己相信是这种情况,请考虑一维模拟:拐角周围的图像强度(一维中,清晰的黑白过渡)看起来像一条 S 形曲线(具有平滑拐角的斜坡),并且您想要找到其拐点的位置.锐化使曲线更陡峭,这通常会移动该点的位置.考虑到锐化通常会放大噪音,情况会变得更糟.
  3. 可能的正确处理方法是从较低的分辨率开始(即缩小尺寸),然后放大由此找到的角的位置,并将它们用作以全分辨率运行 cvFindCornersSubpix 的初始估计值.

这篇关于FindChessboardCorners 无法通过长焦距镜头检测非常大的图像上的棋盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆