Ask Your Question

Revision history [back]

  1. A morphological open with a small kernel to remove all small speckles

  2. Find the largest closed contour and fit a convex hull around it.

  3. Fill the convex hull with white, while the background is black

  4. Use the binary mask from step 3 and copy the contents of the original image onto an all white image using the binary mask as reference.
    Original_Image.copyTo(All_White_Image,Binary_Mask)