使用Python中的Onvif协议的放大功能

时间:2019-04-26 10:38:58

标签: onvif opencv-python python-onvif

我要缩放支持onvif的CCTV。

from onvif import ONVIFCamera
from time import sleep

if __name__ == '__main__':
    mycam = ONVIFCamera('url', port, 'username', 'password',
                        wsdl_dir='/Users/akshay.shah/Downloads/Python/updated/python-onvif-zeep/wsdl')
    media = mycam.create_media_service()
    ptz = mycam.create_ptz_service()
    media_profile = media.GetProfiles()[0]
    request = ptz.create_type('GetConfigurationOptions')
    request.ConfigurationToken = media_profile.PTZConfiguration._token
    ptz_configuration_options = ptz.GetConfigurationOptions(request)
    print ptz_configuration_options
    request = ptz.create_type('AbsoluteMove')
    request.ProfileToken = media_profile._token
    request.Position = {'Zoom': {'_x': 1}}

    ptz.Stop({'ProfileToken': media_profile._token})

    ret = ptz.AbsoluteMove(request)
    sleep(5)
    print ret
    ptz.Stop({'ProfileToken': request.ProfileToken})

以上是用于执行此操作的方法,但是我总是从该行的ret中得到None作为响应

ret = ptz.AbsoluteMove(request)

Onvif可以提供一些帮助吗,我将如何在python中做到这一点。

0 个答案:

没有答案