OpenCV Android – How to draw a circle/rectangle around an outline?… here is a solution to the problem.
OpenCV Android – How to draw a circle/rectangle around an outline?
I’m new to openCV and I’m having some issues as a result.
One question is how to get the coordinates of a contour to draw a circle around it.
So far, my code looks like this:
List<MatOfPoint> contours = mDetector.getContours(); Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR, -1); <<code that I need>> Core.circle(mRgba, new Point(150.0,150.0), 100, CONTOUR_COLOR, 5);
The outline is “extracted” and drawn on the surface of the test circle, but how do I get the coordinates (boundary) from the profile to draw a circle around each profile.
I believe boundingRect and minEnclosingCircle also works on Android. These features do exactly what you want. You can find a very good tutorial to do this, here .