Browse Source

Added CvInvoke.FindChessboardCornersSB.

pull/84/merge
Canming Huang 7 years ago
parent
commit
fcb9854fd5
  1. 5
      Emgu.CV.Extern/calib3d/calib3d_c.cpp
  2. 2
      Emgu.CV.Extern/calib3d/calib3d_c.h
  3. 8
      Emgu.CV/PInvoke/CvEnum.cs
  4. 20
      Emgu.CV/PInvoke/CvInvokeCalib3d.cs

5
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);

2
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);

8
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.
/// </summary>
FastCheck = 8,
/// <summary>
/// Run an exhaustive search to improve detection rate.
/// </summary>
Exhaustive = 16,
/// <summary>
/// Up sample input image to improve sub-pixel accuracy due to aliasing effects. This should be used if an accurate camera calibration is required.
/// </summary>
Accuracy = 32
}
/// <summary>

20
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);
/// <summary>
/// Finds the positions of internal corners of the chessboard using a sector based approach.
/// </summary>
/// <param name="image">Source chessboard view. It must be an 8-bit grayscale or color image.</param>
/// <param name="patternSize">Number of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_colum) = cv::Size(columns,rows) ).</param>
/// <param name="corners">Output array of detected corners.</param>
/// <param name="flags">Various operation flags</param>
/// <returns>True if chessboard corners found</returns>
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);
/// <summary>
/// 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).
/// </summary>

Loading…
Cancel
Save