# Thresholding images

**URL:** <https://forum.opencv.org/t/thresholding-images/3794>\
**Category:** Python\
**Created:** [June 11, 2021, 4:01pm UTC](https://forum.opencv.org/t/thresholding-images/3794 "2021-06-11T16:01:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mike/32/4250_2.png) [@mike](https://forum.opencv.org/u/mike)\
**Post date:** [June 11, 2021, 4:01pm UTC](https://forum.opencv.org/t/thresholding-images/3794/1 "2021-06-11T16:01:14Z")

</div>

Hey! Thresholding doesn’t work in the following code. It just returns the initial image:

```auto
import cv2 as cv
img = cv.imread(#my image)
img = cv.cvtColor(img, cv.COLOR_BGR2RGB)
ret, image = cv.threshold(img, 127, 255, cv.THRESH_BINARY)
cv.imshow(image)

```

---

<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 11, 2021, 5:04pm UTC](https://forum.opencv.org/t/thresholding-images/3794/2 "2021-06-11T17:04:08Z")

</div>

please provide code that can run. that requires proper arguments to `imshow` and a call to `waitKey`

the code, with obvious fixes, should exactly result in a binary image being shown

I think you were a little too pseudo with your pseudo code, and you might have mixed up variable names
