Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
187aabe4f0 | ||
|
298633d90f | ||
|
0157fe648c | ||
|
160f8e1e21 | ||
|
d14e398739 | ||
|
3d78b6edb3 |
7
.gitlab-ci.yml
Normal file
7
.gitlab-ci.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
stages:
|
||||||
|
- test
|
||||||
|
sonarqube_master_job:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- export ENCRYPT_KEY=`echo $CI_PROJECT_URL.git | md5sum | cut -d' ' -f1`
|
||||||
|
- /opt/sonar-scanner-4.7.0/bin/sonar-scanner -Dsonar.sources=. -Dsonar.projectKey=p$ENCRYPT_KEY
|
@ -5,46 +5,55 @@
|
|||||||
# @File : Blue_noise_sampling.py
|
# @File : Blue_noise_sampling.py
|
||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
|
|
||||||
'''
|
|
||||||
计算新图形(放大后或缩小后)的坐标点像素值对应于原图像中哪一个像素点填充的。
|
|
||||||
src是原图,dst是新图,原来的图像宽度/高度除以新图像的宽度/高度可以得到缩放比例,假如是缩小图片括号内的数字小于1,放大则大于1,相当于系数,再乘以新图片的宽度/高度,就实现了缩放。
|
|
||||||
'''
|
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import math
|
from PIL import Image
|
||||||
|
|
||||||
|
'''
|
||||||
# # 最近邻插值算法
|
srcX=newX*(srcW/newW)
|
||||||
# # dstH为新图的高;dstW为新图的宽
|
srcY=newY*(srcH/newH)
|
||||||
# def blueNoiseSampl(img, dstH, dstW):
|
src是原图,dst是新图,原来的图像宽度/高度除以新图像的宽度/高度可以得到缩放比例,
|
||||||
# scrH, scrW, t = img.shape # src原图的长宽
|
假如是缩小图片括号内的数字小于1,放大则大于1,相当于系数,再乘以新图片的宽度/高度,就实现了缩放。
|
||||||
# retimg = np.zeros((dstH, dstW, 3), dtype=np.uint8)
|
'''
|
||||||
# for i in range(dstH - 1):
|
|
||||||
# for j in range(dstW - 1):
|
def blueNoiseSampl(img, newH, newW):
|
||||||
# scrx = round(i * (scrH / dstH))
|
'''
|
||||||
# scry = round(j * (scrW / dstW))
|
|
||||||
# retimg[i, j] = img[scrx, scry]
|
:param img: 图片
|
||||||
#
|
:param newH: 新图的高
|
||||||
# return retimg
|
:param newW: 新图的宽
|
||||||
#
|
:return: 新图
|
||||||
#
|
'''
|
||||||
# im_path = './data/th.png'
|
scrH, scrW, t = img.shape # 原图的长宽
|
||||||
# image = np.array(Image.open(im_path))
|
retimg = np.zeros((newH, newW, 3), dtype=np.uint8) # 生成 newH* newW *3 的零矩阵
|
||||||
#
|
for i in range(newH - 1):
|
||||||
# plt.figure(figsize=(16, 8))
|
for j in range(newW - 1):
|
||||||
#
|
scrx = round(i * (scrH / newH)) # round对其四舍五入
|
||||||
# plt.subplot(1, 2, 1)
|
scry = round(j * (scrW / newW))
|
||||||
# plt.imshow(image)
|
retimg[i, j] = img[scrx, scry] # new image
|
||||||
#
|
return retimg
|
||||||
# image1 = blueNoiseSampl(image, image.shape[0] * 2, image.shape[1] * 2)
|
|
||||||
# # 从array转换成image
|
|
||||||
# image1 = Image.fromarray(image1.astype('uint8')).convert('RGB')
|
|
||||||
# image1.save('./data/picture13.png')
|
|
||||||
# plt.subplot(1, 2, 2)
|
|
||||||
# plt.imshow(image1)
|
|
||||||
# plt.show()
|
|
||||||
|
|
||||||
|
|
||||||
|
# 图片展示函数
|
||||||
|
def showImage(picPath):
|
||||||
|
'''
|
||||||
|
|
||||||
|
:param picPath: 图片地址
|
||||||
|
:return: 样图
|
||||||
|
'''
|
||||||
|
# 获取图片矩阵
|
||||||
|
image = np.array(Image.open(picPath))
|
||||||
|
# 设置画布
|
||||||
|
plt.figure(figsize=(16, 8))
|
||||||
|
# 合并
|
||||||
|
plt.subplot(121)
|
||||||
|
plt.imshow(image)
|
||||||
|
# 调用采样函数
|
||||||
|
image1 = blueNoiseSampl(image, image.shape[0] * 2, image.shape[1] * 2)
|
||||||
|
# 图片保存
|
||||||
|
Image.fromarray(np.uint8(image1)).save("./data/picture13.png")
|
||||||
|
plt.subplot(122)
|
||||||
|
plt.imshow(image1)
|
||||||
|
plt.show()
|
||||||
|
return image1
|
||||||
|
359
GUI.py
359
GUI.py
@ -1,12 +1,363 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# @Time : 2022-7-25 0025 15:03
|
# @Time : 2022-7-27 0027 15:21
|
||||||
# @Author : Qing
|
# @Author : Qing
|
||||||
# @Email : derighoid@gmail.com
|
# @Email : derighoid@gmail.com
|
||||||
# @File : GUI.py
|
# @File : GUI.py
|
||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
|
import os
|
||||||
import tkinter
|
import tkinter
|
||||||
|
import tkinter.filedialog
|
||||||
|
import tkinter.messagebox # 弹窗库
|
||||||
|
|
||||||
# git checkout -b "main"
|
import PIL
|
||||||
|
import numpy as np
|
||||||
|
import requests
|
||||||
|
from PIL import Image, ImageTk
|
||||||
|
|
||||||
import tkinter
|
root = tkinter.Tk()
|
||||||
root =tkinter.Tk()
|
root.title = 'new'
|
||||||
|
root.geometry('640x500')
|
||||||
|
|
||||||
|
|
||||||
|
# 文件选择
|
||||||
|
def choose_fiel():
|
||||||
|
selectFileName = tkinter.filedialog.askopenfilename(title='选择文件') # 选择文件
|
||||||
|
e.set(selectFileName)
|
||||||
|
|
||||||
|
|
||||||
|
label1 = tkinter.Label(root, text="文件路径:")
|
||||||
|
label1.place(x=40, y=0)
|
||||||
|
|
||||||
|
e = tkinter.StringVar()
|
||||||
|
e_entry = tkinter.Entry(root, width=60, textvariable=e)
|
||||||
|
e_entry.place(x=100, y=0)
|
||||||
|
|
||||||
|
lable2 = tkinter.Label(root, text="URL:")
|
||||||
|
lable2.place(x=40, y=30)
|
||||||
|
|
||||||
|
# 设置输入框
|
||||||
|
entry = tkinter.Entry(root, width=60)
|
||||||
|
entry.insert(0,
|
||||||
|
"https://tse2-mm.cn.bing.net/th/id/OIP-C.fT7uKiT7V7YO2PPINFeOdQHaJ4?w=186&h=248&c=7&r=0&o=5&dpr=1.25&pid=1.7")
|
||||||
|
entry.place(x=100, y=30)
|
||||||
|
|
||||||
|
# 选择文件按钮
|
||||||
|
submit_button = tkinter.Button(root, text="选择文件", command=choose_fiel)
|
||||||
|
submit_button.place(x=520, y=0)
|
||||||
|
|
||||||
|
|
||||||
|
# 爬取函数
|
||||||
|
def pictureCrawl(url):
|
||||||
|
# 文件保存地址
|
||||||
|
root = "E://桌面//Python_Picture_Analysis//data//"
|
||||||
|
# 文件的保存地址以及格式
|
||||||
|
path = root + url.split('/')[-3] + '.png'
|
||||||
|
try:
|
||||||
|
if not os.path.exists(root): # 判断是否存在文件夹
|
||||||
|
os.mkdir(root)
|
||||||
|
if not os.path.exists(path): # 判断是否存在该文件
|
||||||
|
r = requests.get(url)
|
||||||
|
# 文件写入
|
||||||
|
with open(path, 'wb') as fp:
|
||||||
|
fp.write(r.content)
|
||||||
|
print("OK")
|
||||||
|
else:
|
||||||
|
print("File already exists")
|
||||||
|
except:
|
||||||
|
print("Crawl successful")
|
||||||
|
|
||||||
|
|
||||||
|
# 爬取按钮
|
||||||
|
imgCrawling_button = tkinter.Button(root, text="开始爬取", command=lambda: pictureCrawl(entry.get()))
|
||||||
|
imgCrawling_button.place(x=520, y=30)
|
||||||
|
|
||||||
|
|
||||||
|
# 图片变灰
|
||||||
|
def grayPic(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = img.convert('L')
|
||||||
|
showPic = ImageTk.PhotoImage(img)
|
||||||
|
img = tkinter.Label(image=showPic)
|
||||||
|
img.image = showPic
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 灰色图按钮
|
||||||
|
grayPic_button = tkinter.Button(root, text="灰色图", command=lambda: grayPic(e_entry))
|
||||||
|
grayPic_button.place(x=110, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
# 图像水平镜面对称
|
||||||
|
def mirrorSymmetry(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.asarray(img)
|
||||||
|
img1 = np.flipud(img)
|
||||||
|
img2 = Image.fromarray(img1)
|
||||||
|
pic = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=pic)
|
||||||
|
img.image = pic
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 镜面按钮
|
||||||
|
mirrorSymmetry_button = tkinter.Button(root, text="镜面对称", command=lambda: mirrorSymmetry(e_entry))
|
||||||
|
mirrorSymmetry_button.place(x=170, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
# 右旋转
|
||||||
|
def verticalSummetry_right(e_tery):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img1 = img.swapaxes(1, 0)
|
||||||
|
img2 = img1[:, ::-1]
|
||||||
|
img2 = Image.fromarray(img2)
|
||||||
|
|
||||||
|
pic = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=pic)
|
||||||
|
img.image = pic
|
||||||
|
img.place(x=300, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 右旋转按钮
|
||||||
|
verticalSummetry_right_button = tkinter.Button(root, text="右旋转", command=lambda: verticalSummetry_right(e_entry))
|
||||||
|
verticalSummetry_right_button.place(x=240, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
# 左旋转
|
||||||
|
def verticalSummetry_lift(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img1 = img.transpose(1, 0, 2) # x,y轴转置
|
||||||
|
img2 = img1[::-1]
|
||||||
|
|
||||||
|
img2 = Image.fromarray(img2)
|
||||||
|
|
||||||
|
pic = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=pic)
|
||||||
|
img.image = pic
|
||||||
|
img.place(x=300, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 左旋转按钮
|
||||||
|
verticalSummetry_lift_button = tkinter.Button(root, text="左旋转", command=lambda: verticalSummetry_lift(e_entry))
|
||||||
|
verticalSummetry_lift_button.place(x=300, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
# 像素反转函数
|
||||||
|
def pixInversion(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img2 = 255 - np.array(img)
|
||||||
|
img2 = Image.fromarray(img2)
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 像素反转
|
||||||
|
pixInversion_button = tkinter.Button(root, text="像素反转", command=lambda: pixInversion(e_entry))
|
||||||
|
pixInversion_button.place(x=360, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
def redImage(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img[:, :, 1:3] = 0
|
||||||
|
img2 = Image.fromarray(img)
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 红色图按钮
|
||||||
|
red_button = tkinter.Button(root, text="红色图", command=lambda: redImage(e_entry))
|
||||||
|
red_button.place(x=430, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
def blueImage(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img[:, :, :2] = 0
|
||||||
|
img2 = Image.fromarray(img)
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 蓝色图按钮
|
||||||
|
blue_button = tkinter.Button(root, text="蓝色图", command=lambda: blueImage(e_entry))
|
||||||
|
blue_button.place(x=490, y=75)
|
||||||
|
|
||||||
|
#绿色图函数
|
||||||
|
def greenImage(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img[:, :, ::2] = 0
|
||||||
|
img2 = Image.fromarray(img)
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 绿色按钮
|
||||||
|
green_button = tkinter.Button(root, text='绿色图', command=lambda: greenImage(e_entry))
|
||||||
|
green_button.place(x=550, y=75)
|
||||||
|
|
||||||
|
|
||||||
|
# 图像混合函数
|
||||||
|
|
||||||
|
def imageMix(e_entry):
|
||||||
|
img1 = Image.open("./data/picture.png")
|
||||||
|
img2 = Image.open(e_entry.get())
|
||||||
|
img3 = PIL.Image.blend(img1, img2, 0.5)
|
||||||
|
|
||||||
|
img4 = ImageTk.PhotoImage(img3)
|
||||||
|
img = tkinter.Label(image=img4)
|
||||||
|
img.image = img4
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 图像混合按钮
|
||||||
|
imageMix_button = tkinter.Button(root, text="图像混合", command=lambda: imageMix(e_entry))
|
||||||
|
imageMix_button.place(x=40, y=105)
|
||||||
|
|
||||||
|
|
||||||
|
# 图像剪切函数
|
||||||
|
def imageCut(e_entry):
|
||||||
|
img1 = Image.open(e_entry.get())
|
||||||
|
part = (20, 10, 190, 190)
|
||||||
|
img2 = img1.crop(part)
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 剪切按钮
|
||||||
|
cut_button = tkinter.Button(root, text="剪 切", command=lambda: imageCut(e_entry))
|
||||||
|
cut_button.place(x=110, y=105)
|
||||||
|
|
||||||
|
|
||||||
|
# 部分替换函数
|
||||||
|
def imgReplace(e_entry):
|
||||||
|
part = (10, 50, 250, 250)
|
||||||
|
img1 = Image.open(e_entry.get())
|
||||||
|
img2 = Image.open("./data/picture.png")
|
||||||
|
img3 = img2.crop(part)
|
||||||
|
img1.paste(img3, (10, 50, 250, 250))
|
||||||
|
|
||||||
|
img4 = ImageTk.PhotoImage(img1)
|
||||||
|
img = tkinter.Label(image=img4)
|
||||||
|
img.image = img4
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 部分替换按钮
|
||||||
|
imgReplace_button = tkinter.Button(root, text="部分替换", command=lambda: imgReplace(e_entry))
|
||||||
|
imgReplace_button.place(x=170, y=105)
|
||||||
|
|
||||||
|
# 输入框
|
||||||
|
Entrybutton = tkinter.Entry(root, width=15)
|
||||||
|
Entrybutton.insert(0, 2)
|
||||||
|
Entrybutton.place(x=490, y=110)
|
||||||
|
|
||||||
|
lab5 = tkinter.Label(root, text="Gamma:")
|
||||||
|
lab5.place(x=430, y=110)
|
||||||
|
|
||||||
|
|
||||||
|
# 伽马矫正函数(默认1/1,5)
|
||||||
|
def gammaCorrect(e_entry, Entrybutton):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
img1 = np.power(img / float(np.max(img)), int(Entrybutton.get()))
|
||||||
|
img2 = Image.fromarray(np.uint8(img1 * 255))
|
||||||
|
img3 = ImageTk.PhotoImage(img2)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 伽马矫正按钮
|
||||||
|
gammaCorrect_button = tkinter.Button(root, text="伽马矫正", command=lambda: gammaCorrect(e_entry, Entrybutton))
|
||||||
|
gammaCorrect_button.place(x=240, y=105)
|
||||||
|
|
||||||
|
|
||||||
|
def decrease_color(e_entry):
|
||||||
|
img = Image.open(e_entry.get())
|
||||||
|
img = np.array(img)
|
||||||
|
H = img.shape[0] # 获取图片的高
|
||||||
|
W = img.shape[1] # 获取图片的宽
|
||||||
|
newImg = np.zeros((H, W, 3), np.uint8)
|
||||||
|
|
||||||
|
for i in range(H):
|
||||||
|
for j in range(W):
|
||||||
|
for k in range(3): # RGB三分量
|
||||||
|
if img[i, j][k] < 128:
|
||||||
|
gray = 0
|
||||||
|
else:
|
||||||
|
gray = 128
|
||||||
|
newImg[i, j][k] = np.uint8(gray) # 传给新图片
|
||||||
|
newImg = Image.fromarray(newImg)
|
||||||
|
img3 = ImageTk.PhotoImage(newImg)
|
||||||
|
img = tkinter.Label(image=img3)
|
||||||
|
img.image = img3
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 减色按钮
|
||||||
|
decrease_color_button = tkinter.Button(root, text="减色", command=lambda: decrease_color(e_entry))
|
||||||
|
decrease_color_button.place(x=310, y=105)
|
||||||
|
|
||||||
|
|
||||||
|
# 采样函数
|
||||||
|
def picSampl(img, newH, newW):
|
||||||
|
scrH, scrW, t = img.shape # 原图的长宽
|
||||||
|
|
||||||
|
retimg = np.zeros((newH, newW, 3), dtype=np.uint8) # 生成 newH* newW *3 的零矩阵
|
||||||
|
for i in range(newH - 1):
|
||||||
|
for j in range(newW - 1):
|
||||||
|
scrx = round(i * (scrH / newH)) # round对其四舍五入
|
||||||
|
scry = round(j * (scrW / newW))
|
||||||
|
retimg[i, j] = img[scrx, scry] # new image
|
||||||
|
return retimg
|
||||||
|
|
||||||
|
|
||||||
|
# 采样展示
|
||||||
|
def showImage(e_entry):
|
||||||
|
img = np.array(Image.open(e_entry.get()))
|
||||||
|
|
||||||
|
img1 = picSampl(img, img.shape[0] * 2, img.shape[1] * 2)
|
||||||
|
img1 = Image.fromarray(img1)
|
||||||
|
img2 = ImageTk.PhotoImage(img1)
|
||||||
|
img = tkinter.Label(image=img2)
|
||||||
|
img.image = img2
|
||||||
|
img.place(x=350, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 采样按钮
|
||||||
|
picSampl_button = tkinter.Button(root, text='图片采样', command=lambda: showImage(e_entry))
|
||||||
|
picSampl_button.place(x=360, y=105)
|
||||||
|
|
||||||
|
|
||||||
|
# 图片展示
|
||||||
|
def showImg(e_entry):
|
||||||
|
load = Image.open(e_entry.get())
|
||||||
|
render = ImageTk.PhotoImage(load)
|
||||||
|
|
||||||
|
img = tkinter.Label(image=render)
|
||||||
|
img.image = render
|
||||||
|
img.place(x=50, y=150)
|
||||||
|
|
||||||
|
|
||||||
|
# 图片展示按钮
|
||||||
|
submit_button = tkinter.Button(root, text="显示原图", command=lambda: showImg(e_entry))
|
||||||
|
submit_button.place(x=40, y=75)
|
||||||
|
|
||||||
|
lable3 = tkinter.Label(root, text='原图', bg='red')
|
||||||
|
lable3.place(x=140, y=460)
|
||||||
|
lable4 = tkinter.Label(root, text='处理后', bg='red')
|
||||||
|
lable4.place(x=450, y=460)
|
||||||
|
root.mainloop()
|
||||||
|
@ -6,34 +6,45 @@
|
|||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
'''
|
'''
|
||||||
gamma矫正公式:
|
gamma矫正公式:
|
||||||
f(x)=xγ
|
f(x)=x^γ
|
||||||
即输出是输入的幂函数,指数为γ.
|
即输出是输入的幂函数,指数为γ.
|
||||||
'''
|
'''
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
# 文件保存的地址及文件夹
|
||||||
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
||||||
|
|
||||||
|
|
||||||
def gammaCorrect(filePath,val):
|
# 定义伽马矫正函数
|
||||||
|
def gammaCorrect(filePath, val):
|
||||||
|
'''
|
||||||
|
|
||||||
|
:param filePath: 图片路径
|
||||||
|
:param val: 伽马值
|
||||||
|
:return: 图片
|
||||||
|
'''
|
||||||
|
|
||||||
|
# 获取图片
|
||||||
im = Image.open(filePath)
|
im = Image.open(filePath)
|
||||||
img = np.array(im)
|
img = np.array(im) # 图片转矩阵
|
||||||
|
|
||||||
img1 = np.power(img / float(np.max(img)), 1 / 1.5)
|
# 伽马函数使用
|
||||||
img2 = np.power(img / float(np.max(img)), val)
|
img1 = np.power(img / float(np.max(img)), 1 / 1.5) # gamma值为1/1.5
|
||||||
|
img2 = np.power(img / float(np.max(img)), val) # 自定义gamma值
|
||||||
|
|
||||||
|
# 多图合并
|
||||||
plt.subplot(131)
|
plt.subplot(131)
|
||||||
plt.imshow(img)
|
plt.imshow(img)
|
||||||
plt.title("origin")
|
plt.title("origin") # 展示原图
|
||||||
plt.subplot(132)
|
plt.subplot(132)
|
||||||
plt.imshow(img1)
|
plt.imshow(img1)
|
||||||
plt.title("gammar=1/1.5")
|
plt.title("gammar=1/1.5") # 展示gamma =1/1.5
|
||||||
plt.subplot(133)
|
plt.subplot(133)
|
||||||
plt.imshow(img2)
|
plt.imshow(img2)
|
||||||
plt.title("user-defined")
|
plt.title("user-defined") # 展示自定义 gammat Image
|
||||||
plt.show()
|
plt.show()
|
||||||
|
# 图片保存
|
||||||
Image.fromarray(np.uint8(img2)).save(root + 'picture10' + '.jpg')
|
Image.fromarray(np.uint8(img2)).save(root + 'picture10' + '.jpg')
|
||||||
return img2
|
return img2
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,9 +9,11 @@ import matplotlib.pyplot as plt
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
# 图片保存的地址文件夹
|
||||||
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
||||||
|
|
||||||
|
|
||||||
|
# 定义图片剪切函数
|
||||||
def imgCut(path, left, upper, right, lower):
|
def imgCut(path, left, upper, right, lower):
|
||||||
"""
|
"""
|
||||||
:param path: 图片路径
|
:param path: 图片路径
|
||||||
@ -21,27 +23,34 @@ def imgCut(path, left, upper, right, lower):
|
|||||||
:param lower:与底部边界的距离
|
:param lower:与底部边界的距离
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
# 获取图片
|
||||||
img = Image.open(path)
|
img = Image.open(path)
|
||||||
print(img.size)
|
# print(img.size) Picture Size
|
||||||
part = (left, upper, right, lower)
|
part = (left, upper, right, lower) # 设置剪切的大小
|
||||||
|
|
||||||
|
# 剪切函数的调用
|
||||||
cut_img = img.crop(part)
|
cut_img = img.crop(part)
|
||||||
|
|
||||||
|
# 展示图片
|
||||||
|
# 展示原图
|
||||||
plt.figure("image Cut")
|
plt.figure("image Cut")
|
||||||
plt.subplot(121)
|
plt.subplot(121)
|
||||||
plt.title("origin")
|
plt.title("origin")
|
||||||
plt.imshow(img)
|
plt.imshow(img)
|
||||||
|
|
||||||
|
# 展示剪切后的图片
|
||||||
plt.subplot(122)
|
plt.subplot(122)
|
||||||
plt.title("CUT part")
|
plt.title("CUT part")
|
||||||
plt.imshow(cut_img)
|
plt.imshow(cut_img)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
# 图片保存
|
||||||
Image.fromarray(np.uint8(cut_img)).save(root + "picture11.jpg")
|
Image.fromarray(np.uint8(cut_img)).save(root + "picture11.jpg")
|
||||||
|
|
||||||
return cut_img
|
return cut_img
|
||||||
|
|
||||||
|
|
||||||
|
#定义图片部分替换函数
|
||||||
def imgReplace(path1, path2, left2, upper2, right2, lower2):
|
def imgReplace(path1, path2, left2, upper2, right2, lower2):
|
||||||
"""
|
"""
|
||||||
:param path1: 被替换图片的路径
|
:param path1: 被替换图片的路径
|
||||||
@ -49,21 +58,27 @@ def imgReplace(path1, path2, left2, upper2, right2, lower2):
|
|||||||
:param left2, upper2, right2, lower2:替换图片的大小
|
:param left2, upper2, right2, lower2:替换图片的大小
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
#图片的获取
|
||||||
img1 = Image.open(path1)
|
img1 = Image.open(path1) # 被替换图
|
||||||
img2 = Image.open(path2)
|
img2 = Image.open(path2) #替换图
|
||||||
|
|
||||||
part2 = (left2, upper2, right2, lower2)
|
part2 = (left2, upper2, right2, lower2)
|
||||||
cut_img2 = img2.crop(part2)
|
cut_img2 = img2.crop(part2)
|
||||||
|
|
||||||
|
#调用替换函数
|
||||||
img1.paste(cut_img2, (10, 50, 250, 250))
|
img1.paste(cut_img2, (10, 50, 250, 250))
|
||||||
|
|
||||||
|
#定义画布
|
||||||
plt.figure("picture replace")
|
plt.figure("picture replace")
|
||||||
plt.subplot(121)
|
plt.subplot(121)
|
||||||
plt.imshow(img2)
|
plt.imshow(img2)
|
||||||
|
plt.title("Origin") # 展示原图
|
||||||
|
|
||||||
plt.subplot(122)
|
plt.subplot(122)
|
||||||
plt.imshow(img1)
|
plt.imshow(img1)
|
||||||
|
plt.title("replaced picture") #展示替换后的图
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
# 保存 替换后的图片
|
||||||
Image.fromarray(np.uint8(img1)).save(root + 'picture12.jpg')
|
Image.fromarray(np.uint8(img1)).save(root + 'picture12.jpg')
|
||||||
return img1
|
return img1
|
||||||
|
32
Image_Mix.py
32
Image_Mix.py
@ -4,22 +4,36 @@
|
|||||||
# @Email : derighoid@gmail.com
|
# @Email : derighoid@gmail.com
|
||||||
# @File : Image_Mix.py
|
# @File : Image_Mix.py
|
||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
|
import PIL
|
||||||
from PIL import Image
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cv2
|
from PIL import Image
|
||||||
|
|
||||||
|
'''
|
||||||
|
img1:图片对象1
|
||||||
|
img2:图片对象2
|
||||||
|
alpha:透明度 ,取值范围为 0 到 1,当取值为 0 时,输出图像相当于 image1 的拷贝,而取值为 1 时,
|
||||||
|
则是 image2 的拷贝,只有当取值为 0.5 时,才为两个图像的中合。因此改值的大小决定了两个图像的混合程度'''
|
||||||
|
|
||||||
|
|
||||||
# 阿尔法图像混合
|
# 阿尔法图像混合
|
||||||
def imageMix(imagePath1, imagePath2):
|
def imageMix(imagePath1, imagePath2):
|
||||||
|
'''
|
||||||
|
|
||||||
|
:param imagePath1: 混合图片1的地址
|
||||||
|
:param imagePath2: 混合图像2的地址
|
||||||
|
:return: 混合后的图像
|
||||||
|
'''
|
||||||
|
|
||||||
|
# 获取两张图片
|
||||||
img1 = Image.open(imagePath1)
|
img1 = Image.open(imagePath1)
|
||||||
im1 = np.array(img1)
|
|
||||||
img2 = Image.open(imagePath2)
|
img2 = Image.open(imagePath2)
|
||||||
im2 = np.array(img2)
|
# 调用图片混合函数
|
||||||
|
img3 = PIL.Image.blend(img1, img2, 0.5) # 0.5 为gamma 值
|
||||||
img3 = cv2.addWeighted(im1, 0.8, im2, 0.3, 0)
|
|
||||||
|
|
||||||
|
# 展示混合后的图片
|
||||||
plt.imshow(img3)
|
plt.imshow(img3)
|
||||||
|
|
||||||
|
# 保存图片
|
||||||
Image.fromarray(np.uint8(img3)).save("./data/picture14.png")
|
Image.fromarray(np.uint8(img3)).save("./data/picture14.png")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,12 +41,13 @@ class modfifyImage():
|
|||||||
# 显示图像三通道颜色
|
# 显示图像三通道颜色
|
||||||
def img_RGB(self):
|
def img_RGB(self):
|
||||||
root="E:\\桌面\\Python_Picture_Analysis\\data\\" # 图片保存地址
|
root="E:\\桌面\\Python_Picture_Analysis\\data\\" # 图片保存地址
|
||||||
red = self.imageMatrix().copy()
|
red = self.imageMatrix().copy() # 图片复制
|
||||||
red[:, :, 1:3] = 0
|
red[:, :, 1:3] = 0
|
||||||
green = self.imageMatrix().copy()
|
green = self.imageMatrix().copy()
|
||||||
green[:, :, ::2] = 0
|
green[:, :, ::2] = 0
|
||||||
blue = self.imageMatrix().copy()
|
blue = self.imageMatrix().copy()
|
||||||
blue[:, :, :2] = 0
|
blue[:, :, :2] = 0
|
||||||
|
# 定义画布 多图合并显示
|
||||||
x, y = plt.subplots(2, 2)
|
x, y = plt.subplots(2, 2)
|
||||||
x.set_size_inches(10, 10)
|
x.set_size_inches(10, 10)
|
||||||
y[0, 0].imshow(self.imageMatrix())
|
y[0, 0].imshow(self.imageMatrix())
|
||||||
|
@ -11,7 +11,7 @@ import os
|
|||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
#定义 图片方向改变类
|
||||||
class directionChanges():
|
class directionChanges():
|
||||||
def __init__(self, filePath):
|
def __init__(self, filePath):
|
||||||
self.filePath = filePath
|
self.filePath = filePath
|
||||||
@ -64,10 +64,11 @@ class directionChanges():
|
|||||||
|
|
||||||
# 保存图片
|
# 保存图片
|
||||||
def img_Save(self):
|
def img_Save(self):
|
||||||
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
root = "E:\\桌面\\Python_Picture_Analysis\\data\\" # 图片保存地址
|
||||||
if not os.path.exists(root):
|
if not os.path.exists(root): # 判断是否已经存在该文件
|
||||||
os.mkdir(root)
|
os.mkdir(root) #没有就创建
|
||||||
else:
|
else:
|
||||||
|
#图片保存
|
||||||
Image.fromarray(np.uint8(self.imageRepetition())).save(root+'picture4'+'.jpg')
|
Image.fromarray(np.uint8(self.imageRepetition())).save(root+'picture4'+'.jpg')
|
||||||
Image.fromarray(np.uint8(self.mirrorSymmetry())).save(root+'picture5'+'.jpg')
|
Image.fromarray(np.uint8(self.mirrorSymmetry())).save(root+'picture5'+'.jpg')
|
||||||
Image.fromarray(np.uint8(self.verticalSummetry_right())).save(root+'picture6'+'.jpg')
|
Image.fromarray(np.uint8(self.verticalSummetry_right())).save(root+'picture6'+'.jpg')
|
||||||
|
36
PictureCrawling/Picture _Crawling.py
Normal file
36
PictureCrawling/Picture _Crawling.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# @Time : 2022-7-24 0024 11:18
|
||||||
|
# @Author : Qing
|
||||||
|
# @Email : derighoid@gmail.com
|
||||||
|
# @File : Picture _Crawling.py
|
||||||
|
# @Software: PyCharm
|
||||||
|
|
||||||
|
# 导入库
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
# path = '(?<=<img(?:.*)\s+src=")[^"]+(\.png|jpg|jpeg)'
|
||||||
|
# 定义函数
|
||||||
|
def pictureCrawl(url):
|
||||||
|
# 文件保存地址
|
||||||
|
root = "E://桌面//Python_Picture_Analysis//data//"
|
||||||
|
# 文件的保存地址以及格式
|
||||||
|
path = root + url.split('/')[-3] + '.png'
|
||||||
|
try:
|
||||||
|
if not os.path.exists(root): # 判断是否存在文件夹
|
||||||
|
os.mkdir(root)
|
||||||
|
if not os.path.exists(path): # 判断是否存在该文件
|
||||||
|
r = requests.get(url)
|
||||||
|
# 文件写入
|
||||||
|
with open(path, 'wb') as fp:
|
||||||
|
fp.write(r.content)
|
||||||
|
print("OK")
|
||||||
|
else:
|
||||||
|
print("File already exists")
|
||||||
|
except:
|
||||||
|
print("Crawl successful")
|
||||||
|
|
||||||
|
#图片URL
|
||||||
|
url = "https://tse2-mm.cn.bing.net/th/id/OIP-C.fT7uKiT7V7YO2PPINFeOdQHaJ4?w=186&h=248&c=7&r=0&o=5&dpr=1.25&pid=1.7"
|
||||||
|
pictureCrawl(url)
|
@ -50,9 +50,10 @@ class pictureRead(object):
|
|||||||
|
|
||||||
# 图片plt展示
|
# 图片plt展示
|
||||||
def plt_image(self):
|
def plt_image(self):
|
||||||
|
plt.subplot(121)
|
||||||
# 原图片显示
|
# 原图片显示
|
||||||
plt.imshow(self.imageMatrix())
|
plt.imshow(self.imageMatrix())
|
||||||
plt.show()
|
plt.subplot(122)
|
||||||
# 灰色图片显示
|
# 灰色图片显示
|
||||||
plt.imshow(self.imageGrey())
|
plt.imshow(self.imageGrey())
|
||||||
plt.show()
|
plt.show()
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from PIL import Image
|
|
||||||
from Picture_Reading import *
|
from Picture_Reading import *
|
||||||
|
|
||||||
|
|
||||||
class ReduceColor(pictureRead):
|
class ReduceColor(pictureRead):
|
||||||
def __init__(self,filePath):
|
def __init__(self, filePath):
|
||||||
self.filePath=filePath
|
self.filePath = filePath
|
||||||
|
|
||||||
def readImg(self):
|
def readImg(self):
|
||||||
face4=Image.open(self.filePath)
|
face4 = Image.open(self.filePath)
|
||||||
return face4
|
return face4
|
||||||
|
|
||||||
def imageMatrix(self):
|
def imageMatrix(self):
|
||||||
@ -25,36 +25,105 @@ class ReduceColor(pictureRead):
|
|||||||
|
|
||||||
# 减色算法
|
# 减色算法
|
||||||
def decrease_color(self):
|
def decrease_color(self):
|
||||||
out=self.imageMatrix().copy()
|
'''
|
||||||
out=out//64*64+32
|
val=|32 (0<=var<64)
|
||||||
Image.fromarray((np.uint8(out))).save("E:\\桌面\\Python_Picture_Analysis\\data\\picture8.jpg")
|
|96 (64<=var<128)
|
||||||
return out
|
|160 (128<=var<192)
|
||||||
|
|224 (192<=var<256)
|
||||||
|
:return:
|
||||||
|
'''
|
||||||
|
img = self.imageMatrix().copy()
|
||||||
|
# img=img//64*64+32
|
||||||
|
H = img.shape[0] # 获取图片的高
|
||||||
|
W = img.shape[1] # 获取图片的宽
|
||||||
|
|
||||||
# 展示图片
|
# 创建新的图
|
||||||
def plt_Img(self):
|
newImg = np.zeros((H, W, 3), np.uint8)
|
||||||
plt.imshow(self.decrease_color())
|
newImg2 = np.zeros((H, W, 3), np.uint8)
|
||||||
|
newImg3 = np.zeros((H, W, 3), np.uint8)
|
||||||
|
|
||||||
|
# 量化操作
|
||||||
|
for i in range(H):
|
||||||
|
for j in range(W):
|
||||||
|
for k in range(3): # RGB三分量
|
||||||
|
if img[i, j][k] < 128:
|
||||||
|
gray = 0
|
||||||
|
else:
|
||||||
|
gray = 128
|
||||||
|
newImg[i, j][k] = np.uint8(gray) # 传给新图片
|
||||||
|
|
||||||
|
for i in range(H):
|
||||||
|
for j in range(W):
|
||||||
|
for k in range(3):
|
||||||
|
if img[i, j][k] < 64:
|
||||||
|
gray = 0
|
||||||
|
elif img[i, j][k] < 128:
|
||||||
|
gray = 64
|
||||||
|
elif img[i, j][k] < 192:
|
||||||
|
gray = 128
|
||||||
|
else:
|
||||||
|
gray = 192
|
||||||
|
newImg2[i, j][k] = np.uint8(gray)
|
||||||
|
|
||||||
|
for i in range(H):
|
||||||
|
for j in range(W):
|
||||||
|
for k in range(3):
|
||||||
|
if newImg3[i, j][k] < 32:
|
||||||
|
gray = 0
|
||||||
|
elif newImg3[i, j][k] < 96:
|
||||||
|
gray = 32
|
||||||
|
elif newImg3[i, j][k] < 96:
|
||||||
|
gray = 96
|
||||||
|
elif newImg3[i, j][k] < 128:
|
||||||
|
gray = 96
|
||||||
|
elif newImg3[i,j][k]<160:
|
||||||
|
gray=128
|
||||||
|
elif newImg3[i,j][k]<192:
|
||||||
|
gray=160
|
||||||
|
elif newImg3[i,j][k]<244:
|
||||||
|
gray=192
|
||||||
|
else:
|
||||||
|
gray = 224
|
||||||
|
newImg3[i, j][k] = np.uint8(gray)
|
||||||
|
|
||||||
|
#定义画布
|
||||||
|
plt.figure(figsize=(16,8))
|
||||||
|
plt.subplot(141)
|
||||||
|
plt.imshow(img)
|
||||||
|
plt.title("origin")
|
||||||
|
|
||||||
|
plt.subplot(142)
|
||||||
|
plt.imshow(newImg)
|
||||||
|
plt.title("1")
|
||||||
|
|
||||||
|
plt.subplot(143)
|
||||||
|
plt.imshow(newImg2)
|
||||||
|
plt.title("2")
|
||||||
|
|
||||||
|
plt.subplot(144)
|
||||||
|
plt.imshow(newImg3)
|
||||||
|
plt.title("3")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
return newImg,newImg2,newImg3
|
||||||
|
|
||||||
|
# 图像二值化(以128为阈值进行二值化)
|
||||||
#图像二值化(以128为阈值进行二值化)
|
|
||||||
def imgBinarization(self):
|
def imgBinarization(self):
|
||||||
a=self.imageGrey()-np.array([[128]])
|
a = self.imageGrey() - np.array([[128]])
|
||||||
b=np.floor(a/np.array([[256]]))
|
b = np.floor(a / np.array([[256]]))
|
||||||
c=b+np.array([[1]],dtype=np.int16)
|
c = b + np.array([[1]], dtype=np.int16)
|
||||||
bfilter=c.astype("uint8")
|
bfilter = c.astype("uint8")
|
||||||
result=bfilter*np.array([[255]],dtype=np.uint8)
|
result = bfilter * np.array([[255]], dtype=np.uint8)
|
||||||
# result=np.array(self.readImg().convert("1"))
|
# result=np.array(self.readImg().convert("1"))
|
||||||
plt.imshow(result)
|
plt.imshow(result)
|
||||||
plt.show()
|
plt.show()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
#保存图片
|
# 保存图片
|
||||||
def img_Save(self):
|
def img_Save(self):
|
||||||
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
root = "E:\\桌面\\Python_Picture_Analysis\\data\\"
|
||||||
if not os.path.exists(root):
|
if not os.path.exists(root):
|
||||||
os.mkdir(root)
|
os.mkdir(root)
|
||||||
else:
|
else:
|
||||||
Image.fromarray(np.uint8(self.decrease_color())).save(root + 'picture8'+'.jpg')
|
Image.fromarray(np.uint8(self.decrease_color)).save(root + 'picture8' + '.jpg')
|
||||||
Image.fromarray(np.uint8(self.imgBinarization())).save(root + 'picture9'+'.jpg')
|
Image.fromarray(np.uint8(self.imgBinarization())).save(root + 'picture9' + '.jpg')
|
||||||
print("Picture Save successfully")
|
print("Picture Save successfully")
|
||||||
|
|
||||||
|
32
main.py
32
main.py
@ -10,17 +10,22 @@ from Modify_Pixels import *
|
|||||||
from Orientation_Modification import *
|
from Orientation_Modification import *
|
||||||
from Subtractive_Algorithm import *
|
from Subtractive_Algorithm import *
|
||||||
from Image_Mix import *
|
from Image_Mix import *
|
||||||
|
from Blue_noise_sampling import *
|
||||||
|
from Image_Capture import *
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 图片读取
|
# 图片读取
|
||||||
picture_read = pictureRead('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg')
|
picture_read = pictureRead('E:\\桌面\\Python_Picture_Analysis\\data\\th.png')
|
||||||
# picture_read.plt_image()
|
#图片展示
|
||||||
|
picture_read.plt_image()
|
||||||
|
|
||||||
|
|
||||||
# 图片修改
|
# 图片修改
|
||||||
modif_image = modfifyImage('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg')
|
modif_image = modfifyImage('E:\\桌面\\Python_Picture_Analysis\\data\\th.png')
|
||||||
# print(modif_image.img_RGB())
|
# print(modif_image.img_RGB())
|
||||||
|
|
||||||
# 图片方向修改
|
# 图片方向修改
|
||||||
direction_Changes = directionChanges('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg')
|
direction_Changes = directionChanges('E:\\桌面\\Python_Picture_Analysis\\data\\th.png')
|
||||||
# direction_Changes.verticalSummetry_right()
|
# direction_Changes.verticalSummetry_right()
|
||||||
# direction_Changes.verticalSummetry_lift()
|
# direction_Changes.verticalSummetry_lift()
|
||||||
# direction_Changes.mirrorSymmetry()
|
# direction_Changes.mirrorSymmetry()
|
||||||
@ -28,8 +33,8 @@ if __name__ == '__main__':
|
|||||||
# direction_Changes.img_Save()
|
# direction_Changes.img_Save()
|
||||||
|
|
||||||
# 减色算法
|
# 减色算法
|
||||||
reduce_color = ReduceColor('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg')
|
reduce_color = ReduceColor('E:\\桌面\\Python_Picture_Analysis\\data\\th.png')
|
||||||
# reduce_color.plt_Img()
|
# reduce_color.decrease_color()
|
||||||
# reduce_color.img_Save()
|
# reduce_color.img_Save()
|
||||||
# reduce_color.imgBinarization()
|
# reduce_color.imgBinarization()
|
||||||
|
|
||||||
@ -38,12 +43,17 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# 图片截取
|
# 图片截取
|
||||||
# left, upper, right, lower
|
# left, upper, right, lower
|
||||||
# imgCut('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg',20,10,190,190)
|
imgCut('E:\\桌面\\Python_Picture_Analysis\\data\\th.png',20,10,190,190)
|
||||||
# imgCut('E:\\桌面\\Python_Picture_Analysis\\data\\picture.jpg',30,70,230,230)
|
imgCut('E:\\桌面\\Python_Picture_Analysis\\data\\picture.png',30,70,230,230)
|
||||||
|
|
||||||
# 图片替换
|
# 图片替换
|
||||||
# imgReplace('E:\\桌面\\Python_Picture_Analysis\\data\\th.jpg', "E:\\桌面\\Python_Picture_Analysis\\data\\picture.jpg",
|
imgReplace('E:\\桌面\\Python_Picture_Analysis\\data\\th.png', "E:\\桌面\\Python_Picture_Analysis\\data\\picture.png",
|
||||||
# 10, 50, 250, 250)
|
10, 50, 250, 250)
|
||||||
|
|
||||||
# 阿尔法混合
|
# 阿尔法混合
|
||||||
# imageMix('E:\\桌面\\Python_Picture_Analysis\\data\\th.png','E:\\桌面\\Python_Picture_Analysis\\data\\picture.png')
|
imageMix('E:\\桌面\\Python_Picture_Analysis\\data\\th.png','E:\\桌面\\Python_Picture_Analysis\\data\\picture.png')
|
||||||
|
|
||||||
|
#蓝噪
|
||||||
|
showImage("./data/th.png")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user