python复制图片函数 python复制图片到另一个文件夹( 四 )


out = image + noise
if out.min()0:
low_clip = -1.
else:
low_clip = 0.
out = np.clip(out, low_clip, 1.0)
out = np.uint8(out * 255)
cv2.imshow("noise", out)
filename3=str(number)+'n10'+'.jpg'
【python复制图片函数 python复制图片到另一个文件夹】cv2.imwrite(savedpath + filename3, out)
# 图像亮度调节
def img_brightness(image):
contrast = 1# 对比度
brightness = 100# 亮度
pic_turn = cv2.addWeighted(image, contrast, image, 0, brightness)
# cv2.addWeighted(对象,对比度,对象,对比度)
'''cv2.addWeighted()实现的是图像透明度的改变与图像的叠加'''
cv2.imshow('bright', pic_turn)# 显示图片
filename3=str(number)+'n11'+'.jpg'
cv2.imwrite(savedpath + filename3, pic_turn)
if __name__ == '__main__':
i = 0
path = '../Data/'
print(path)
savedpath = './result_new/'
filelist = os.listdir(path)
total_num = len(filelist)
for item in filelist:
number = i + 1
i = number
print("######")
print("打印到第",i,"张图片")
src = https://www.04ip.com/post/cv2.imread(path + item)
img_translation(src)
img_scale(src)
img_flip(src)
img_rotation(src)
img_noise(src)
img_brightness(src)
cv2.waitKey(0)
cv2.destroyAllWindows()
代码较为繁琐,有空之后进行优化
输出结果
python 能用turtle进行图片复制吗?如果有的话,有实现方法吗?在执行turtle模块之前 。要确保自己的python中已经安装了Tkinter模块 。
turtle模块可以用来学习计算机是如何在屏幕上画图的 。
提供了画向量图的方法
[python] view plain copy
#!/usr/bin/python
#coding: UTF-8
import turtle
import time
# 调用turtle中的Pen函数创建画布
t = turtle.Pen()
# 画矩形
for i in range(0, 4):
# 往前画一条直线
t.forward(100)
# 左转弯90度
t.left(90)
time.sleep(1)
#time.sleep(3)
# 清空画布并把海龟放在起始位置
t.reset()
# 画两条相互平行的直线
# 往后画一条直线
t.backward(100)
# 拿起画笔,不再作画,只有遇见down函数的时候才可以继续作画
t.up()
# 右转90度
t.right(90)
# 往前移动20个像素
t.forward(20)
# 左转90度,指向和上一条线平行的方向
t.left(90)
# 放下画笔,开始作画
t.down()
# 画另一条平行线
t.forward(100)
#time.sleep(3)
t.reset()
#画等边三角形
t.forward(100)
t.left(120)
t.forward(100)
t.right(60)
t.backward(100)
time.sleep(3)
# 只清空画布,海龟仍然停留在当前的位置
#注意此时箭头所在的位置,注意与reset执行时的区别
t.clear()
下图为执行上述代码以后的结果
请点击输入图片描述
请点击输入图片描述
关于python复制图片函数和python复制图片到另一个文件夹的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读