File size: 234 Bytes
2e7bee0
 
 
 
 
afc860e
 
2e7bee0
1
2
3
4
5
6
7
8
9
import pytesseract
import cv2

def extract_text_from_id(image_path):
    image = cv2.imread(image_path)
    if image is None:
        raise ValueError(f"Invalid image file: {image_path}")
    return pytesseract.image_to_string(image)