get_histo_range strangeness - page 4 - Script Writing - CHDK Forum  

get_histo_range strangeness

  • 55 Replies
  • 2211 Views
*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: get_histo_range strangeness
« Reply #30 on: 20 / May / 2022, 06:51:29 »
Advertisements
I've added the RAW EV histogram to all the XIMR builds (downloadable from the google drive link).

There's a new menu option to enable it and set options.

'Show RAW EV Histogram' - enable and set where it is displayed (ALT mode, Play mode or both).
'Under exposure threshold' - raw values that are less than camera black level + this value are considered clipped black.
'Over exposure threshold' - raw values that are greater than camera white level - this value are considered clipped white.
'Save EV histogram log' - append calculated histogram to A/raw_ev_histo.csv.
'Sensor sampling area:'
'  Width %' - percentage of the sensor width to sample for calculating histogram.
'  Height %' - percentage of the sensor height to sample for calculating histogram.
'  X Step' - Number of pixels to skip in each row when sampling (set to 2 to sample every pixel which will be slow).
'  Y Step' - Number of pixels to skip in each column when sampling (set to 2 to sample every pixel which will be slow).

The sampling area is centered in the sensor active area. Some camera have severe barrel distortion at the wide end so setting the sample area to 100 may throw off the under exposure calculation because of the corner vignetting.

A sample histogram is attached. Each red, green or blue column is 1/3 EV, and the grey vertical lines are 1 EV apart.
The count of under exposed values is drawn in white over the top of the leftmost red/green/blue bar. Over exposed count is over the rightmost red/green/blue bar.
The thinner white line at the left is the percentage of under exposed values relative to the total # of pixels with a value <= 20.
The thinner white line at the right is the percentage of over exposed values relative to the total number of pixels in the rightmost 1/3 EV bucket.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: get_histo_range strangeness
« Reply #31 on: 20 / May / 2022, 07:28:22 »
@philmoz

Just tried the new build, with the RAW Ev histogram on my M3.

As a tool to manually inform subsequent exposure setting I think it is good.

In ALT mode you see the last histogram and, at the moment, can guess/judge exposure adjustments.

The obvious question is: can you think how to show how much Ev you are over or under, especially over, ie for ETTR adjustments.

If that is possible, could you imagine providing this feedback via the Lua API?

Bottom line: great work, as always, and if it stays as it is, it is a great addition for RAW shooters.

Many thanks

Garry

*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: get_histo_range strangeness
« Reply #32 on: 20 / May / 2022, 07:37:54 »
The obvious question is: can you think how to show how much Ev you are over or under, especially over, ie for ETTR adjustments.


At the moment I am not sure how this would work. Once a pixel saturates on the sensor it will be read out at the white level of the sensor regardless of how much more light hit it. So there is no way to know how over exposed any part of the image is. Same for under exposure.


You might be able to guesstimate something based in the how many over/under exposed values there are compared to the total sensor size; but I can't think of a way to translate this into EV stops for exposure adjustment.


Quote
If that is possible, could you imagine providing this feedback via the Lua API?


Yes, I was thinking of making this work like the shot histogram where you could enable it in a script and retrieve the EV histogram values.



CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: get_histo_range strangeness
« Reply #33 on: 20 / May / 2022, 07:45:21 »
@philmoz

Quote

At the moment I am not sure how this would work.


I don’t know how a1ex over in magic lantern world did it, but I know he did, ie the RAW LV histogram gives over and under Ev hints: https://www.magiclantern.fm/forum/index.php?topic=12096.0



*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: get_histo_range strangeness
« Reply #34 on: 20 / May / 2022, 07:54:51 »
I don’t know how a1ex over in magic lantern world did it, but I know he did, ie the RAW LV histogram gives over and under Ev hints: https://www.magiclantern.fm/forum/index.php?topic=12096.0


My understanding is that the ML hint is for an image that is not over exposed, and gives an indication how much more you can increase the exposure by before it starts to clip. This is probably doable.


But I don't know any method of going the other way - i.e. work out how much to reduce the exposure of a clipped image to remove any clipping; but still be  exposed to the right.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: get_histo_range strangeness
« Reply #35 on: 20 / May / 2022, 08:05:08 »
@philmoz

I don’t know how he did it, but as you increase exposure from under, which gives you positive Ev feedback, ie telling you how many Ev you are short of the ETTR point, you reach, 0Ev, then the feedback goes negative, ie showing you how much you are over exposed.

Having ‘just’ the underexposed feedback, ie Ev to ETTR would be a great additional feature.


This may give a clue:https://foss.heptapod.net/magic-lantern/magic-lantern/-/blob/branch/unified/src/histogram.c
« Last Edit: 20 / May / 2022, 08:19:12 by pigeonhill »

*

Offline Caefix

  • *****
  • 940
  • Sorry, busy deleting test shots...
Re: get_histo_range strangeness
« Reply #36 on: 20 / May / 2022, 09:41:45 »
The sampling area is centered in the sensor active area. Some camera have severe barrel distortion at the wide end so setting the sample area to 100 may throw off the under exposure calculation because of the corner vignetting.

;) ... It might bee too expensive, but interesting to have some x/y offset to the center.  :)
All lifetime is a loan from eternity.

*

Offline c_joerg

  • *****
  • 1241
Re: get_histo_range strangeness
« Reply #37 on: 20 / May / 2022, 11:45:59 »
At the moment I am not sure how this would work. Once a pixel saturates on the sensor it will be read out at the white level of the sensor regardless of how much more light hit it. So there is no way to know how over exposed any part of the image is.

My understanding is that the ML hint is for an image that is not over exposed, and gives an indication how much more you can increase the exposure by before it starts to clip. This is probably doable.

That's exactly what I tried to describe in Reply #22
https://chdk.setepontos.com/index.php?topic=14544.msg148244#msg148244



EV=rawop.raw_to_ev(white_level)- rawop.raw_to_ev(Max_Pixel_Value)

With this one would have to be able to calculate the EV values in order to be able to come to ETTR.
An underexposed image is required
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd


Re: get_histo_range strangeness
« Reply #38 on: 20 / May / 2022, 12:04:55 »
All I can say, as an ML user, the RAW histogram and ETTR hint works if the image is under or over exposed.

I’m not saying the ML algorithm is correct/optimised, but it does provide an ETTR hint feedback in Ev, irrespective of the exposure, ie under or over highlight saturated.

*

Offline c_joerg

  • *****
  • 1241
Re: get_histo_range strangeness
« Reply #39 on: 20 / May / 2022, 12:23:17 »
I also used the ML ETTR with my 6D. Then I looked at the images with RawDigger. For me, the values were not very accurate.

Maybe I used it wrong...

If I only photographed a white wall, then the RAW values were between 8000 - 10000. I would have expected more like 16000.
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

 

Related Topics