tesseract

Reading Text from Rubber product

Reading Text from Rubber product

Hi, I am trying to read the characters from the image, which has characters with black color in the background. Attaching the code which i used to extract, currently its giving the partial output. Can you help me to guide how to make it accurate? import pytesseractfrom PIL import Imagepytesseract.pytesseract.tesseract_cmd = 'C:UsersM562765AppDataLocalProgramsTesseract-OCRtesseract.exe' image_paths = ['C:/Users/M562765/Downloads/Unable-images/Unable/crop1.jpg'] def extract_text_from_image(image_path):# Open the imageimg = Image.open(image_path) # Use pytesseract to perform OCRextracted_text = pytesseract.image_to_string(img, config='--psm 6') # PSM 6 assumes a block of textreturn extracted_text.strip() Enter fullscreen mode Exit fullscreen mode for img_path in image_paths:text = extract_text_from_image(img_path)print(f"Text extracted from {img_path}: {text}") Source link lol
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.