Added extra argument for BlobDetector in findCirclesGrid

pull/13383/head
Ilya Lysenkov 14 years ago
parent 9f29506d2c
commit a685be3ea9
  1. 8
      modules/calib3d/include/opencv2/calib3d/calib3d.hpp
  2. 13
      modules/calib3d/src/calibinit.cpp
  3. 8
      modules/python/src2/opencv_extra_api.hpp

@ -44,6 +44,7 @@
#define __OPENCV_CALIB3D_HPP__
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#ifdef __cplusplus
extern "C" {
@ -527,11 +528,12 @@ CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSiz
const InputArray& corners, bool patternWasFound );
enum { CALIB_CB_SYMMETRIC_GRID = 1, CALIB_CB_ASYMMETRIC_GRID = 2,
CALIB_CB_CLUSTERING = 4, CALIB_CB_WHITE_CIRCLES = 8 };
CALIB_CB_CLUSTERING = 4 };
//! finds circles' grid pattern of the specified size in the image
CV_EXPORTS_W bool findCirclesGrid( const InputArray& image, Size patternSize,
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID );
CV_EXPORTS bool findCirclesGrid( const InputArray& image, Size patternSize,
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID,
const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector());
enum
{

@ -1927,7 +1927,7 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize,
}
bool cv::findCirclesGrid( const InputArray& _image, Size patternSize,
OutputArray _centers, int flags )
OutputArray _centers, int flags, const Ptr<FeatureDetector> &blobDetector )
{
bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID);
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID);
@ -1935,16 +1935,9 @@ bool cv::findCirclesGrid( const InputArray& _image, Size patternSize,
Mat image = _image.getMat();
vector<Point2f> centers;
SimpleBlobDetector::Params params;
if(flags & CALIB_CB_WHITE_CIRCLES)
{
params.filterByColor = true;
params.blobColor = 255;
}
Ptr<SimpleBlobDetector> detector = new SimpleBlobDetector(params);
//Ptr<FeatureDetector> detector = new MserFeatureDetector();
vector<KeyPoint> keypoints;
detector->detect(image, keypoints);
blobDetector->detect(image, keypoints);
vector<Point2f> points;
for (size_t i = 0; i < keypoints.size(); i++)
{

@ -406,6 +406,14 @@ CV_WRAP static inline void convertPointsHomogeneous( const Mat& src, CV_OUT Mat&
cvConvertPointsHomogeneous(&_src, &_dst);
}
//! finds circles' grid pattern of the specified size in the image
CV_WRAP static inline void findCirclesGridDefault( const InputArray& image, Size patternSize,
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID )
{
findCirclesGrid(image, patternSize, centers, flags);
}
/*
//! initializes camera matrix from a few 3D points and the corresponding projections.
CV_WRAP static inline Mat initCameraMatrix2D( const vector<Mat>& objectPoints,

Loading…
Cancel
Save