This commit is contained in:
Semi212 committed 2022-04-28 22:02:20 +08:00
1 parent 54ccfb11fe
commit a0818377bb
194 files changed
+41681 -262

No files matched your search

+27 -1
View File
@@ -35,6 +35,32 @@ def images_to_video(InputPath, OutputPath):
for i in range(len(img_array)):
out.write(img_array[i])
out.release()
def images_to_video_bigtosmall(InputPath, OutputPath):
img_array = []
img_list = [os.path.join(InputPath,nm) for nm in os.listdir(InputPath) if 1]
img_list.sort()
i=0
for filename in img_list:
print(i)
i+=1
img = cv2.imread(filename)
if i == 1:
ImgHeight = np.shape(img)[0]
ImgWidth = np.shape(img)[1]
if img is None:
print(filename + " is error!")
continue
img_array.append(img)
if (i % 1500)==0:
# 图片的大小需要一致
#img_array, size = resize(img_array, 'largest')
fps = 25
out = cv2.VideoWriter(OutputPath.replace("Detectionnew1","Detectionnew1{}".format(str(i))), cv2.VideoWriter_fourcc(*'DIVX'), fps, (ImgWidth,ImgHeight))
for j in range(len(img_array)):
out.write(img_array[j])
out.release()
def images_to_video_big(InputPath, OutputPath):
img_array = []
img_list = [os.path.join(InputPath,nm) for nm in os.listdir(InputPath) if 1]
@@ -75,6 +101,6 @@ def images_to_video_big(InputPath, OutputPath):
if __name__ == "__main__":
T1 = time.time()
images_to_video('../data_MPKFNet/result/images', '../data_MPKFNet/result_vedio/images.avi')
images_to_video('../2', './test.avi')
T2 = time.time()
print("chengxuyunxingshijian is ",(T2-T1)*1000)