当前位置:网站首页>Use seven methods to enhance all the images in a folder
Use seven methods to enhance all the images in a folder
2022-07-07 17:40:00 【AI cannon fodder】
# coding = utf-8
import cv2
from PIL import Image
from PIL import ImageEnhance
from numpy.ma import array
import numpy as np
import os
# Batch processing code
rootdir = 'F:/danzi/ data /4' # Indicates the folder being traversed
def high_bright(currentPath, filename, targetPath):
# Read images
image = Image.open(currentPath)
image_cv = cv2.imread(currentPath)
# image.show()
# Enhance the brightness 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) # preservation
def low_bright(currentPath, filename, targetPath):
image = Image.open(currentPath)
image_cv = cv2.imread(currentPath)
# Decrease brightness 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&#
边栏推荐
猜你喜欢
麒麟信安操作系统衍生产品解决方案 | 存储多路径管理系统,有效提高数据传输可靠性
toast会在程序界面上显示一个简单的提示信息
serachview的功能和用法
Please insert the disk into "U disk (H)" & unable to access the disk structure is damaged and cannot be read
命令模式 - Unity
Biped robot controlled by Arduino
线上比赛相关规则补充说明
漫画 | 宇宙第一 IDE 到底是谁?
做软件测试 掌握哪些技术才能算作 “ 测试高手 ”?
【4500字归纳总结】一名软件测试工程师需要掌握的技能大全
随机推荐
自动化测试:Robot FrameWork框架大家都想知道的实用技巧
Functions and usage of tabhost tab
《世界粮食安全和营养状况》报告发布:2021年全球饥饿人口增至8.28亿
【网络攻防原理与技术】第5章:拒绝服务攻击
第1章CRM核心业务介绍
【OKR目标管理】价值分析
Simple loading animation
L1-025 正整数A+B(Lua)
面试官:页面很卡的原因分析及解决方案?【测试面试题分享】
机器人工程终身学习和工作计划-2022-
测试3个月,成功入职 “字节”,我的面试心得总结
Cartoon | who is the first ide in the universe?
【可信计算】第十三次课:TPM扩展授权与密钥管理
原生js验证码
数值 - number(Lua)
LeetCode1051(C#)
本周小贴士#135:测试约定而不是实现
L1-027 出租(Lua)
Audio Device Strategy 音频设备输出、输入 选择 基于7.0 代码
无法链接远程redis服务器(解决办法百分百)