I am using python 2.7 with OpenCV and PIL Running on windows 10
I am trying to get an image written with cv2.imwrite()
like follow Code:
x={{"Some Process On an Image "}}
#now saving the effects on real image
cv2.imwrite("temp.png", x)
now I am trying to get the text from the same image with pytesseract
and need to open the image
with the PIL
library within another calss becuase the pytesseract
doesnt deal with cv2
images
from PIL import Image
import pytesseract
import cv2
if __name__ == '__main__':
url= Image.open("temp.png")
cv2.waitKey(200)
text=pytesseract.image_to_string(url)
print text
cv2.waitKey(0)
and Gave Me this Error:
Traceback (most recent call last):
File "C:\Users\Elie MA\Documents\NetBeansProjects\tesser\src\new_module.py", line 9, in <module>
text=pytesseract.image_to_string(url)
File "build\bdist.win32\egg\pytesseract\pytesseract.py", line 161, in image_to_string
File "build\bdist.win32\egg\pytesseract\pytesseract.py", line 94, in run_tesseract
File "c:\Python27\lib\subprocess.py", line 711, in __init__
errread, errwrite)
File "c:\Python27\lib\subprocess.py", line 948, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
why I cant get the image ? is there any access rights or something ? It can be showed with this Code:
url="temp.png"
cv2.imshow("temp_photo",url)
I want to know why PIL
cannot get the image ?
With the knowledge that this image can be opened with photo viewer also So Any one can Help Me?