MATLAB: How to extract a region of white pixel bounded by black pixel from white background

extraction of white pixel bounded by black pixelImage Processing Toolboxregion of interst detection

Best Answer

It looks like a binary image. If it is, call imclearborder
binaryImage = imclearborder(binaryImage);
This will get rid of all white/1/true regions touching the edge of the image.