这是我的代码。我正在尝试在赛车图像上应用OCR。
im = Image.open("runners_1.jpg") # the second one
im = im.filter(ImageFilter.MedianFilter())
enhancer = ImageEnhance.Contrast(im)
im = enhancer.enhance(2)
im = im.convert('1')
im.save('temp2.jpg')
text=pytesseract.image_to_string(Image.open('temp2.jpg','r'),config="--psm
8")
print(text)
并面临此错误
Traceback (most recent call last):
File "face_detection.py", line 27, in <module>
text = pytesseract.image_to_string(Image.open('temp2.jpg','r'),config="--psm
8")
File "C:\Users\salmankazmi\Anaconda3\lib\site-
packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "C:\Users\salmankazmi\Anaconda3\lib\site-
packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\salmankazmi\Anaconda3\lib\site-
packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "C:\Users\salmankazmi\Anaconda3\lib\subprocess.py", line 707, in
__init__
restore_signals, start_new_session)
File "C:\Users\salmankazmi\Anaconda3\lib\subprocess.py", line 990, in
_execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
第27行是对这个“image_to_string”函数的调用