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

本站现有博文332篇,共被浏览869512

本站已经建立2578天!

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