Histogram - page 2 - General Discussion and Assistance - CHDK Forum

Histogram

  • 109 Replies
  • 32915 Views
Re: Histogram
« Reply #10 on: 11 / January / 2013, 17:14:50 »
Advertisements
Posts are crossing!

I have an S95(k).

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #11 on: 12 / January / 2013, 01:51:27 »
I naively thought the CHDK histogram was constructed from different data from the canon one. Know I think about it, what I want can not be constructed in real time: I guess?

I'm sure your implication is right, that 10b should be enough.
The "shot" histogram I'm talking about is computed from the raw image while it's still in the camera, and before it's converted to a jpg and saved. You can even write on the raw data at this point and it appears in the jpg.

The shot histogram doesn't sample the entire image. I have it set up to sample about 12,000 pixels spread out over the image. The raw image consists of red, green, and blue pixels in a mosaic (Bayer) pattern. My program is very careful to sample all the colors evenly, so the top of the histogram will contain the brightest color, whatever that is. As a test, I set each sampled pixel to its brightest value so you can see the pattern. Take a look at this picture magnified, and you'll see how even the colored dots are spread out over the image:

http://i.imgur.com/MlQFe.jpg

I've attached a CHDK build with the scale option for get_histo_range that I described above. It only works with Lua.

I have to take care some things in one of my other lives for a few days, but I'll be back and work on the ETTR program next week.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #12 on: 12 / January / 2013, 12:36:10 »
Lapser
Thanks for the download, however, for some reason (most probably me), when I load your build my S95 goes unstable, even before I try and use your calls.

Should I ‘just’ replace the files you sent me, or delete all the previous CHDK files and only use your files?
BTW the reason I am interested in your histogram calls is that I want an auto bracketing script that ‘guarantees’ to eliminate any overexposed areas.

My current script (based on one by msl) uses the get_histo_range, but the granularity/accuracy is not sufficient, ie 0 to 100% returned.

Once I get your calls working, my thinking is as follows:
•   Manual mode, manual focus, spot meter on the darkest area that I am interested in seeing some structure, place this at 0EV (or wherever I wish), freeze AF;
•   Use your count=get_histo_range(2046,2047,0) to get the actual sample count in the end most ‘overexposed’ bin. In other words, I feel all I need to do is ensure this final bin is addressed, then I have ‘guaranteed’ I have no overexposed pixels in the image, ie I have maximized the data content of the brackets for further 32-bit processing.
•   Loop and change the exposure of the next shot until the end bin count is less than a ‘sensible’ number.

Using the above algorithm/workflow means I don’t need to worry about the ‘underexposed’ end of the brackets, only the ‘overexposed’ end. The rationale being that I don’t have to complicate the algorithm addressing the black level end of the histogram, which for my 12b S95 is at 127.

Looking at RAWdigger data, I am confident that if I sample the count in the end most bright bin and ensure it is less than a sensible threshold, that should be OK; say less than 50 or 100 to account for sensor statistics.

I would be grateful for any thoughts you (or others) may have: first to allow me to get your build running and then any thoughts on ‘my algorithm’.

Cheers

Garry

Re: Histogram
« Reply #13 on: 13 / January / 2013, 13:23:45 »
BTW I get an error related to nil value when I first call set_shot_histrogram(1).

Also should I call set_shot_histogram(0) at he end of the script?

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #14 on: 13 / January / 2013, 16:36:20 »
Try this:

1. Delete all files off the SD card.
2. Load the full CHDK version 1.2 for your camera
3. Copy all the files in my build to the root directory, including the sub-folders. With Windows, try this:
  a. open my zip file (double click)
  b. press control+A, then control+C
  c. navigate to the root of the SD card
  d. press control+V
  e. choose options to overwrite directories and files

Once you're sure it's working, you can do future updates from me just by replacing the file:
diskboot.bin

[EDIT] this is no longer true. You need to copy all the files, since Lua was moved to a module now.

You don't need to call set_shot_histogram(0) at he end of the script. CHDK does that automatically.
« Last Edit: 20 / January / 2013, 18:23:05 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #15 on: 13 / January / 2013, 17:39:57 »
lapser

loaded again and still get the error

"attempt to call 'set_shot_histogram' (a nil value)"


*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #16 on: 13 / January / 2013, 22:18:06 »
loaded again and still get the error
"attempt to call 'set_shot_histogram' (a nil value)"
Sorry, I got the name of the function mixed up in my haste. It should be:

shot_histo_enable(1)

That error means the name of the function is incorrect. Here's the reference for correct function names, and how to use them:

http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #17 on: 13 / January / 2013, 23:20:38 »
Lapser

Thanks, I had been using the old calls and assumed you had set up a new initialisation call.

I am up and running now and will tune my algorithm.

One 'problem' is that now the dark frame subtraction is broken again, ie doesn't work.

I flagged this up the other day and it was fixed.

Is there any chance you coud add you new calls into the build with the fixed dark frame.

Once agin,  thanks for your advice and time.

Cheers

Garry

*

Offline lapser

  • *****
  • 1093
Re: Histogram
« Reply #18 on: 14 / January / 2013, 19:57:32 »
Is there any chance you coud add you new calls into the build with the fixed dark frame.
I applied my changes to the latest CHDK version. (It's not easy keeping up with philmoz).

I think this version has the dark frame fix. Let me know if it works now.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

Re: Histogram
« Reply #19 on: 14 / January / 2013, 21:11:03 »
Lapser

You are a gentleman!

Many thanks: that did the trick!

Cheers

Garry

 

Related Topics


SimplePortal © 2008-2014, SimplePortal