Morphology transformation to achieve rectangular shape.

asked 2018-06-23 07:43:48 -0500

Heniek45 gravatar image


I wonder: is it possible to modify this input image:

image description

to obtain this output image:

image description

using only morphology transformation? I know, I can use contour detection, make rectangle out of this contour and then paint it over the image but I don't want to analyse contours. I would like to somehow dilate the image so the rectanle would close itself but it would retain holes in it at the same time. It does not have to be perfect, holes can be smaller but I need to have these holes inside.

I've tried a lot of erode /dilate operations with custom kernals but failed to achieve desired result. Could somone help? Thank you.

edit retag flag offensive close merge delete


i don't think, it's possible. but you must have had some steps before that, can we see those ?

berak gravatar imageberak ( 2018-06-24 02:10:20 -0500 )edit