filterByInertia = true;
//minInertiaRatio = 0.6;
- minInertiaRatio = 0.1;
+ minInertiaRatio = 0.1f;
filterByConvexity = true;
//minConvexity = 0.8;
- minConvexity = 0.95;
+ minConvexity = 0.95f;
filterByCircularity = false;
- minCircularity = 0.8;
+ minCircularity = 0.8f;
}
BlobDetector::BlobDetector(const BlobDetectorParameters ¶meters) :
if (params.filterByColor)
{
- if (binaryImage.at<uchar> (center.location.y, center.location.x) == 255)
+ if (binaryImage.at<uchar> (cvRound(center.location.y), cvRound(center.location.x)) == 255)
continue;
}
}
bool findCirclesGrid( const Mat& image, Size patternSize,
- vector<Point2f>& centers, int flags )
+ vector<Point2f>& centers, int )
{
Ptr<BlobDetector> detector = new BlobDetector();
//Ptr<FeatureDetector> detector = new MserFeatureDetector();
detector->detect(image, keypoints);
CirclesGridFinderParameters parameters;
- parameters.vertexPenalty = -0.6;
+ parameters.vertexPenalty = -0.6f;
parameters.vertexGain = 1;
parameters.existingVertexGain = 10000;
parameters.edgeGain = 1;
- parameters.edgePenalty = -0.6;
+ parameters.edgePenalty = -0.6f;
const int attempts = 2;
const int minHomographyPoints = 4;
{
isFound = boxFinder.findHoles();
}
- catch (cv::Exception &e)
+ catch (cv::Exception)
{
}
densityNeighborhoodSize = Size2f(16, 16);
minDistanceToAddKeypoint = 20;
kmeansAttempts = 100;
- convexHullFactor = 1.1;
+ convexHullFactor = 1.1f;
keypointScale = 1;
minGraphConfidence = 9;
assert( !centers.empty() );
const float edgeLength = 30;
const Point2f offset(150, 150);
- const int keypointScale = 1;
vector<Point2f> dstPoints;
for (int i = 0; i < detectedGridSize.height; i++)
int CirclesGridFinder::findNearestKeypoint(Point2f pt) const
{
int bestIdx = -1;
- float minDist = std::numeric_limits<float>::max();
+ double minDist = std::numeric_limits<double>::max();
for (size_t i = 0; i < keypoints.size(); i++)
{
- float dist = norm(pt - keypoints[i]);
+ double dist = norm(pt - keypoints[i]);
if (dist < minDist)
{
minDist = dist;
continue;
Point2f vec = keypoints[i] - keypoints[j];
- float dist = norm(vec);
+ double dist = norm(vec);
bool isNeighbors = true;
for (size_t k = 0; k < keypoints.size(); k++)
if (k == i || k == j)
continue;
- float dist1 = norm(keypoints[i] - keypoints[k]);
- float dist2 = norm(keypoints[j] - keypoints[k]);
+ double dist1 = norm(keypoints[i] - keypoints[k]);
+ double dist2 = norm(keypoints[j] - keypoints[k]);
if (dist1 < dist && dist2 < dist)
{
isNeighbors = false;
}
if (longestPaths.empty() || (maxVal == longestPaths[0].length && graphIdx == bestGraphIdx))
{
- Path path = Path(maxLoc.x, maxLoc.y, maxVal);
+ Path path = Path(maxLoc.x, maxLoc.y, cvRound(maxVal));
computeShortestPath(predecessorMatrix, maxLoc.x, maxLoc.y, path.vertices);
longestPaths.push_back(path);