Forum

Author Topic: Run "Set Brightness" tool to estimate brightness from python  (Read 2719 times)

Christina K

  • Newbie
  • *
  • Posts: 14
    • View Profile
Is it possible to run the "set brightness" in the tools menu from Python to automatically estimate the image brightness (and contrast)? I could not find it in the Python API reference.

Thanks in advance.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14817
    • View Profile
Re: Run "Set Brightness" tool to estimate brightness from python
« Reply #1 on: July 23, 2019, 06:07:51 PM »
Hello Christina,

You can set brightness and contrast in the following way:
Code: [Select]
chunk.image_brightness = 500
chunk.image_contrast = 200

But there's no straightforward way to estimate the default values, like via GUI.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Christina K

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Run "Set Brightness" tool to estimate brightness from python
« Reply #2 on: July 25, 2019, 12:08:17 AM »
:(. Thanks for the clarity. It is a bit of a shame that the orthomosaic image in the exported processing report when using calibrated imagery (reflectace) is mostly black. As we are processing the data fully automatic I cannot determine the contrast and brightness values myself. Although maybe a default values will work in most cases. I will do some testing. :)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14817
    • View Profile
Re: Run "Set Brightness" tool to estimate brightness from python
« Reply #3 on: July 25, 2019, 12:42:01 PM »
Hello Christina,

The brightness settings do not have any effect on the orthomosaic export. If you wish to modify the values in the output orthomosaic bands, I recommend to use Raster Calculator feature.
For example, the following code would give you the min and max values for the first band:
Code: [Select]
chunk.raster_transform.formula = ["B1"]
chunk.raster_transform.calibrateRange()
range_min, range_max = chunk.raster_transform.range
So you can get the min/max values for each band in similar way and apply multiplier to the output formulas for all the bands to use the full datatype range more effectively, if it is your intention.
Best regards,
Alexey Pasumansky,
Agisoft LLC