python - 使用 python-onvif-zeep 禁用 IP PTZ 摄像机自动对焦
问题描述
我的 PTZ 摄像机自动对焦并调整平移倾斜变焦和某些物体上出现在摄像机中的图像。我想禁用这些功能。
我正在使用 python-onvif-zeep 库https://github.com/FalkTannhaeuser/python-onvif-zeep.git
onvif 的操作指南在这里 https://www.onvif.org/onvif/ver20/util/operationIndex.html
我要发送请求的具体功能是 SetImagingSettings https://www.onvif.org/onvif/ver20/imaging/wsdl/imaging.wsdl#op.SetImagingSettings
我尝试如下创建请求
request = controller.imaging.create_type('SetImagingSettings')
video_sources = controller.media.GetVideoSources() # get video source to fetch token
request.VideoSourceToken = video_sources[0].token
request.ImagingSettings = {
'Brightness': 200,
'Focus': {
'AutoFocusMode': 'MANUAL'
}
}
controller.imaging.SetImagingSettings(request)
如果没有“焦点”部分,代码可以很好地更新亮度值。
我的期望:成像设置会更新,禁用自动对焦。
但我得到一个一般错误说“zeep.exceptions.Fault:请求的设置不正确”谢谢大家!
解决方案
尝试
- 获取图像设置
- 获取对 SetImageSetting 的请求:
- 设置为 SetImageSetting:ImagingSettings 的 Request 第一步的响应
- 设置 VideoTokenProfile
- 发送请求
ptz = mycam.create_ptz_service() media = mycam.create_media_service() imaging = mycam.create_imaging_service() requestGetImaging = imaging.create_type('GetImagingSettings') video_sources = media.GetVideoSources() requestGetImaging.VideoSourceToken = video_sources[0]._token responseGetImageSettings = imaging.GetImagingSettings(requestImaging) requestSetImaging = imaging.create_type('SetImagingSettings') requestSetImaging.VideoSourceToken = video_sources[0]._token requestSetImaging.ImagingSettings = responseGetImageSettings requestSetImaging.ImagingSettings.Brightness = 50 print requestSetImaging imaging.SetImagingSettings(requestSetImaging)
推荐阅读
- python - 关于幅度的语法错误
- python - pandas.read_sql 使用 SQLAlchemy 读取未提交
- c# - 从 C# 中的文本文件中读取两行数据时出现异常
- c# - 将 BackgroundWorker 转换为异步
- docker - Hadoop docker:无法连接到资源管理器
- php - tcpdf 生成的 pdf 文件 -> 找不到文件头
- c++ - 不兼容的模板实例
- crystal-reports - 如何在时间字段(不是日期时间字段)中添加 13 分钟的时间水晶报表
- ios - iOS 中的始终在顶部(在其他应用程序上)按钮
- reactjs - 将 ag-grid 数据从子级传递给父级