diff --git a/Emgu.CV.Extern/calib3d/calib3d_c.cpp b/Emgu.CV.Extern/calib3d/calib3d_c.cpp index 07ae089e2..6088c5ccd 100644 --- a/Emgu.CV.Extern/calib3d/calib3d_c.cpp +++ b/Emgu.CV.Extern/calib3d/calib3d_c.cpp @@ -106,6 +106,11 @@ void cveCorrectMatches(cv::_InputArray* f, cv::_InputArray* points1, cv::_InputA cv::correctMatches(*f, *points1, *points2, *newPoints1, *newPoints2); } +bool cveFindChessboardCornersSB(cv::_InputArray* image, CvSize* patternSize, cv::_OutputArray* corners, int flags) +{ + return cv::findChessboardCornersSB(*image, *patternSize, *corners, flags); +} + void cveDrawChessboardCorners(cv::_InputOutputArray* image, CvSize* patternSize, cv::_InputArray* corners, bool patternWasFound) { cv::drawChessboardCorners(*image, *patternSize, *corners, patternWasFound); diff --git a/Emgu.CV.Extern/calib3d/calib3d_c.h b/Emgu.CV.Extern/calib3d/calib3d_c.h index e5dff4cd9..7a41bad1b 100644 --- a/Emgu.CV.Extern/calib3d/calib3d_c.h +++ b/Emgu.CV.Extern/calib3d/calib3d_c.h @@ -42,6 +42,8 @@ CVAPI(void) cveTriangulatePoints(cv::_InputArray* projMat1, cv::_InputArray* pro CVAPI(void) cveCorrectMatches(cv::_InputArray* f, cv::_InputArray* points1, cv::_InputArray* points2, cv::_OutputArray* newPoints1, cv::_OutputArray* newPoints2); +CVAPI(bool) cveFindChessboardCornersSB(cv::_InputArray* image, CvSize* patternSize, cv::_OutputArray* corners, int flags); + CVAPI(void) cveDrawChessboardCorners(cv::_InputOutputArray* image, CvSize* patternSize, cv::_InputArray* corners, bool patternWasFound); CVAPI(void) cveFilterSpeckles(cv::_InputOutputArray* img, double newVal, int maxSpeckleSize, double maxDiff, cv::_InputOutputArray* buf); diff --git a/Emgu.CV/PInvoke/CvEnum.cs b/Emgu.CV/PInvoke/CvEnum.cs index cea3de3ff..c1d5139d7 100644 --- a/Emgu.CV/PInvoke/CvEnum.cs +++ b/Emgu.CV/PInvoke/CvEnum.cs @@ -3554,6 +3554,14 @@ namespace Emgu.CV.CvEnum /// If it is on, then this check is performed before the main algorithm and if a chessboard is not found, the function returns 0 instead of wasting 0.3-1s on doing the full search. /// FastCheck = 8, + /// + /// Run an exhaustive search to improve detection rate. + /// + Exhaustive = 16, + /// + /// Up sample input image to improve sub-pixel accuracy due to aliasing effects. This should be used if an accurate camera calibration is required. + /// + Accuracy = 32 } /// diff --git a/Emgu.CV/PInvoke/CvInvokeCalib3d.cs b/Emgu.CV/PInvoke/CvInvokeCalib3d.cs index 632224371..d981b9e32 100644 --- a/Emgu.CV/PInvoke/CvInvokeCalib3d.cs +++ b/Emgu.CV/PInvoke/CvInvokeCalib3d.cs @@ -981,6 +981,26 @@ namespace Emgu.CV [DllImport(ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)] private static extern void cveFilterSpeckles(IntPtr img, double newVal, int maxSpeckleSize, double maxDiff, IntPtr buf); + /// + /// Finds the positions of internal corners of the chessboard using a sector based approach. + /// + /// Source chessboard view. It must be an 8-bit grayscale or color image. + /// Number of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ). + /// Output array of detected corners. + /// Various operation flags + /// True if chessboard corners found + public static bool FindChessboardCornersSB(IInputArray image, Size patternSize, IOutputArray corners, CvEnum.CalibCbType flags = CalibCbType.Default) + { + using (InputArray iaImage = image.GetInputArray()) + using (OutputArray oaCorners = corners.GetOutputArray()) + { + return cveFindChessboardCornersSB(iaImage, ref patternSize, oaCorners, flags); + } + } + [DllImport(ExternLibrary, CallingConvention = CvInvoke.CvCallingConvention)] + [return: MarshalAs(BoolMarshalType)] + private static extern bool cveFindChessboardCornersSB(IntPtr image, ref Size patternSize, IntPtr corners, CvEnum.CalibCbType flags); + /// /// Draws the individual chessboard corners detected (as red circles) in case if the board was not found (pattern_was_found=0) or the colored corners connected with lines when the board was found (pattern_was_found != 0). ///