提交 2c2d7d7b 编写于 作者: I Ilya Lysenkov

Fixed findCirclesGrid for the case of working with 'square' asymmetric patterns.

上级 d60349b1
......@@ -1939,8 +1939,8 @@ void cv::drawChessboardCorners( InputOutputArray _image, Size patternSize,
bool cv::findCirclesGrid( InputArray _image, Size patternSize,
OutputArray _centers, int flags, const Ptr<FeatureDetector> &blobDetector )
{
bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID) ? true : false;
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID ) ? true : false;
bool isAsymmetricGrid = (flags & CALIB_CB_ASYMMETRIC_GRID) ? true : false;
bool isSymmetricGrid = (flags & CALIB_CB_SYMMETRIC_GRID ) ? true : false;
CV_Assert(isAsymmetricGrid ^ isSymmetricGrid);
Mat image = _image.getMat();
......
......@@ -748,7 +748,13 @@ Mat CirclesGridFinder::rectifyGrid(Size detectedGridSize, const vector<Point2f>&
const Point2f offset(150, 150);
vector<Point2f> dstPoints;
for (int i = 0; i < detectedGridSize.height; i++)
bool isClockwiseBefore =
getDirection(centers[0], centers[detectedGridSize.width - 1], centers[centers.size() - 1]) < 0;
int iStart = isClockwiseBefore ? 0 : detectedGridSize.height - 1;
int iEnd = isClockwiseBefore ? detectedGridSize.height : -1;
int iStep = isClockwiseBefore ? 1 : -1;
for (int i = iStart; i != iEnd; i += iStep)
{
for (int j = 0; j < detectedGridSize.width; j++)
{
......@@ -1453,6 +1459,10 @@ void CirclesGridFinder::getCornerSegments(const vector<vector<size_t> > &points,
cout << "Corners are counterclockwise" << endl;
#endif
std::reverse(segments.begin(), segments.end());
std::reverse(cornerIndices.begin(), cornerIndices.end());
std::reverse(firstSteps.begin(), firstSteps.end());
std::reverse(secondSteps.begin(), secondSteps.end());
std::swap(firstSteps, secondSteps);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册