提交 a685be3e 编写于 作者: I Ilya Lysenkov

Added extra argument for BlobDetector in findCirclesGrid

上级 9f29506d
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册