Questions
- Show with a binary image that morphological opening and closing are dual operations. (Hint: apply opening on an image foreground and closing on the image background with the same structuring element)
- Automatically crop an image using the convex hull of the object in it (the problem is taken from https://stackoverflow.com/questions/14211340/automatically-cropping-an-image-with-python-pil/51703287#51703287). Use the following image and crop the white background:
The desired output image is shown as follows—the bounding rectangle to crop the image is to be found automatically:
- Use the
maximum()
andminimum()
functions fromÂskimage.filters.rank
 to implement morphological opening and closing with a grayscale image.