Black Point - page 2 - General Help and Assistance on using CHDK stable releases - CHDK Forum supplierdeeply

Black Point

  • 14 Replies
  • 1685 Views
Re: Black Point
« Reply #10 on: 04 / June / 2022, 16:06:58 »
Advertisements
Quote

I'm not really clear which values you were referring to in the thread (get_histo_range? Raw values? Something from raw/dng images?) so maybe you can clarify what specifically you are trying to do if the above doesn't address your question.


Having taken an image I call get_histo_range(i,j), having called shot_histo_enable(1).

To find the black level offset I use this bit of code

Code: [Select]

shot_histo_enable(1)
    jj = 0
    myshoot()
    repeat
        test2 = get_histo_range(jj,jj)
        jj = jj + 1
        sleep(200)
    until test2 > 0
    shot_histo_enable(0)
    print("Black Level = "..jj-1)


In other words, histogram data only kicks in from the offset, which on the G1X is 29 and for my other cams it’s 127


*

Offline reyalp

  • ******
  • 14113
Re: Black Point
« Reply #11 on: 04 / June / 2022, 16:37:52 »
Having taken an image I call get_histo_range(i,j), having called shot_histo_enable(1).

To find the black level offset I use this bit of code

Code: [Select]

shot_histo_enable(1)
    jj = 0
    myshoot()
    repeat
        test2 = get_histo_range(jj,jj)
        jj = jj + 1
        sleep(200)
    until test2 > 0
    shot_histo_enable(0)
    print("Black Level = "..jj-1)


In other words, histogram data only kicks in from the offset, which on the G1X is 29 and for my other cams it’s 127
OK. First I forgot to mention that cameras can also override blacklevel, which in fact M3, G5 X and G7 X II do:
Code: [Select]
    #define CAM_BLACK_LEVEL                     2047    // not tested under all conditions
So, that explains why these cameras are 127 in get_histo_range. Your G1 X OTOH is showing the normal range, since you aren't using the settings that trigger alternate blacklevel.

Regarding your code, I would note that it's possible to have some outlier pixels that are below the nominal black level. I'd guess there are generally few enough they'd be rounded to zero in get_histo_range, but I can't guarantee it.

To get CHDKs idea of the blacklevel directly, you can use rawop.get_black_level, but note
1) The value is the raw value, not scaled to 10 bit like get_histo_range. You can use rawop.get_bits_per_pixel to get the sensor BPP if you want to scale to 10bit.
2) For cameras with variable black level like G1 X, it may be updated in the raw hook. Getting the value after shooting should be fine.
Don't forget what the H stands for.

Re: Black Point
« Reply #12 on: 04 / June / 2022, 16:51:55 »
@reyalp

Once again, thanks for the insight.

All I’m doing is looking in the bottom bins, eg from 127, say, to know when to stop exposure bracketing for the shadows.

I’m content that my simple approach, ie using get_histo_range is good enough  ;)

Once again, thanks for taking the time to respond.

Cheers

Garry

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: Black Point
« Reply #13 on: 06 / June / 2022, 11:40:29 »
Code: [Select]

    repeat
        test2 = get_histo_range(jj,jj)
        jj = jj + 1
        sleep(200)
    until test2 > 0
...
    print("Black Level = "..jj-1)

So G1X sleeps 6sec, the other cams 25.  :)
All lifetime is a loan from eternity.


Re: Black Point
« Reply #14 on: 06 / June / 2022, 11:49:50 »
@Caefix

That was development code, where I was slowing down things to read the console ;-)

The current code looks like this:

Code: [Select]

if bplevel == 1 then
    shot_histo_enable(1)
    jj = 0
    myshoot()
    repeat
        test2 = get_histo_range(jj,jj)
        jj = jj + 1
    until test2 > 0
    shot_histo_enable(0)
    print("Black Level = "..jj-1)
    sleep(4000)
    return
end


 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal