功能介绍:
1. tmall 工商图片去除水印。
2. 工商图片识别公司名称。
环境概述:
mac / Centos
Python3.6.5
Tesseract 4.0.0
源码如下:
https://github.com/Carmenliukang/Image_watermark_removal
# !/usr/bin/python
# -*- coding: utf-8 -*-
import os
import uuid
import pytesseract
from PIL import Image
class TmallImageRecognition(object):
'''
识别图片中的公司名称。
1. 图片截图
2. 图片去水印
3. 图片汉字识别
'''
def __init__(self, image_path="image"):
self.image_path = os.path.join(os.getcwd(), image_path)
self.check_mkdir()
def get_image_path(self, image_name):
return os.path.join(self.image_path, image_name)
def split_image(self, image_name, image_split_name, x=0, y=40, h=40):
'''
图片裁剪,用于降低cpu消耗