網頁

2025年4月15日 星期二

球型攝影機 onvif

參考 https://github.com/FalkTannhaeuser/python-onvif-zeep
參考 https://www.onvif.org/onvif/ver20/util/operationIndex.html

$ python -m venv --system-site-packages /mnt/Data/envs/onvif
$ source /mnt/Data/envs/onvif/bin/activate
$ pip install --upgrade onvif_zeep
$ git clone https://github.com/FalkTannhaeuser/python-onvif-zeep.git

$ onvif-cli devicemgmt GetHostname --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80

查詢 ProfileToken
$ onvif-cli media GetProfiles --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80 | grep -o "'token': '[^']*'" | awk -F': ' 'END {print $2}'
'MediaProfile00002'
$ onvif-cli ptz GotoPreset "{'ProfileToken':'MediaProfile00002', 'PresetToken':'9'}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80
$ onvif-cli ptz GetPresets "{'ProfileToken':'MediaProfile00002'}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80
$ onvif-cli ptz AbsoluteMove "{'ProfileToken':'MediaProfile00002', 'Position':{'PanTilt':{'x': -0.05, 'y': 0.6}, 'Zoom':0.5}}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80

相對位置移動, 0:不移動 正:上,右,放大 負:下,左,縮小
左上
$ onvif-cli ptz RelativeMove "{'ProfileToken':'MediaProfile00002', 'Translation':{'PanTilt':{'x': 0.105, 'y': 0.22}, 'Zoom':0.3}}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80
右下
$ onvif-cli ptz RelativeMove "{'ProfileToken':'MediaProfile00002', 'Translation':{'PanTilt':{'x': -0.115, 'y': -0.201}, 'Zoom':0.3}}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80
左上
$ onvif-cli ptz RelativeMove "{'ProfileToken':'MediaProfile00002', 'Translation':{'PanTilt':{'x': 0.105, 'y': 0.21}, 'Zoom':0.15}}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80
右下
$ onvif-cli ptz RelativeMove "{'ProfileToken':'MediaProfile00002', 'Translation':{'PanTilt':{'x': -0.105, 'y': -0.21}, 'Zoom':0.15}}" --user 'admin' --password 'sh22463458' --host '192.168.113.203' --port 80

沒有留言:

張貼留言