处理前图像:
处理后图像
代码
#coding:utf8 import os from PIL import Image,ImageDraw,ImageFile import numpy import pytesseract import cv2 import imagehash class pictureIdenti: # 点降噪 def clearNoise(self, img_name="D:workpython36_crawlpictureParserV10.png", x=0, y=0): if os.path.exists(img_name): image = Image.open(img_name) image = image.convert('L') image = numpy.asarray(image) image = (image > 135) * 255 image = Image.fromarray(image).convert('RGB') # image.show() save_name = "D:workpython36_crawlpictureParserV19.png" image.save(save_name) return image