【OpenCV-Python】:提高、降低图像亮度(指数变换)
opencv
OpenCV: 开源计算机视觉库
项目地址:https://gitcode.com/gh_mirrors/opencv31/opencv
·
✨博客主页:王乐予🎈
✨年轻人要:Living for the moment(活在当下)!💪
🏆推荐专栏:【图像处理】【千锤百炼Python】【深度学习】【排序算法】
话不多说,直接看代码!
import cv2
import os
import numpy as np
def read_path(file_pathname):
for filename in os.listdir(file_pathname):
print(filename)
img = cv2.imread(file_pathname+'/'+filename)
image = np.power(img, 0.8) # 对像素值指数变换
cv2.imwrite(r"C:\Users\Lenovo\Desktop\change" + "/" + filename, image)
read_path(r"C:\Users\Lenovo\Desktop\original")
这里使用np.power()指数变换函数对图像像素值进行处理,参数设置方式如下:
- 小于1:降低图像亮度
- 大于1:提高图像亮度
图片展示如下:


OpenCV: 开源计算机视觉库
最近提交(Master分支:3 个月前 )
a49eb470
FFmpeg binaries update for Windows. 11 小时前
b618676a
Disable IPP with AVX512 in cv::compare because of performance regression 13 小时前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)