Added extra argument for BlobDetector in findCirclesGrid
This commit is contained in:
parent
9f29506d2c
commit
a685be3ea9
@ -44,6 +44,7 @@
|
|||||||
#define __OPENCV_CALIB3D_HPP__
|
#define __OPENCV_CALIB3D_HPP__
|
||||||
|
|
||||||
#include "opencv2/core/core.hpp"
|
#include "opencv2/core/core.hpp"
|
||||||
|
#include "opencv2/features2d/features2d.hpp"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -527,11 +528,12 @@ CV_EXPORTS_W void drawChessboardCorners( InputOutputArray image, Size patternSiz
|
|||||||
const InputArray& corners, bool patternWasFound );
|
const InputArray& corners, bool patternWasFound );
|
||||||
|
|
||||||
enum { CALIB_CB_SYMMETRIC_GRID = 1, CALIB_CB_ASYMMETRIC_GRID = 2,
|
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
|
//! finds circles' grid pattern of the specified size in the image
|
||||||
CV_EXPORTS_W bool findCirclesGrid( const InputArray& image, Size patternSize,
|
CV_EXPORTS bool findCirclesGrid( const InputArray& image, Size patternSize,
|
||||||
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID );
|
OutputArray centers, int flags=CALIB_CB_SYMMETRIC_GRID,
|
||||||
|
const Ptr<FeatureDetector> &blobDetector = new SimpleBlobDetector());
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -1927,7 +1927,7 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cv::findCirclesGrid( const InputArray& _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 isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID);
|
||||||
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID);
|
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID);
|
||||||
@ -1935,16 +1935,9 @@ bool cv::findCirclesGrid( const InputArray& _image, Size patternSize,
|
|||||||
|
|
||||||
Mat image = _image.getMat();
|
Mat image = _image.getMat();
|
||||||
vector<Point2f> centers;
|
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;
|
vector<KeyPoint> keypoints;
|
||||||
detector->detect(image, keypoints);
|
blobDetector->detect(image, keypoints);
|
||||||
vector<Point2f> points;
|
vector<Point2f> points;
|
||||||
for (size_t i = 0; i < keypoints.size(); i++)
|
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);
|
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.
|
//! initializes camera matrix from a few 3D points and the corresponding projections.
|
||||||
CV_WRAP static inline Mat initCameraMatrix2D( const vector<Mat>& objectPoints,
|
CV_WRAP static inline Mat initCameraMatrix2D( const vector<Mat>& objectPoints,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user