我在我的docker文件中使用以下代码进行视频流 import numpy as np
import cv2
cap = cv2.VideoCapture(0)
# Define the codec and create VideoWriter object
#fourcc = cv.VideoWriter_fourcc(*'XVID')
total_frame=0
while cap.isOpened():
ret, frame = cap.read()
print(ret)
if not ret:
print("Can
在docker-Compose.yml中定义这样的设备映射时:
version: "3.8"
services:
app:
build: .
devices:
- /dev/video0:/dev/video0
如果在您的主机系统上启动此容器而没有/dev/video0 0,容器将崩溃,导致以下错误:
Error response from daemon: error gathering device information while adding custom device "/dev/video0": no such fi
我正在跟踪,试图从网络摄像头上读取一段视频。当我从文档中运行这段代码时:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
我有一个小的busybox系统,我为它编译了内核,并添加了对USB摄像头的支持。当我将摄像头连接到设备时,它会给我一些输出,我得到了一个/dev/video0设备:
usb 1-1: new high-speed USB device number 3 using orion-ehci
uvcvideo: Found UVC 1.00 device Webcam C170 (046d:082b)
input: Webcam C170 as /devices/platform/orion-ehci.0/usb1/1-1/1-1:1.0/input/input1
/ # ls -l /dev/v
我遵循了本教程:
我成功地将我的USB摄像头与我的WSL2连接起来,但无法打开相机。
$lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:08cb Logitech, Inc. Mic (Notebooks Pro)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
我的摄像头是Logitech公司的麦克风(笔记本专业),我的程序:
import numpy as np
imp