I have objects that appear as white halos in a binary threshold matrix. I made this code to fill the halos white so I can have solid white circles in the matrix:
void processBinary(Mat& binaryMat) {
Mat clone;
binaryMat.copyTo(clone);
vector<vector<Point>> contours;
findContours(clone, contours, RETR_EXTERNAL, CHAIN_APPROX_SIMPLE);
if (!contours.empty()) {
drawContours(binaryMat, contours, 0, Scalar(255), CV_FILLED);
}
}
This works if I only have one object in the camera feed. However, with multiple of the same objects, it won't perform the filling on any object unless I remove all but one of the objects from the scene. How can I fix the code so that each object is filled to be a solid white circle?