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

本站现有博文323篇,共被浏览795255

本站已经建立2493天!

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