Paste the code First:
#1.Install Tesseract-ocr*.exe from http://jaist.dl.sourceforge.net/project/tesseract-ocr-alt/ Tesseract-ocr-setup-3.02.02.exe#2.Install Pillow as "pip Install form *.WHL"#3.Install pytesseract as "pip Install form *.WHL"ImportOs.pathImportpytesseract fromPILImportImage fromJpypeImport*
##################################################### TESSERACE-OCR ########################################## ###########image = Image.open (r "D:\Project\AI\1.MachineLearning\A.Tensorflow\2.Python_Prj\FirstPython\processed_7039. PNG ")Image = Image.open (r"D:\Project\AI\1.MachineLearning\A.Tensorflow\2.Python_Prj\FirstPython\OCR2.png") Code=pytesseract.image_to_string (image) code= Code.replace (' ',"'); Code= Code.replace ('-',"'); Code= Code.replace ('\ r',"'); Code= Code.replace ('\ n',"');Print(Code)##################################################### Zxing Decode ########################################## ############Start JVMJarpath = Os.path.join (Os.path.abspath ('.'),'d:/project/ai/1.machinelearning/a.tensorflow/2.python_prj/firstpython/') STARTJVM ("C:/Program Files/java/jre6/bin/server/jvm.dll","-ea", ("-djava.class.path=%s"% (Jarpath +"Javase-2.2.jar"+";"+ Jarpath +"Core-2.2.jar")))#Load the useful library classesFile = Jclass ("Java.io.File") BufferedImage= Jclass ("Java.awt.image.BufferedImage") ImageIO= Jclass ("Javax.imageio.ImageIO") Binarybitmap= Jclass ("Com.google.zxing.BinaryBitmap") Decodehinttype= Jclass ("Com.google.zxing.DecodeHintType") Luminancesource= Jclass ("Com.google.zxing.LuminanceSource") Bufferedimageluminancesource= Jclass ("Com.google.zxing.client.j2se.BufferedImageLuminanceSource") Multiformatreader= Jclass ("Com.google.zxing.MultiFormatReader") Notfoundexception= Jclass ("com.google.zxing.NotFoundException") Result= Jclass ("Com.google.zxing.Result") Hybridbinarizer= Jclass ("Com.google.zxing.common.HybridBinarizer") Hashtable= Jclass ("java.util.Hashtable")#Do the QRCode decodeImage = Imageio.read (File ("d:/project/ai/1.machinelearning/a.tensorflow/2.python_prj/firstpython/qrcode1.jpg") ) Source=Bufferedimageluminancesource (image) bitmap=Binarybitmap (Hybridbinarizer (source)) Hints=Hashtable () hints.put (Decodehinttype.character_set,"GBK") Result=Multiformatreader (). Decode (bitmap, hints)Print(Result)#Shutdown JVMSHUTDOWNJVM ()
Python calls TESSERACT-OCR and zxing to complete image OCR recognition and QR code decoding