当前位置:网站首页>利用七种方法对一个文件夹里面的所有图像进行图像增强实战
利用七种方法对一个文件夹里面的所有图像进行图像增强实战
2022-07-07 15:40:00 【AI炮灰】
# coding = utf-8
import cv2
from PIL import Image
from PIL import ImageEnhance
from numpy.ma import array
import numpy as np
import os
# 批量处理代码
rootdir = 'F:/danzi/数据/4' # 指明被遍历的文件夹
def high_bright(currentPath, filename, targetPath):
# 读取图像
image = Image.open(currentPath)
image_cv = cv2.imread(currentPath)
# image.show()
# 增强亮度 bh_
enh_bri = ImageEnhance.Brightness(image)
brightness = 1.07
image_brightened_h = enh_bri.enhance(brightness)
# image_brightened_h.show()
image_brightened_h.save(targetPath+ '1' + filename) # 保存
def low_bright(currentPath, filename, targetPath):
image = Image.open(currentPath)
image_cv = cv2.imread(currentPath)
# 降低亮度 bl_
enh_bri_low = ImageEnhance.Brightness(image)
brightness = 0.87
image_brightened_low = enh_bri_low.enhance(brightness)
# image_brightened_low.show()
image_brightened_low.save(targetPath&#边栏推荐
- Repair method of firewall system crash and file loss, material cost 0 yuan
- Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
- 专精特新软件开发类企业实力指数发布,麒麟信安荣誉登榜
- 【TPM2.0原理及应用指南】 16、17、18章
- Nerf: the ultimate replacement for deepfake?
- The top of slashdata developer tool is up to you!!!
- 第二十四届中国科协湖南组委会调研课题组一行莅临麒麟信安调研考察
- 【网络攻防原理与技术】第7章:口令攻击技术 第8章:网络监听技术
- 麒麟信安云平台全新升级!
- 使用Stace排除故障的5种简单方法
猜你喜欢

Mrs offline data analysis: process OBS data through Flink job

责任链模式 - Unity
![[re understand the communication model] the application of reactor mode in redis and Kafka](/img/d6/8a6124bb7f96be92bf8c6d3aeef12d.png)
[re understand the communication model] the application of reactor mode in redis and Kafka

Functions and usage of viewswitch

Sator a lancé le jeu web 3 "satorspace" et a lancé huobi

百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示

命令模式 - Unity

toast会在程序界面上显示一个简单的提示信息

【TPM2.0原理及应用指南】 16、17、18章

本周小贴士#136:无序容器
随机推荐
2021-06-28
Mrs offline data analysis: process OBS data through Flink job
textSwitch文本切换器的功能和用法
【OKR目标管理】案例分析
Audio device strategy audio device output and input selection is based on 7.0 code
【可信计算】第十三次课:TPM扩展授权与密钥管理
Share the latest high-frequency Android interview questions, and take you to explore the Android event distribution mechanism
LeetCode 515(C#)
使用 xml资源文件定义菜单
Create dialog style windows with popupwindow
本周小贴士#141:注意隐式转换到bool
Devops' operational and commercial benefits Guide
麒麟信安云平台全新升级!
数值 - number(Lua)
99%的人都不知道|私有化部署还永久免费的即时通讯软件!
Repair method of firewall system crash and file loss, material cost 0 yuan
【TPM2.0原理及应用指南】 12、13、14章
Ratingbar的功能和用法
本周小贴士#135:测试约定而不是实现
TabHOST 选项卡的功能和用法