Implemented new algorithm for asymmetric circles pattern detection. Use flag CALIB_CB_CLUSTERING.

This commit is contained in:
Ilya Lysenkov
2011-04-15 15:33:11 +00:00
parent 2c8af20bd0
commit 37cd2b6f25
4 changed files with 290 additions and 2 deletions

View File

@@ -1937,7 +1937,13 @@ void drawChessboardCorners( Mat& image, Size patternSize,
bool findCirclesGrid( const Mat& image, Size patternSize,
vector<Point2f>& centers, int flags )
{
Ptr<SimpleBlobDetector> detector = new SimpleBlobDetector();
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);
@@ -1947,6 +1953,13 @@ bool findCirclesGrid( const Mat& image, Size patternSize,
points.push_back (keypoints[i].pt);
}
if((flags & CALIB_CB_CLUSTERING) && (flags & CALIB_CB_ASYMMETRIC_GRID))
{
CirclesGridClusterFinder circlesGridClusterFinder;
circlesGridClusterFinder.findGrid(points, patternSize, centers);
return !centers.empty();
}
CirclesGridFinderParameters parameters;
parameters.vertexPenalty = -0.6f;
parameters.vertexGain = 1;