quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
474 stars 321 forks source link

Zoom in/Out example #57

Open delucaide opened 6 years ago

delucaide commented 6 years ago

Goodmorning, could anybody send here an example on how can do the zoom movement for an ip camera? i didn't understand on how can write the correctly sentence.

thanks

Vorobeyko commented 6 years ago

` I did so

class AbsoluteMove:
    def __init__(self, endpoint, ProfileToken, Pan, Tilt, Zoom):
        self._endpoint = endpoint
        self.profile_token = ProfileToken
        self.Pan = Pan
        self.Tilt = Tilt
        self.Zoom = Zoom
        self._ptz_service = self._endpoint.create_ptz_service()

    def send_request(self):
        absolute_move_service = self._ptz_service.create_type('ns0:', 'AbsoluteMove')
        obj = {
            'ProfileToken': self.profile_token,
            'Position': {
                'PanTilt':{
                    'x': self.Pan,
                    'y': self.Tilt
                },
                'Zoom':{
                    'x': self.Zoom
                }
            }
        }
        absolute_move = self._ptz_service.AbsoluteMove(obj )
        return absolute_move`