Author Topic: Exposure feedback  (Read 543 times)

garry23

  • Hero Member
  • *****
  • Posts: 1681
Exposure feedback
« on: March 30, 2018, 12:52:24 PM »
@a1ex

As we know, when advanced auto bracketing is operating we are provided LV feedback on the last image, ie % over and under.

My suggestion is that Lua provide a similar feedback, ie on the exposure statistics of the last image.

Thus we would have the following fields that get info

Camera.exposure.over
Camera.exposure.under

A null return would indicate no last image to gather statistics on, yet.

The above functionality would allow us to be more inventive with our bracketing strategies.

I could even imagine, in time, additional functionality that allowed the user to specify an area on the image to gather the statistics in, eg relative to LV x y values.

Cheers

Garry

 

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12128
  • 5D Mark Free
Re: Exposure feedback
« Reply #1 on: March 30, 2018, 01:32:56 PM »
These statistics are probably best computed from the raw histogram. Internally, ML uses the following units:
- DN (digital number aka raw value; you need to know the black and white level for interpretation)
- EV (floating point, 0 = clipped white, negative values are stops below white; other convention may be used)

What about something like this?

Code: [Select]
raw.hist.update() -- takes a while to run, possibly some precision argument could be useful
raw.hist.median.ev / median.dn -- get overall brightness (in EV or DN) for all channels together
raw.hist.percentile(98).ev  / .dn -- exposure level (EV or DN) for which 98% of pixels are below and 2% are above
raw.hist.above{ev=-3} -- percentage of pixels above some threshold (EV)
raw.hist.above{dn=15000} -- same, but with threshold in DN
raw.hist.below{dn=15000}
raw.hist.ob.median -- optical black analysis
raw.hist.red.median... -- per-channel analysis (red, green1, green2, green [average], blue)
raw.hist.max.median... -- median computed on max(r,g1,g2,b)
raw.hist.rect(left, top, width, height).median(...)

raw.white_level
raw.black_level
raw.preview()  -- optional arguments: preview rectangle (what to draw) and maybe also where to draw it on the screen
raw.pixel(x,y) -- get one pixel (this is going to be very slow...)
raw.average(x,y,w,h) -- maybe better?

raw.noise_model.read_noise -- in DN
raw.noise_model.full_well -- in electrons
raw.noise_model.snr{dn=10000} -- SNR at some given DN (raw) value
raw.noise_model.snr{ev=-3} -- or at some given EV below clipping point
raw.noise_model.dynamic_range -- expected at current settings

raw.noise_model.iso(200).read_noise -- what to expect at some different settings
raw.noise_model.iso(200).full_well
raw.noise_model.vidmode("MV-1080").iso(200).full_well -- strings as returned by lv.vidmode

Just a rough sketch (subject to change). Suggestions welcome (most of these are available in ML code to some extent, just not exposed to Lua). Would help a lot if the API is well-defined before starting to implement it.

Somewhat related: full-res silent capture code can also be used for dark frames (just by running it outside LiveView, with the shutter closed), but it's not currently on the UI; exposing it to Lua could be interesting too.

garry23

  • Hero Member
  • *****
  • Posts: 1681
Re: Exposure feedback
« Reply #2 on: March 30, 2018, 02:03:30 PM »
@a1ex

What a rich data set. I’m at a loss to suggest any additions.

My only thought is to get something out there as quick as possible so Lua users such as myself can start experimenting with the features.

This will allow us to suggest updates to the API.

Bottom line: a new module in Lua called raw looks a great approach. I would ask you to implement this in a version 1, so we can start experimenting with it. That is, IMHO, rather than seek perfection at the start, implement something that gets us exploring the Lua coding possibilities. Your feature set looks a great start.

Cheers

Garry

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12128
  • 5D Mark Free
Re: Exposure feedback
« Reply #3 on: March 30, 2018, 03:58:14 PM »
Sure, they won't be implemented all at once, but it helps to have some sort of overview, rather than wondering where to add the more advanced functions later.

Some of these functions are also present in CHDK.

garry23

  • Hero Member
  • *****
  • Posts: 1681
Re: Exposure feedback
« Reply #4 on: March 31, 2018, 03:03:45 PM »
@a1ex

I've played around with your original cut and have arrived at this:

Code: [Select]
raw.hist.update() -- updates raw-data/statistics etc from current LV without taking an image. Statistics are also updated after every photo capture
raw.hist.median.ev / median.dn -- get overall brightness (in EV or DN) for all channels together
raw.hist.percentile(x).ev  / .dn -- exposure level (EV or DN) for which x% of pixels are below and 100-x% are above. X range limited to z%
raw.hist.above{ev=-x} -- percentage of pixels above some threshold EV, eg -2EV
raw.hist.below{ev=-x} -- percentage of pixels below some threshold EV, eg -2EV
raw.hist.above{dn=x} -- same, but with threshold in DNs, eg 15000
raw.hist.below{dn=x}
raw.hist.black.median -- optical black analysis
raw.hist.red.median... -- per-channel analysis (red, green1, green2, green [average], blue)
raw.hist.max.median... -- median computed on max(r,g1,g2,b)
raw.hist.rect(left, top, width, height).median(...)-- similar to raw.spot, but operates over a wider area. Functionality could be combined with raw.spot

raw.spot.pos(x,y) -- position spotmeter in LV space
raw.spot.raw/RGB/Perc -- value of ML (raw) spotmeter
raw.spot.pos.x -- x position of ML spotmeter in LV units
raw.spot.pos.y -- y position of ML spotmeter in LV units
raw.spot.size{x, y} -- user defined spotmeter. Use case to make a spotmeter that is FL aware, eg always x-degrees. X and y limited in size maybe
raw.average(x,y,w,h) -- related to spotmeter idea

raw.white_level
raw.black_level
raw.preview()  -- optional arguments: preview rectangle (what to draw) and maybe also where to draw it on the screen

Personally I can’t comment on the following
raw.noise_model.read_noise -- in DN
raw.noise_model.full_well -- in electrons
raw.noise_model.snr{dn=10000} -- SNR at some given DN (raw) value
raw.noise_model.snr{ev=-3} -- or at some given EV below clipping point
raw.noise_model.dynamic_range -- expected at current settings

raw.noise_model.iso(200).read_noise -- what to expect at some different settings
raw.noise_model.iso(200).full_well
raw.noise_model.vidmode("MV-1080").iso(200).full_well -- strings as returned by lv.vidmode

Obviously my 'interests' are very much a sub-set of a full feature set that could emerge or be stated by others, such as yourself.

The only real addition over your cut, is the ability to position a variable size spotmeter.

Hope this is of some value.