-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
minEnclosingCircle returns NaN #16051
Copy link
Copy link
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 3.4
- Operating System / Platform => Linux 64 Bit
- Compiler => x86_64-linux-gnu-g++-8
Detailed description
For particular contours, minEnclosingCircle sets center.x, center.y, and radius to NaN.
This is because for particular contours, findCircle3pts is called such that the det of v1 and v2 is 0, yielding a division by zero. I have included an example set of points in the repro steps.
Steps to reproduce
Here is a fairly minimal repro. You may need to tweak the headers/namespaces.
#include <iostream.h>
#include "include/opencv2/imgproc/imgproc.hpp"
int main(int argc, char **argv) {
std::vector<cv::Point> contour(
{cv::Point(2085, 1415), cv::Point(2087, 1415), cv::Point(2089, 1414),
cv::Point(2089, 1414), cv::Point(2087, 1412)});
std::vector<cv::Point> approx_quad;
cv::Point2f center;
float radius;
cv::minEnclosingCircle(contour, center, radius);
printf("center [%f, %f], radius %f\n", center.x, center.y, radius);
}
Reactions are currently unavailable