commanding ip camera(onvif-ptz-control-python)

#!/usr/bin/python

#-------------------------------------------------------------------------------
#Test of Python and Quatanium Python-ONVIF with NETCAT camera PT-PTZ2087
#ONVIF Client implementation is in Python
#For IP control of PTZ, the camera should be compliant with ONVIF Profile S
#The PTZ2087 reports it is ONVIF 2.04 but is actually 2.4 (Netcat said text not changed after upgrade)
#------------------------------------------------------------------------------

import onvifconfig

if __name__ == '__main__':

    #Do all setup initializations
    ptz = onvifconfig.ptzcam()

#*****************************************************************************
# IP camera motion tests
#*****************************************************************************
    print 'Starting tests...'

    #Set preset
    ptz.move_pan(1.0, 1)  #move to a new home position
    ptz.set_preset('home')

    # move right -- (velocity, duration of move)
    ptz.move_pan(1.0, 2)

    # move left
    ptz.move_pan(-1.0, 2)

    # move down
    ptz.move_tilt(-1.0, 2)

    # Move up
    ptz.move_tilt(1.0, 2)

    # zoom in
    ptz.zoom(8.0, 2)

    # zoom out
    ptz.zoom(-8.0, 2)

    #Absolute pan-tilt (pan position, tilt position, velocity)
    #DOES NOT RESULT IN CAMERA MOVEMENT
    ptz.move_abspantilt(-1.0, 1.0, 1.0)
    ptz.move_abspantilt(1.0, -1.0, 1.0)

    #Relative move (pan increment, tilt increment, velocity)
    #DOES NOT RESULT IN CAMERA MOVEMENT
    ptz.move_relative(0.5, 0.5, 8.0)

    #Get presets
    ptz.get_preset()
    #Go back to preset
    ptz.goto_preset('home')

    exit()

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source