Compare commits
3 Commits
master
...
db1aa24079
Author | SHA1 | Date |
---|---|---|
谈晓龙 | db1aa24079 | 2 years ago |
pbyhqr72x | 087664702b | 2 years ago |
pbyhqr72x | eb92fba730 | 3 years ago |
@ -0,0 +1,45 @@
|
||||
import PIL.Image
|
||||
import numpy
|
||||
import os
|
||||
import shutil
|
||||
def sum_right(path):
|
||||
img = PIL.Image.open(path)
|
||||
array = numpy.array(img)
|
||||
num = array.sum(axis=0)
|
||||
print(type(num))
|
||||
res_left = 0
|
||||
res_right = 0
|
||||
for i in range(256,512):
|
||||
res_right += num[i]
|
||||
print(res_right)
|
||||
|
||||
if __name__ == '__main__':
|
||||
dir2 = r"C:\Users\xinluo\PycharmProjects\pythonProject\Camera Roll"
|
||||
dir1 = r"C:\Users\xinluo\PycharmProjects\pythonProject\Saved Pictures"
|
||||
names = os.listdir(dir1)
|
||||
n = len(names)
|
||||
print("文件数量",n)
|
||||
res = 0
|
||||
average_5 = 25565356
|
||||
average_25 = 26409377
|
||||
average_5_right = 10006019
|
||||
average_tmp = (average_25+average_5)//2
|
||||
count = 0
|
||||
show(os.path.join(dir1, "uni4F6C.png"))
|
||||
for i in range(n):
|
||||
#取图片
|
||||
img = PIL.Image.open(os.path.join(dir1,names[i]))
|
||||
file = os.path.join(dir1,names[i])
|
||||
rmfile = os.path.join(dir2,names[i])
|
||||
array = numpy.array(img)
|
||||
num = array.sum(axis=0)
|
||||
res_right = 0
|
||||
for i in range(256, 512):
|
||||
res_right += num[i]
|
||||
average_5_right += res_right/n
|
||||
if (res_right > average_5_right).all():
|
||||
shutil.copyfile(file, rmfile)
|
||||
os.remove(file)
|
||||
count += 1
|
||||
print(average_5_right)
|
||||
print(count)
|
Loading…
Reference in new issue