1 | initial version |
Actually, the way you describe it, you have a single dimensioned array containing your data. Or am I wrong here? So, first, (I assume you use C++) make a Mat-header on top of your data-array:
uchar data[]; // let's assume that's your data array which is filled with your matrix elements
// btw.: why haven't you used a matrix in the first place?
cv::Mat1b mat(height, width, data); // make a matrix header on top of your data
Then run cv::findContours() (if you don't know how it works please have a look in the examples of OpenCV) to find the contours, then for each contour call:
Point2f center, float radius
// Comput minimum enclosing circle - now you have `center` and `radius`
cv::minEnclosingCircle(onecontour, center, radius );
cv::circle(your_output_img, center, radius, cv::Scalar(255,0,0) ); // draw circle in blue
Done.