opencv-python(PIL)图像处理之训练模型前的几种图预处理

# 滤波
import cv2
image=cv2.imread("")
image_new=cv2.medianBlur(image,3)



from PIL import Image
from PIL import ImageEnhance
image = Image.open('.jpg')
#亮度增强
enb_b = ImageEnhance . Brightness (image)
brightness = 1.3
image_bri= enb_b. enhance (brightness )

image_bri. show ()
# 色度增强
enh_col = ImageEnhance.Color (image)
color=1.5
image_col = enh_col . enhance (color)
image_col.show()
#对比度增强
enh_con = ImageEnhance .Contrast (image)
contrast = 1.5
image_cont= enh_con. enhance(contrast)
image_cont.show()
#锐度增强
enh_sha = ImageEnhance . Sharpness (image)
sharpness = 3.0
image_sha = enh_sha. enhance(sharpness)
image_sha. show ()


你可能感兴趣的:(opencv-python)