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

本站现有博文312篇,共被浏览744419

本站已经建立2387天!

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