EADST

Put Rectangle and Text in Video with OpenCV

Put Rectangle and Text in Video with OpenCV

# coding=UTF-8
import cv2
def generate_video(video_name):    
    video = "{}.mp4".format(video_name)
    result_video = "./video_label/{}.mp4".format(video_name)

    cap = cv2.VideoCapture(video)
    fps_video = cap.get(cv2.CAP_PROP_FPS)
    fourcc = cv2.VideoWriter_fourcc(*"mp4v")
    frame_width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
    frame_height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
    videoWriter = cv2.VideoWriter(result_video, fourcc, fps_video, (frame_width, frame_height))
    while (cap.isOpened()):
        ret, frame = cap.read()
        if ret == True:
            # You need to change the following two lines.
            cv2.rectangle(frame, (left_x_up, left_y_up), (right_x_down, right_y_down), (55,255,155), 5)
            cv2.putText(frame, "Hello World!", (word_x, word_y), cv2.FONT_HERSHEY_SIMPLEX, 1, (55,255,155), 2)
            videoWriter.write(frame)
        else:
            videoWriter.release()
            break
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Data uWSGI ONNX CAM Anaconda v2ray 实时视觉生成 AI Translation ModelScope Quantization Color VPN OpenCV Statistics TensorFlow 算法题 Bert logger Website RGB hf ms-swift IndexTTS2 个人博客 Domain Sklearn Python InvalidArgumentError Vim Jupyter WebCrawler Docker LeetCode 继承 Plotly RL Llama FP32 Video scipy Jev Git 云服务器 Nginx 论文 Quantize transformers 自我改进 Disk 关于博主 SQLite Hotel TSV FlashAttention Knowledge NameSilo 高效序列架构 CEIR Image2Text 域名 GPT4 VGG-16 Vmess Qwen2 Qwen2.5 SPIE NLP Distillation Jetson XGBoost CUDA 强化学习 Algorithm 顶会 Food News 证件照 BeautifulSoup tqdm CV 飞书 FP16 音频 Hilton Linux Paper YOLO SQL Transformers ResNet-50 Pytorch Bitcoin FP64 腾讯云 API网关 EXCEL Augmentation LLAMA Michelin ChatGPT DeepStream Claude HuggingFace Github 图形思考法 Streamlit Permission HaggingFace Windows Input RAR UI git 论文速读 Miniforge Diagram Zip Magnet Agent Search Land Tensor mmap Baidu Ubuntu Numpy GPTQ BTC OpenAI Datetime Breakpoint FP8 Dataset C++ Cloudreve printf Django uwsgi LaTeX Web Interview CLAP PDB Ptyhon COCO XML Base64 VSCode 国产算力 CTC TTS Tracking Freesound FastAPI JSON LoRA 递归学习法 Markdown Firewall Gemma Harness 版权 Tiktoken Card 长程智能体 UNIX 信用卡 Bipartite WAN Conda icon Bin API GGML MD5 Use SVR Pickle CSV 具身控制 Clash LLM PyTorch v0.dev Paddle 多进程 Excel Review 长期记忆 多线程 llama.cpp Heatmap Pillow PyCharm NLTK Hungarian 图标 Math Password Proxy Random Safetensors 签证 GoogLeNet 财报 Plate tar GIT SAM 第一性原理 Pandas Qwen Logo PIP OCR Rebuttal 阿里云 Shortcut PDF DeepSeek git-lfs Crawler Mixtral Template Google TensorRT 报税 diffusers torchinfo 净利润 Attention 搞笑 CC Animate BF16 公式 QWEN
站点统计

本站现有博文342篇,共被浏览1059211次

本站已经建立2731天!

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