2

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!

ChickenSoups
  • 937
  • 8
  • 18
  • Have you tried contacting the guys that made python-onvif-zeep directly? (: I would suggest you to create an issue there! https://github.com/FalkTannhaeuser/python-onvif-zeep/issues – LoukMouk Jul 24 '19 at 14:39
  • 1
    There is also some chance that your ONVIF camera doesn't support the command you're trying to send... It happened to me a couple of times. See https://stackoverflow.com/questions/56642348/can-i-get-network-camera-direction/56672849#56672849 – LoukMouk Jul 24 '19 at 14:41
  • @LoukMouk Thanks you. I had checked Imaging GetOptions and GetCapasibilities. It seem the camera provider does not support onvif set focus for imaging settings. – ChickenSoups Jul 25 '19 at 03:56

1 Answers1

2

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)
asterissco
  • 21
  • 3