当前位置:网站首页>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
边栏推荐
- 7-3 poly width
- Unity games and related interview questions
- Un aperçu des flux d'E / s et des opérations de fichiers de classe de fichiers
- Codeforces Round #784 (Div. 4)題解 (第一次AK cf (XD
- Visual programming -- how to customize the mouse cursor
- JS changes the words separated by dashes into camel style
- When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
- 标识符、关键字、数据类型
- Design and implementation of redis (1): understand data structures and objects
- 对象和类的概念
猜你喜欢
![Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]](/img/1a/a22b4a35d3c083438d0f766a5ecb08.png)
Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]

When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director

Codeforces Round #784 (Div. 4)題解 (第一次AK cf (XD

7-1 introduction to finance

Visual programming - Experiment 1

Optimization of especially slow startup in idea debugging mode

C abstract class

STM32 advanced timer com event

you need to be root to perform this command
![[microservices] (x) -- Unified gateway](/img/f8/0c4516a802086cbe4031183b27a775.jpg)
[microservices] (x) -- Unified gateway
随机推荐
The fourth operation
Batch download of files ---- compressed and then downloaded
MySQL query specifies that a row is sorted to the first row
JS calculates the display date according to the time
2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
Development record of primary sensitive word detection
Application and definition of interface
Super easy to use asynchronous export function of Excel
标识符、关键字、数据类型
Leetcode punch in diary day 01
2021-08-11
打卡:4.22 C语言篇 -(1)初识C语言 - (11)指针
Seekbar custom style details
Test questions (2)
Codeforces Round #784 (Div. 4)題解 (第一次AK cf (XD
There is no index in the database table. When inserting data, SQL statements are used to prevent repeated addition (Reprint)
7-1 introduction to finance
7-2 Tushare
Section 2 map and structure in Chapter 6
Using jsonserialize to realize data type conversion gracefully