How should I choose the shape of the structuring element for a morphological closing?
I am working on a Python script to identify objects in an image and place each on a transparent background.
My currently steps are
- Open image
- Apply bilateral filter to smooth textures
- Use Canny to find edges
- Apply a closing to fill gaps in the edges
- Find contours
- Use each contour to mask the image appropriately
Everything is working fairly well, but I had a question about the closing.
I am currently using a 5 by 5 square as the structuring element for closing. I am aware of the getStructuringElement method that allows for easy production of other shapes, but I don't understand why I would choose one shape over another. What shapes might I consider for my application, and why?