Python Forum
PyOCR cannot detect clearly?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyOCR cannot detect clearly?
#1
As you can see in the down below captures, the image cannot be nicely detected to the final result, could anyone tell me how to have a better recognition by using PyOCR ?

Image Source:
[Image: kjQqfYX.png]

Final Detected image:
[Image: final.png]

def codeocr():
    #My Code
    img=cv2.imread('/Users/Woodylin/Desktop/Python Learnings/Bank_Fubon_Mort_Scrapping/img_source.png')
    dst=cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)
    ret,thresh=cv2.threshold(dst,127,255,cv2.THRESH_BINARY_INV) 
  
 

   
    cv2.imwrite("/Users/Woodylin/Desktop/Python Learnings/Bank_Fubon_Mort_Scrapping/final.png",thresh)

    from PIL import Image
    import sys
    import pyocr
    import pyocr.builders

    tools = pyocr.get_available_tools()
    if len(tools) == 0:
        print("No OCR tool found")
        sys.exit(1)
    tool = tools[0]

    result = tool.image_to_string(
        Image.open('/Users/Woodylin/Desktop/Python Learnings/Bank_Fubon_Mort_Scrapping/final.png'),
        builder=pyocr.builders.TextBuilder()
    )

    return result
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020