当前位置:网站首页>利用七种方法对一个文件夹里面的所有图像进行图像增强实战
利用七种方法对一个文件夹里面的所有图像进行图像增强实战
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&#边栏推荐
- 阿富汗临时政府安全部队对极端组织“伊斯兰国”一处藏匿点展开军事行动
- 第2章搭建CRM项目开发环境(数据库设计)
- Notes on installing MySQL in centos7
- 麒麟信安携异构融合云金融信创解决方案亮相第十五届湖南地区金融科技交流会
- [source code interpretation] | source code interpretation of livelistenerbus
- 【重新理解通信模型】Reactor 模式在 Redis 和 Kafka 中的应用
- Function and usage of calendar view component
- First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
- Devops' operational and commercial benefits Guide
- alertDialog創建对话框
猜你喜欢

Leetcode brush questions day49

简单的loading动画

Function and usage of textswitch text switcher

【TPM2.0原理及应用指南】 9、10、11章

深入浅出图解CNN-卷积神经网络

麒麟信安中标国网新一代调度项目!

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

Sator launched Web3 game "satorspace" and launched hoobi

User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions

【TPM2.0原理及应用指南】 16、17、18章
随机推荐
Functions and usage of ratingbar
TabHOST 选项卡的功能和用法
阿富汗临时政府安全部队对极端组织“伊斯兰国”一处藏匿点展开军事行动
Toast will display a simple prompt message on the program interface
Problems encountered in Jenkins' release of H5 developed by uniapp
The top of slashdata developer tool is up to you!!!
2021-06-28
LeetCode 497(C#)
责任链模式 - Unity
actionBar 导航栏学习
Audio Device Strategy 音频设备输出、输入 选择 基于7.0 代码
第3章业务功能开发(实现记住账号密码)
Notes on installing MySQL in centos7
第3章业务功能开发(用户登录)
VSCode关于C语言的3个配置文件
【TPM2.0原理及应用指南】 9、10、11章
Show progress bar above window
【OKR目标管理】价值分析
Smart logistics platform: make overseas warehouses smarter
【网络攻防原理与技术】第3章:网络侦察技术