Answers for "pip install pytesseract-ocr"

5

pytesseract tesseract is not installed

#1. Install tesseract using windows installer available at: https://github.com/UB-Mannheim/tesseract/wiki

#2. Note the tesseract path from the installation.Default installation path at the time the time of this edit was: C:UsersUSERAppDataLocalTesseract-OCR. It may change so please check the installation path.

#3. pip install pytesseract

#4. Set the tesseract path in the script before calling image_to_string:

pytesseract.pytesseract.tesseract_cmd = r'C:UsersUSERAppDataLocalTesseract-OCRtesseract.exe'
Posted by: Guest on June-21-2020
0

image processing for OCR using python

1| # importing modules
2| import cv2
3| import pytesseract
5| # reading image using opencv
6| image = cv2.imread(sample_image.png’)
7| #converting image into gray scale image
8| gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
9| # converting it to binary image by Thresholding
10| # this step is require if you have colored image because if you skip this part 
11| # then tesseract won't able to detect text correctly and this will give incorrect result
11|threshold_img = cv2.threshold(gray_image, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
12| # display image
13| cv2.imshow(‘threshold image’, threshold_img)
14| # Maintain output window until user presses a key
15| cv2.waitKey(0)
16| # Destroying present windows on screen
17| cv2.destroyAllWindows()
Posted by: Guest on September-22-2020

Python Answers by Framework

Browse Popular Code Answers by Language