Answer the question
In order to leave comments, you need to log in
How to recognize image on opencv?
Shalom everyone!
There is such a picture
How can I recognize which pixels are lit and which are not and output them in the format 010101
where
0 is off
1 is on
Matrix 96x64 pixels
Thank you all in advance!
Answer the question
In order to leave comments, you need to log in
- align and crop the area with the screen
- perform the cv2.threshold operation by selecting the parameters
- reduce the image to 96x64
Get a matrix where the lines will contain the desired, if you change 255 to 1
Prototype:
import cv2
IMAGE = # <path>
image = cv2.imread(IMAGE)
image = image[0:720, 100:1000]
grey = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
(thresh, grey) = cv2.threshold(grey, 70, 255, cv2.THRESH_BINARY)
res = cv2.resize(grey,(96, 64), interpolation = cv2.INTER_CUBIC)
for im in res:
out = ''.join(['1' if x else '0' for x in im])
print(out)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question