Add Image settings setter

This commit is contained in:
Karl Moos
2020-10-30 07:27:33 -05:00
parent e1eabf535d
commit 0c3475aa00
2 changed files with 54 additions and 18 deletions

View File

@@ -83,5 +83,5 @@ SET:
- [x] PTZ - [x] PTZ
- [x] Zoom - [x] Zoom
- [x] Focus - [x] Focus
- [ ] Image (Brightness, Contrast, Saturation, Hue, Sharp, Mirror, Rotate) - [X] Image (Brightness, Contrast, Saturation, Hue, Sharp, Mirror, Rotate)
- [X] Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, LED light, 3D-NR) - [X] Advanced Image (Anti-flicker, Exposure, White Balance, DayNight, Backlight, LED light, 3D-NR)

View File

@@ -2,25 +2,26 @@
class ImageAPIMixin: class ImageAPIMixin:
"""API calls for image settings.""" """API calls for image settings."""
def set_advanced_imaging(self, def set_adv_image_settings(self,
anti_flicker='Outdoor', anti_flicker='Outdoor',
exposure='Auto', exposure='Auto',
gain_min=1, gain_min=1,
gain_max=62, gain_max=62,
shutter_min=1, shutter_min=1,
shutter_max=125, shutter_max=125,
blue_gain=128, blue_gain=128,
red_gain=128, red_gain=128,
white_balance='Auto', white_balance='Auto',
day_night='Auto', day_night='Auto',
back_light='DynamicRangeControl', back_light='DynamicRangeControl',
blc=128, blc=128,
drc=128, drc=128,
rotation=0, rotation=0,
mirroring=0, mirroring=0,
nr3d=1) -> object: nr3d=1) -> object:
""" """
Sets the advanced camera settings. Sets the advanced camera settings.
:param anti_flicker: string :param anti_flicker: string
:param exposure: string :param exposure: string
:param gain_min: int :param gain_min: int
@@ -63,3 +64,38 @@ class ImageAPIMixin:
} }
}] }]
return self._execute_command('SetIsp', body) return self._execute_command('SetIsp', body)
def set_image_settings(self,
brightness=128,
contrast=62,
hue=1,
saturation=125,
sharpness=128) -> object:
"""
Sets the camera image settings.
:param brightness: int
:param contrast: string
:param hue: int
:param saturation: int
:param sharpness: int
:return: response
"""
body = [
{
"cmd": "SetImage",
"action": 0,
"param": {
"Image": {
"bright": brightness,
"channel": 0,
"contrast": contrast,
"hue": hue,
"saturation": saturation,
"sharpen": sharpness
}
}
}
]
return self._execute_command('SetImage', body)