MATLAB: Find Edge Continuity in Image

edgediscontinuityImage Processing Toolboximagecleaningnonuniformillumination

I have captured a fast moving event with non-uniform background illumination, shown below. As a result, the background subtraction and its subsequent thresholding (together with localcontrast and imclearborder functions) gave me a discontinuity in the pixel values (I am just interested in the outer border and use imfill to paint the inner region later). That in return affected the accuracy of the edge detection.
Therefore, I have been using those morphological operators (imopen, imclose. imdilate, imerode, bwareaopen) to correct the image prior to performing the edge detection but that has been profoundly influenced by the 'unwanted' pixels around the image (circled as red). If these 'spots' can be masked to be 0 in their pixel value, I presume the morphological operations will just be fine with what I need to proceed.
I am wondering if anyone here has a quick-fix to resolve the issue I have?
I thank you in advance,
Ahmad
ThresholdedImage.GIF

Best Answer

I'd try imclose() to connect blobs. Then use bwareafilt() to throw out small blobs.
Related Question