I've been messing around with cv2 and pytesseract last few days and everything was going well until about an hour ago when I kept getting this error
"[ WARN:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('hello.png'): can't open/read file: check file path/integrity"
I've tried uninstalling opencv but nothing tried declaring a variable with the path to the image then call that through imread() but still nothing. I'm losing my marbles here man
import cv2
import pytesseract as tess
tess.pytesseract.tesseract_cmd = r'C:\Users\blkcap\AppData\Local\Programs\Tesseract-OCR\tesseract'
import PIL as Image
img = cv2.imread('hello.png')
text = tess.image_to_string(img)
cv2.resize(img, (800,500))
cv2.imshow('results', img)
cv2.waitKey(0)
I have my image in vscode in same working folder so that's why it's being called as shown above
CodePudding user response:
Okay first and foremost thank you both. I figured it out just went into the path where my python.exe was and did the following python39\python.exe -m pip install opencv-python
CodePudding user response:
Try img = cv2.imread(r'hello.png') and see if it helps.

