EADST

Python: Get Frames from the Video with OpenCV

Python: Get Frames from the Video with OpenCV

import os
import cv2

video_path = "test.mp4"
video_name = os.path.basename(video_path)
cap = cv2.VideoCapture(video_path)
save_dir = os.path.join('./result', video_name)
success, frame = cap.read()
frame_index = 1
save_format = 'img{:06d}.jpg' 
while success:
    frame_path = os.path.join(save_dir, save_format.format(frame_index))
    cv2.imwrite(frame_path, frame)
    frame_index += 1
    success, frame = cap.read()
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Cloudreve Windows Plotly CV Quantization 阿里云 关于博主 UI Shortcut Python HaggingFace API 证件照 SQLite PyTorch Zip ONNX GPTQ Pytorch Claude CUDA NLP Docker Jupyter OpenCV SVR OpenAI PIP LaTeX DeepSeek Bitcoin Bert Animate uwsgi Datetime 净利润 FP8 Domain 签证 Tiktoken Statistics Tensor Disk Excel Jetson Paddle Mixtral Gemma Breakpoint Interview WebCrawler printf 云服务器 git-lfs NLTK Git Color SPIE XML Github Bin 多线程 WAN FlashAttention Nginx TTS Sklearn Translation 图标 Dataset 图形思考法 TensorRT Firewall Card ChatGPT Data RGB Logo 财报 FP64 Numpy Paper Augmentation LLM v2ray Qwen2.5 QWEN 论文速读 Knowledge Crawler MD5 Video Magnet FastAPI LeetCode DeepStream 公式 Land Hungarian Anaconda LoRA BF16 Permission BeautifulSoup PDF llama.cpp GGML 顶会 Transformers Diagram FP32 Distillation Quantize BTC Plate Food ModelScope Freesound Qwen UNIX SQL Use 强化学习 torchinfo 版权 Linux Proxy 音频 Agent NameSilo CC 算法题 Heatmap Image2Text GPT4 Streamlit Pickle Rebuttal Attention CLAP 腾讯云 icon Base64 transformers v0.dev Ptyhon YOLO 报税 git Random Baidu AI Conda hf Tracking tar PDB 论文 Vmess CTC GoogLeNet COCO Template logger 多进程 Hilton tqdm Pillow Web Safetensors Website ResNet-50 Llama LLAMA CEIR 递归学习法 HuggingFace Django Algorithm FP16 diffusers Input Michelin PyCharm VGG-16 OCR 搞笑 Qwen2 mmap Review Password VSCode EXCEL 第一性原理 Ubuntu Math RAR C++ GIT Google Vim CSV Markdown Clash 域名 飞书 Pandas TSV JSON Search 继承 IndexTTS2 CAM scipy Miniforge TensorFlow News Bipartite Hotel VPN InvalidArgumentError SAM XGBoost uWSGI
站点统计

本站现有博文327篇,共被浏览826476

本站已经建立2533天!

热门文章
文章归档
回到顶部