当前位置:网站首页>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&#边栏推荐
猜你喜欢

<代码随想录二刷>链表

Please insert the disk into "U disk (H)" & unable to access the disk structure is damaged and cannot be read

【4500字归纳总结】一名软件测试工程师需要掌握的技能大全

DatePickerDialog and trimepickerdialog

Functions and usage of viewswitch

Matplotlib绘图界面设置

Toast will display a simple prompt message on the program interface

让保险更“保险”!麒麟信安一云多芯云桌面中标中国人寿, 助力金融保险信息技术创新发展

Examen des lois et règlements sur la sécurité de l'information

2021-06-28
随机推荐
百度地图自定义样式向右拖拽导致全球地图经度0度无法正常显示
青年时代历练和职业发展
目标检测1——YOLO数据标注以及xml转为txt文件脚本实战
本周小贴士#135:测试约定而不是实现
LeetCode 515(C#)
L1-027 出租(Lua)
Please insert the disk into "U disk (H)" & unable to access the disk structure is damaged and cannot be read
Devops' operational and commercial benefits Guide
YARN Capacity Scheduler容量调度器(超详细解读)
如何在软件研发阶段落地安全实践
LeetCode 535(C#)
机器人工程终身学习和工作计划-2022-
数字化转型的主要工作
机器视觉(1)——概述
如何在软件研发阶段落地安全实践
命令模式 - Unity
【TPM2.0原理及应用指南】 9、10、11章
alertDialog創建对话框
【解惑】App处于前台,Activity就不会被回收了?
麒麟信安云平台全新升级!