How to enlarge object area on mask

Question:

I am working on a computer vision project and I need to extract the object from the image with preprocessing so I can eliminate noise and redundant parts in the image.

What I am trying to do is multiplying image by a mask that is thresholded image so except field of the object, other pixels will equalize to 0.

To do that I determine a threshold value. And I get below mask
enter image description here

After that I decrease the resolution and increase it.

enter image description here

enter image description here

At the end I want to smooth the edges of the last mask so I can be sure to get the whole object. Is there a method for this?

Green surrounded area in the below image represent the shape of field I ask.
(Background image is a combination of first and third images.)

enter image description here

Asked By: Alican Kartal

||

Answers:

You could look into the dilation operation:
https://docs.opencv.org/3.4/db/df6/tutorial_erosion_dilatation.html

You’ll need to fine tune the iterations and the size of the dilation to get a closer result to what you want.

Answered By: Emmanuel Madrigal