我可以在哪个 c++ 类中找到 cv::findChessboardCorners()

in which c++ Class can I find cv::findChessboardCorners()

本文关键字:cv findChessboardCorners c++ 我可以      更新时间:2023-10-16

>有谁知道函数是否 OpenCV 中的cv::findChessboardCorners()是在 c++ 类中实现的,如果是,请问哪一个
谢谢

  #include <opencv2/calib3d/calib3d.hpp>  ( L170 )

我从信号处理堆栈交换中的此链接中找到了脚本的位置,该位置存在于文件calib3d/src/calibinit.cpp第424行。

CV_IMPL
int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
                             CvPoint2D32f* out_corners, int* out_corner_count,
                             int flags )

答案包括对函数中涉及的过程的描述:

  1. 使用 cvCheckChessboard 确定图像中是否有棋盘
  2. 转换为二进制 (B&W) 并扩张以将角分开
  3. 使用 icvGenerateQuads 查找正方形。

然后,代码似乎要经过一组检查来压缩这些 四边形到棋盘角,包括icvFindConnectedQuads, icvCleanFoundConnectedQuads去除多余的角落, icvCheckQuadGroup 和 icvCheckBoardMonotony。

所有这些函数都在同一个文件中实现,除了 cvCheckChessboard,位于calib3d/src/checkchessboard.cpp中。 根据您希望理解代码的程度,似乎有 许多调试行,如果 #define,则可以包含这些行 DEBUG_CHESSBOARD,这可能有助于您了解正在发生的事情。

源代码

可以在opencv存档中找到opencv/modules/calib3d/src/calibinit.cpp行219。快速浏览一下这里。

int cvFindChessboardCorners( const void* arr, CvSize pattern_size,
                             CvPoint2D32f* out_corners, int* out_corner_count,
                             int flags )
{
 ....
}