The document contains a Python code to perform optical character recognition (OCR) on an image. The code uses MSER detection to identify regions of interest in the grayscale image and then uses the easyocr library to recognize text within those regions. The output from running the code on the sample image contains 4 text strings that were recognized.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
69 views3 pages
Computer Vision Assignment For Text Extraction
The document contains a Python code to perform optical character recognition (OCR) on an image. The code uses MSER detection to identify regions of interest in the grayscale image and then uses the easyocr library to recognize text within those regions. The output from running the code on the sample image contains 4 text strings that were recognized.
mser = cv2.MSER_create() regions,_= mser.detectRegions(gray) for region in regions: x, y, w, h = cv2.boundingRect(region) cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2_imshow(img)
#Perform OCR after MSER detection on image
reader=easyocr.Reader(['en','en']) results=reader.readtext(gray) for x in results: print(x[1])