首页 > 解决方案 > 使用python控制平移倾斜和变焦相机

问题描述

我试过控制 PTZ camera pro 2,但视频流和云台仍然不能一起工作。也许有人可以解决这个问题。欢迎反馈和建议。

这是使用python语言控制云台摄像机的完整代码。 https://github.com/deviraanggi/Logitech-PTZ-Pro-2-Control

蟒蛇3

from ctypes import *
import time
import ctypes
import clr
import os
import sys
import cv2
import PTZ
import clr
clr.AddReference('cobabikindll')
import PTZ
from PTZ import PTZDevicess, PTZType
device = PTZDevicess.GetDevice("PTZ Pro 2", PTZType.Absolute);
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
    cv2.imshow('frame',gray)
    #device.Move(-1, 1)
    device.MoveInternal(30,35)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()

标签: python-3.ximage-processingcamerapython-multithreadinglogitech

解决方案


推荐阅读