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

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

本站已经建立2537天!

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