get_histo_range strangeness - page 3 - Script Writing - CHDK Forum
supplierdeeply

get_histo_range strangeness

  • 55 Replies
  • 2216 Views
*

Offline c_joerg

  • *****
  • 1241
Re: get_histo_range strangeness
« Reply #20 on: 19 / May / 2022, 01:43:02 »
Advertisements
I would like to have a picture that is exposed to the maximum and should not have any overexposed areas (ETTR).

I got that right?
If my first shot is already overexposed, then I can't determine how much EV I need to reduce the second shot by. The overexposed areas can be 1EV or 10EV overexposed.
So first I need a shot that is underexposed. With this histogram I can then determine exactly by how much EV I need to increase the second shot.
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 #21 on: 19 / May / 2022, 01:59:36 »
@c_joerg

Assuming I understand you, you may like to look at my set_ETTR function in my M3 Bracketing script, eg:

Code: [Select]
function set_ETTR()
    local histo={}
    local total = 0
    histo,total=get_live_histo()
    total = 0
    local max = #histo
    local start = max-hlw
    for i = start,(max-1),1 do total = total + histo[i] end -- get the total count in the requested quartiles

    press("shoot_half")
    repeat sleep(10) until get_shooting()
    s = get_tv96()
    set_user_tv96(s)
    release("shoot_half")
    repeat sleep(10) until (not get_shooting())

    if total > 0 then -- overexposed
        i = 0
        repeat
            wheel_right() -- move 1 stop, but note camera must be set to 1/3 stops
            wheel_right()
            wheel_right()
            histo,total=get_live_histo()
            total = 0
            for i = start,(max-1),1 do total = total + histo[i] end
        until total <= 0
        repeat
            wheel_left()
            histo,total=get_live_histo()
            total = 0
            for i = start,(max-1),1 do total = total + histo[i] end
        until total > 0
        wheel_right()
    elseif total <= 0 then -- underexposed
        i = 0
        repeat
            wheel_left() -- move 1 stop, but note camera must be set to 1/3 stops
            wheel_left()
            wheel_left()
            histo,total=get_live_histo()
            total = 0
            for i = start,(max-1),1 do total = total + histo[i] end
        until total > 0
        repeat
            wheel_right()
            histo,total=get_live_histo()
            total = 0
            for i = start,(max-1),1 do total = total + histo[i] end
        until total <= 0
    end

    return
end

It's not fast or optimised, but it sets ETTR from any exposure, ie over or under.
« Last Edit: 19 / May / 2022, 02:13:15 by pigeonhill »

*

Offline c_joerg

  • *****
  • 1241
Re: get_histo_range strangeness
« Reply #22 on: 19 / May / 2022, 03:10:21 »
I understand the code well. You change the exposure until it fits.

But with rawop, that would mean you might have to take a lot of pictures.

The advantage with rawop would be that you actually only need two images. If you have a shot with underexposure, you can use the RAW data to calculate exactly how much EV you need to increase.
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 #23 on: 19 / May / 2022, 03:21:04 »
@c_joerg

To be clear, the function above is used to set an ETTR exposure at any time, ie triggered by the user clicking the appropriate button, ie right click. I don’t use it for bracketing.

As it’s slow, I don’t tend to use it, preferring to use the ETTR exposure helper, which gives visual feedback in the top stop, in 1/3 stops and, now, in the top 1/6 stop and the highlight bins, eg from 255.



*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: get_histo_range strangeness
« Reply #24 on: 19 / May / 2022, 03:30:45 »
The recent discussions on the CHDK/Canon histogram and ETTR got me to thinking and I've been playing with a last shot RAW EV histogram for CHDK.


Basically this displays an RGB histogram of the last shot taken; but with the histogram calculated in 1/3rd EV steps and calculated from the RAW sensor data.


In the attached screenshot each of the vertical red, green and blue bars is a 1/3rd stop grouping of RAW data. The grey lines are at 1 stop intervals.
The white bars at the left and right indicate the % of under/over exposed pixels relative the overall dark and light areas (I'm still working on this calculation).


On the camera the sample image shows the entire left half of the sky as over exposed (blinking) and you can see from the Canon histogram all three channels are clipped on the right. The reality in the RAW data is that there is only a very small amount of clipping on the green channels and none on the red and blue. The loaded into Lightroom the sky comes out fine with no clipping.


This is experimental and I'm not sure where it will end up; but the RAW EV histogram seems to show some promise (for me at least).
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 #25 on: 19 / May / 2022, 03:41:32 »
@philmoz

For most of my photography I used Magic Lantern, which has very good RAW cover for histograms, including Ev feedback, ie under and over.

The one thing that confused me on your illustration, is the different placing of the top stop, ie relative to saturation. If this is a RAW histogram, I would have thought the stop bars would all be of equal distance apart.

Irrespective of the above, thumbs up for you looking at this.

*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: get_histo_range strangeness
« Reply #26 on: 19 / May / 2022, 03:44:39 »
The left and right sides include an extra vertical bar (in white) for under/over exposure so the areas are wider.
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 #27 on: 19 / May / 2022, 03:46:39 »
Get it now ;-)



Re: get_histo_range strangeness
« Reply #28 on: 19 / May / 2022, 03:50:21 »
@philmoz

BTW One request is that the Lua API has appropriate ways to get info from the RAW histogram ;-)

*

Offline c_joerg

  • *****
  • 1241
Re: get_histo_range strangeness
« Reply #29 on: 19 / May / 2022, 04:00:44 »
This is experimental and I'm not sure where it will end up; but the RAW EV histogram seems to show some promise (for me at least).

I will definitely be following this with great interest.
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