# How to clean edges of Mask using opencv

**URL:** <https://forum.opencv.org/t/how-to-clean-edges-of-mask-using-opencv/4548>\
**Category:** Python\
**Tags:** dnn, imgproc\
**Created:** [July 31, 2021, 10:35am UTC](https://forum.opencv.org/t/how-to-clean-edges-of-mask-using-opencv/4548 "2021-07-31T10:35:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neelam\_Jain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/neelam_jain/32/592_2.png) [@Neelam\_Jain](https://forum.opencv.org/u/Neelam_Jain)\
**Post date:** [July 31, 2021, 10:35am UTC](https://forum.opencv.org/t/how-to-clean-edges-of-mask-using-opencv/4548/1 "2021-07-31T10:35:36Z")

</div>

Hello, I have a image and i need to create mask for every person

1. I have used resnet50 to extract mask for every person in the original image
2. For every mask i create a image

However, the edges of the mask needs to be filtered with proper algorithm. Refer the attached mask image

![mask](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/1/18aec092b5b06ab15998110e320ee2d59b421d6b.jpeg)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 31, 2021, 11:42am UTC](https://forum.opencv.org/t/how-to-clean-edges-of-mask-using-opencv/4548/2 "2021-07-31T11:42:39Z")

</div>

welcome.

please do some research on this problem. then present your findings.
