失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python 获取图像亮度和锐度 pytesseract 获取图片上字符串 及增加亮度 色感 对比度 锐度...

python 获取图像亮度和锐度 pytesseract 获取图片上字符串 及增加亮度 色感 对比度 锐度...

时间:2021-04-02 00:19:46

相关推荐

python 获取图像亮度和锐度 pytesseract 获取图片上字符串 及增加亮度 色感 对比度 锐度...

from PIL import Image

import pytesseract

text = pytesseract.image_to_string(Image.open("./pic/pythontest.png"))

print(text)

def pic_dispose(x):

image = Image.open(x)

image.show()

#亮度

enh_bri = ImageEnhance.Brightness(image)

brightness = 1.8

image_brightened = enh_bri.enhance(brightness)

image_brightened.show()

#色感

enh_col = ImageEnhance.Color(image)

color = 1.5

image_colored = enh_col.enhance(color)

image_colored.show()

# 对比度增强

enh_con = ImageEnhance.Contrast(image)

contrast = 1.5

image_contrasted = enh_con.enhance(contrast)

image_contrasted.show()

# 锐度增强

enh_sha = ImageEnhance.Sharpness(image)

sharpness = 3.0

image_sharped = enh_sha.enhance(sharpness)

image_sharped.show()

pic_dispose("./pic/pythontest.png")

如果觉得《python 获取图像亮度和锐度 pytesseract 获取图片上字符串 及增加亮度 色感 对比度 锐度...》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。