Giter VIP home page Giter VIP logo

pyptz's Introduction

PTZ Camera Control using Python

This library is designed to control PTZ cameras using the ONVIF, VAPIX and SUNAPI.

ONVIF (Open Network Video Interface Forum) is a global and open industry forum with the goal of facilitating the development and use of a global open standard for the interface of physical IP-based security products. ONVIF creates a standard for how IP products within video surveillance and other physical security areas can communicate with each other. ONVIF is an organization started in 2008 by Axis Communications, Bosch Security Systems and Sony.

VAPIX® is Axis Camera API.

SUNAPI® is Hanwha Camera API.

Installation

pip install pyptz

ONVIF

from pyptz.onvif_control import ONVIFCamera

onvif_camera = ONVIFCamera('192.168.1.100', '88', 'admin', 'password')
pan, tilt, zoom = onvif_camera.get_ptz_status()
print(pan, tilt, zoom)

VAPIX

from pyptz.vapix_control import VAPIXCamera

vapix_camera = VAPIXCamera('192.168.1.100', 'admin', 'password')
pan, tilt, zoom = vapix_camera.get_ptz_status()
print(pan, tilt, zoom)

SUNAPI

from pyptz.sunapi_control import SUNAPICamera

sunapi_camera = SUNAPICamera('192.168.1.100', 'admin', 'password')
pan, tilt, zoom = sunapi_camera.get_ptz_status()[:3]
print(pan, tilt, zoom)

pyptz's People

Contributors

jahongir7174 avatar

Stargazers

 avatar  avatar  avatar

pyptz's Issues

Wrong ONVIF token with Vivotek SD9161

Hi,

I stumbled upon media.GetProfiles()[0] returning a set instead of a token string and the SOAP library complaining about a type mismatch. Camera model is a Vivotek SD9161.

The following patch worked for me.

diff --git a/pyptz/onvif_control.py b/pyptz/onvif_control.py
index 89bacb7..329a25f 100644
--- a/pyptz/onvif_control.py
+++ b/pyptz/onvif_control.py
@@ -13,7 +13,7 @@ class ONVIFCamera:
         media = camera.create_media_service()
 
         self.__ptz = ptz
-        self.__token = media.GetProfiles()[0]
+        self.__token = media.GetProfiles()[0]['token']
 
     def absolute_move(self, pan: float, tilt: float, zoom: float):
         """

I didn't bother to include a type check. In fact there are no checks at all for if the thing returned is actually a set and has a key "token". So regard this as an real world example of a working config for this particular camera model and maybe integrate it with the necessary checks and a branch to old behavior if thing returned was a string and not a set.

Best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.