Disabled IP PTZ camera auto focus using python-onvif-zeep

2k Views Asked by At

My PTZ camera auto focus and adjust images on pan-tilt-zoom and on some object appear in camera. I want to disabled those features.

I'm using python-onvif-zeep library https://github.com/FalkTannhaeuser/python-onvif-zeep.git

The operation guide of onvif here https://www.onvif.org/onvif/ver20/util/operationIndex.html

The specific function I want to send request is SetImagingSettings https://www.onvif.org/onvif/ver20/imaging/wsdl/imaging.wsdl#op.SetImagingSettings

I've try to create the request as below

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)

Without the 'Focus' part, the code work well that update the Brightness value.

My expectation: the imaging settings be update, that disabled auto focus.

But I get a general error said "zeep.exceptions.Fault: The requested settings are incorrect" Thanks everyone!

1

There are 1 best solutions below

0
asterissco On

Try to

  1. Get Image Settings
  2. Get Request to SetImageSetting:
  3. Set into Request to SetImageSetting:ImagingSettings the response of firts step
  4. Set the VideoTokenProfile
  5. Send de request
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)