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

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

本站已经建立2538天!

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