python学习笔记03 图像增强

#视差图像预处理-_gammma.py 对图像增强后再进行视差匹配计算
from PIL import Image
from PIL import ImageEnhance
import types
# import cv2

# 原始图像
image1 = Image.open('C:\\Software\\Python\\left_3.jpg')
print(type)
image2 = Image.open('C:\\Software\\Python\\right_3.jpg')
print(image2)
# image.show()
""""
# 亮度增强
enh_bri = ImageEnhance.Brightness(image)
brightness = 1.5
image_brightened = enh_bri.enhance(brightness)
image_brightened.show()
cv2.imwrite("./snapshot/liangdu_left_3.jpg", image_contrasted)

# 色度增强
enh_col = ImageEnhance.Color(image)
color = 1.5
image_colored = enh_col.enhance(color)
image_colored.show()

# 锐度增强
enh_sha = ImageEnhance.Sharpness(image)
sharpness = 3.0
image_sharped = enh_sha.enhance(sharpness)
image_sharped.show()  
"""
# 对比度增强
enh_con1 = ImageEnhance.Contrast(image1)
enh_con2 = ImageEnhance.Contrast(image2)
contrast = 1.5
image_contrasted1 = enh_con1.enhance(contrast)
image_contrasted2 = enh_con2.enhance(contrast)
image_contrasted1.show()
image_contrasted2.show()
image_contrasted1.save('C:\\Software\\Python\\duibidu_left_3.jpg')
image_contrasted2.save('C:\\Software\\Python\\duibidu_right_3.jpg')
# cv2.imwrite("./snapshot/duibidu_right_3.jpg", image_contrasted1)
print(image_contrasted2)

----------------------------------------------------------------------

C:\Software\Anaconda3\python.exe G:/Python/Ancondatest01/_gammma.py


原图

python学习笔记03 图像增强_第1张图片

对比度增强

python学习笔记03 图像增强_第2张图片

你可能感兴趣的:(Python,图像增强,python)