import cv2 import pytesseract img = cv2.imread('image.jpg') # Adding custom options custom_config = r'--oem 3 --psm 6' pytesseract.image_to_string(img, config=custom_config)
Here is what the above code is Doing:
1. We are reading the image using cv2.imread()
2. We are adding custom configuration using custom_config variable
3. We are passing the image and the custom configuration to pytesseract.image_to_string()