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

查看:608
本文介绍了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.

我发现有人在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. 出于同样的原因,锐化也有帮助。然而,它也违背准确性,因为它增加了角的子像素位置的偏差 - 即使在没有噪声的理想情况下。为了说服自己这样的情况,考虑1D模拟:一个角落周围的图像的强度(在1D中,一个尖锐的黑白转换)看起来像一个S形曲线(一个具有光滑角的斜坡),并且你想要以找到其拐点的位置。锐化使曲线更陡,这通常会移动该点的位置。在考虑到锐化通常会放大噪声时,情况会变得更糟。

  3. 可能正确的方法是以较低的分辨率开始(即缩小),然后放大因此找到的角落,并将它们用作以完全分辨率运行cvFindCornersSubpix的初始估计。

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

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