Issue
I want to have a function that outputs the image so I can compare it with the other images, it is also supposed to output the text which is in the picture
But i get this Error TypeError: Expected Ptr<cv::UMat> for argument 'src'
Here is my Code
def rec_screen(x1,y1,x2,y2):
printscreen = np.array(ImageGrab.grab(bbox=(x1, y1, x2, y2)))
printscreen = cv2.cvtColor(printscreen, cv2.COLOR_BGR2RGB)
cv2.imshow('window', printscreen)
if (cv2.waitKey(25) & 0xFF == ord('q')):
print("1")
return ([printscreen,(tess.image_to_string(printscreen))])
def crawler():
print(rec_screen(889, 259, 917, 247)[1])
I've tried this didnt work
gray = (np.float32(imgUMat), cv2.COLOR_RGB2GRAY)
Solution
Your image is 28x0 and that's why you get an error on cv2.imshow('window', printscreen)
This is because you are passing the coordinates wrong, try:
def crawler():
print(rec_screen(889, 247, 917, 259)[1])
(y2
should be bigger than y1
)
Answered By - K41F4r
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.