# Simple segmentation of objects in binary image with some parts connected

**URL:** <https://forum.opencv.org/t/simple-segmentation-of-objects-in-binary-image-with-some-parts-connected/9644>\
**Category:** Python\
**Tags:** imgproc\
**Created:** [July 27, 2022, 1:19am UTC](https://forum.opencv.org/t/simple-segmentation-of-objects-in-binary-image-with-some-parts-connected/9644 "2022-07-27T01:19:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhy149](https://avatars.discourse-cdn.com/v4/letter/z/7c8e57/32.png) [@zhy149](https://forum.opencv.org/u/zhy149)\
**Post date:** [July 27, 2022, 1:19am UTC](https://forum.opencv.org/t/simple-segmentation-of-objects-in-binary-image-with-some-parts-connected/9644/1 "2022-07-27T01:19:07Z")

</div>

![segment](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/7/7a9debc113fd41ad2040132b264aa352d543fe17.png)

Hello,

I want to segment the binary image like the example above, but there are some times connection between different squares which result in a connected big contour which is not something I want. I tried erode the original image so that they are not connected anymore, but I’m having some trouble in my application now so I don’t want to erode the original image or the object anymore. Is there any simple way that I can make this work?  
Thank you!
