# How to convert the pattern into a white binary image

**URL:** <https://forum.opencv.org/t/how-to-convert-the-pattern-into-a-white-binary-image/17769>\
**Category:** Python\
**Tags:** build\
**Created:** [May 28, 2024, 12:34pm UTC](https://forum.opencv.org/t/how-to-convert-the-pattern-into-a-white-binary-image/17769 "2024-05-28T12:34:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tiffic](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@tiffic](https://forum.opencv.org/u/tiffic)\
**Post date:** [May 28, 2024, 12:34pm UTC](https://forum.opencv.org/t/how-to-convert-the-pattern-into-a-white-binary-image/17769/1 "2024-05-28T12:34:10Z")

</div>

How can I filter the pattern in the middle of the image to the white binary image. There’s always some noise in my filter\*emphasized text  
This is my code  
img = cv.imread(‘phot/saidao6.jpg’)  
gray\_img = cv.cvtColor(img, cv.COLOR\_BGR2GRAY)  
resize\_img = cv.resize(gray\_img, dsize=(500, 400))  
kernel = np.ones((15, 15), np.uint8)  
opening = cv.morphologyEx(resize\_img, cv.MORPH\_CLOSE, kernel)  
r, b = cv.threshold(opening, 75, 255, cv.THRESH\_BINARY)

 ![saidao6](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/6/643ccb1ee5d8f41d6dd055ae34fb0078935bcf3b.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:** [June 12, 2024, 1:52pm UTC](https://forum.opencv.org/t/how-to-convert-the-pattern-into-a-white-binary-image/17769/3 "2024-06-12T13:52:21Z")

</div>

> [@tiffic](#):
>
> pattern in the middle of the image

what exactly do you need? it’s some kind of camo pattern.

you seem to want a mask/binarization. can you mock up such a mask in a photo editor?

if you really need the entire camo print area, that’ll be “texture analysis”.

it will certainly not be solved as easily as the previous post suggests.
