小编Mas*_*erJ的帖子

Opencv如何在视频上叠加文字

我想添加一些文本以显示在我的网络摄像头的视频上,但我似乎无法理解。我之前使用 Opencv 向图像添加了文本,但视频的方法似乎不同,所以我将如何去做。这是我的网络摄像头脚本:

import cv2
import numpy as np

# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file name
cap = cv2.VideoCapture(0)

# Check if camera opened successfully
if (cap.isOpened()== False): 
  print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened()):
  # Capture frame-by-frame
  ret, frame = cap.read()
  if ret == True:

    # Display the resulting frame
    cv2.imshow('Frame',frame)

    # Press Q on …
Run Code Online (Sandbox Code Playgroud)

video text opencv overlay

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

opencv ×1

overlay ×1

text ×1

video ×1