Complete the code to import the Tesseract OCR library.
import [1]
The pytesseract library is the Python wrapper for Tesseract OCR.
Complete the code to read an image file for OCR processing.
from PIL import Image img = Image.open([1])
The Image.open() function requires the filename as a string, so it must be in quotes.
Fix the error in the code to extract text from the image using pytesseract.
text = pytesseract.[1](img)The correct function to extract text from an image in pytesseract is image_to_string.
Fill both blanks to convert the image to grayscale and then extract text.
gray_img = img.convert([1]) text = pytesseract.[2](gray_img)
image_to_data which returns detailed info, not plain text.Converting to grayscale uses mode 'L'. Then image_to_string extracts the text.
Fill all three blanks to configure Tesseract path, read image, and extract text.
import pytesseract pytesseract.pytesseract.tesseract_cmd = [1] from PIL import Image img = Image.open([2]) text = pytesseract.[3](img)
Set the Tesseract executable path correctly (Windows example). Open the image file as a string filename. Use image_to_string to extract text.