当前位置:网站首页>利用七种方法对一个文件夹里面的所有图像进行图像增强实战
利用七种方法对一个文件夹里面的所有图像进行图像增强实战
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&#边栏推荐
猜你喜欢

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

Functions and usage of tabhost tab

What is cloud computing?

Biped robot controlled by Arduino

Several best practices for managing VDI

【可信计算】第十三次课:TPM扩展授权与密钥管理

Examen des lois et règlements sur la sécurité de l'information
![[video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial](/img/14/4e7ebfb1ed5b99f8377af9d17d2177.jpg)
[video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial

ViewSwitcher的功能和用法

简单的loading动画
随机推荐
A tour of grpc:03 - proto serialization / deserialization
Matplotlib绘制三维图形
Function and usage of calendar view component
使用popupwindow創建对话框风格的窗口
在窗口上面显示进度条
第3章业务功能开发(用户访问项目)
如何在软件研发阶段落地安全实践
请将磁盘插入“U盘(H)“的情况&无法访问 磁盘结构损坏且无法读取
Smart logistics platform: make overseas warehouses smarter
Notification is the notification displayed in the status bar of the phone
[fan Tan] after the arrival of Web3.0, where should testers go? (ten predictions and suggestions)
99%的人都不知道|私有化部署还永久免费的即时通讯软件!
Notes on installing MySQL in centos7
【分布式理论】(一)分布式事务
本周小贴士#134:make_unique与私有构造函数
企业即时通讯软件是什么?它有哪些优势呢?
【TPM2.0原理及应用指南】 5、7、8章
alertDialog創建对话框
MySQL usage notes 1
Numberpick的功能和用法