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]](https://i.imgur.com/kjQqfYX.png)
Final Detected image:
![[Image: final.png]](https://imagehost.imageupload.net/2020/06/27/final.png)
Image Source:
![[Image: kjQqfYX.png]](https://i.imgur.com/kjQqfYX.png)
Final Detected image:
![[Image: final.png]](https://imagehost.imageupload.net/2020/06/27/final.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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 |