I am working on ocr via OpenCV and I have a colorful keypad in the first image.
As we know I need a BW version of that image and tried to convert it many ways. I can convert to exact BW with photoshop:
And here is the question: How can I do that with OpenCV or a similar library in python?
PS: I prepared a tool for the test but not enough :(
import cv2
originalImage = cv2.imread(r'C:\Users\Downloads\Image.jpg')
# note that cv uses BGR, so you have to change it.
grayImage = cv2.cvtColor(originalImage, cv2.COLOR_BGR2GRAY)
(thresh, blackAndWhiteImage) = cv2.threshold(grayImage, 127, 255, cv2.THRESH_BINARY)
cv2.imshow('Black white image', blackAndWhiteImage)
cv2.imshow('Original image', originalImage)
cv2.imshow('Gray image', grayImage)
cv2.waitKey(0)
cv2.destroyAllWindows()
https://techtutorialsx.com/2019/04/13/python-opencv-converting-image-to-black-and-white/