本文介绍了在opencv中为任何随机ChessBoard查找CheckerBoard点(图案大小未知)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,OpenCv在C ++中带有其功能findCheckerboardCorners()

Well, OpenCv comes with its function findCheckerboardCorners() in C++ which goes like

bool findChessboardCorners(InputArray image, Size patternSize,
OutputArray corners,
int flags=CALIB_CB_ADAPTIVE_THRESH+CALIB_CB_NORMALIZE_IMAGE )

使用此功能一段时间后,我了解的一件事是图案大小必须在很大程度上符合图像,否则该算法将拒绝完全检测任何Chessboard.我想知道是否有棋盘的随机图像,此功能将失败,因为输入patternSize的精确值是不切实际的.有没有办法,可以从提供的图像中获得此功能的patternSize.任何帮助,将不胜感激.谢谢.

After using this function for a while, one thing that i understood was that the pattern size must comply with the image to a very good extent, else the algorithm refuses to detect any Chessboard altogether. I was wondering if there were any random image of a chessboard, this function would fail as it is impractical to enter the precise values of the patternSize. Is there a way, the patternSize for this function could be obtained from the image provided. Any help would be appreciated. Thanks.

推荐答案

简短的回答:不能.

OpenCV棋盘检测代码假定图案是均匀的(所有正方形具有相同的大小),因此,为了唯一地定位其在图像中的位置,必须满足以下两个条件:

The OpenCV checkerboard detection code assumes that the pattern is uniform (all squares have the same size) and therefore, in order to uniquely locate its position in the image, the following two conditions must be true:

  1. 该图案完全可见.
  2. 该模式具有已知的行数和列数.

如果违反了1或2,则无法知道哪个角是左上角".

If either 1 or 2 is violated there is no way to know which corner is, say, the "top left" one.

对于更一般的情况,尤其是如果您预期图案可能会被部分遮挡,则必须使用其他算法和非均匀图案,这样才能唯一地识别拐角.

For a more general case, and in particular if you anticipate that the pattern may be partially occluded, you must use a different algorithm and a non-uniform pattern, upon which corners can be uniquely identified.

有多种方法可以做到这一点.我最喜欢的模式是Matsunaga和Kanatani的"2D条码",它使用具有独特交叉比例的正方形长度序列.请参见论文此处.为了匹配它,将角点分类到网格中后,您可以使用简单的多数投票算法:

There are various way to do that. My favorite pattern is Matsunaga and Kanatani's "2D barcode" one, which uses sequences of square lengths with unique crossratios. See the paper here. In order to match it, once you have sorted the corners into a grid, you can use a simple majority voting algorithm:

08-28 21:23