I'm trying to do a mask in cell image just with the ROI, so I applied the contours with OpenCV around the ROI but I've been struggling to get the region inside the contours. I want to have this region inside white and then discard the contours and the rest outside.
cell = cv.imread(original, 0) # original cell image after matching template
imgray = cv.cvtColor(cell,cv.COLOR_BGR2GRAY)
ret,thresh_binary = cv.threshold(imgray,127,255,cv.THRESH_BINARY)
the resulting image is:
And the original is:
from another image after match template and the already marked cell contours, the image that is read in the code:
So basically what I need is to have white in that closed contour region and discard all the rest (i.e. black). Could someone give me some help or hint about how do I do this?