当前位置:网站首页>Picture synthesis video
Picture synthesis video
2022-04-23 03:36:00 【Crispy eggplant strips】
# -*- coding: UTF-8 -*-
import glob
import os
import cv2
import time
# Picture synthesis video
def picvideo(path, size):
filelist = os.listdir(path) # Get all file names in this directory
filelist.sort(key=lambda x: int(x[:-4])) ## File names are sorted by number
''' fps: Frame rate :1 Seconds n Write in a picture [ Control a picture to stay 5 Second , That's the frame rate 1, Repeat this picture 5 Time ] If there is 50 Zhang 534*300 Pictures of the , Set up here 1 Seconds to play 5 Zhang , So the duration of this video is 10 second '''
fps = 30
# file_path = str(int(time.time())) + ".mp4" # export path
file_path = "2.mp4"
fourcc = cv2.VideoWriter_fourcc('M', 'P', '4', 'V') # Different video codes correspond to different video formats ( example :'I','4','2','0' Corresponding avi Format )
video = cv2.VideoWriter(file_path, fourcc, fps, size)
for item in filelist:
item = os.path.join(os.getcwd(),path,item)
img = cv2.imread(item) # Use opencv Read images , Go straight back to numpy.ndarray object , The channel order is BGR , Note that BGR, Default range of channel values 0-255.
# cv2.imshow("img",img)
# cv2.waitKey(0)
video.write(img) # Write the picture into the video
video.release() # Release
picvideo('imgs_wu', (720, 1280))
版权声明
本文为[Crispy eggplant strips]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220602451653.html
边栏推荐
- Problem C: realize Joseph Ring with linked list
- Optimization of especially slow startup in idea debugging mode
- . net 5 Web custom middleware implementation returns the default picture
- Using swagger in. Net5
- List interface of collection
- Applet - more than two pieces of folding and expansion logic
- Chapter 8 exception handling, string handling and file operation
- Unity basics 2
- Basic use of Charles
- 2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
猜你喜欢
Development record of primary sensitive word detection
Applet - WXS
7-1 introduction to finance
Section 1 array and slicing in Chapter 6
C abstract class
Design and implementation of redis (2): how to handle expired keys
【微服务】(十)—— 统一网关Gateway
Unity knowledge points (ugui 2)
Punch in: 4.22 C language chapter - (1) first knowledge of C language - (11) pointer
QT dynamic translation of Chinese and English languages
随机推荐
. net 5 Web custom middleware implementation returns the default picture
QT uses drag and drop picture to control and mouse to move picture
Chapter VI, Section III pointer
Common exceptions
Application and definition of interface
L3-011 direct attack Huanglong (30 points)
Mechanical design knowledge point planning
Applet - WXS
Redis(17) -- Redis缓存相关问题解决
標識符、關鍵字、數據類型
Concepts of objects and classes
Software testing process
The principle and solution of not allowing pasting in an English Network
Deep learning notes (II) -- principle and implementation of activation function
标识符、关键字、数据类型
Design and implementation of redis (1): understand data structures and objects
Problem C: realize Joseph Ring with linked list
批量下載文件----壓縮後再下載
There is no index in the database table. When inserting data, SQL statements are used to prevent repeated addition (Reprint)
Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation