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

本站现有博文333篇,共被浏览916219

本站已经建立2621天!

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