Shot Histogram Request - page 7 - CHDK Releases - CHDK Forum
supplierdeeply

Shot Histogram Request

  • 467 Replies
  • 101118 Views
*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #60 on: 16 / December / 2012, 01:00:12 »
Advertisements
I've been working on the timing part of time lapse, and made some good progress. I added some code that delays the camera between the time the histogram (and meters) are ready, and the saving of the jpg, and I think it's debugged and working now. It allows very high speed shooting in continuous mode, with a little delay included to give Lua a chance to read the meters and change the exposure (I was 1 shot behind in the last test). There's a function to set the interval between shots, which eliminates the need to program a shot timer in Lua.

I also modified the set_tv,sv,av functions so they occur immediately when get_shooting() is true, instead of delaying until the next half_shoot. This eliminates the need to use propcases. I never figured out how to set av with propcases, and my somewhat complicated sv propcase solution worked, but I'm not sure how reliable it would be. This change will make life for the half_shoot Lua programmer much easier.

I'm working now on an Apex96 conversion function for Lua that outputs integer values from the C functions in shooting.c. It will make it very convenient for Lua programs to display shutter speeds instead of Tv96 values, and enter shutter speeds as parameters, and convert them to Tv96.

I've noticed that most of the function names start with set_ or get_. Based on this, the name for the Apex96 conversion function would be:

get_convert96(value, type)

I would prefer to drop the get_ and use convert96(...). The word "convert" implies that the function has an output value, so "get_" is redundant. Any opinions on this name, or ideas for other names?
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Histogram processing ideas
« Reply #61 on: 16 / December / 2012, 11:46:58 »
OK, first of all, I changed my mind (again) on the size of the histogram. It's now 2K, would go up to 8K for 12 bit cameras, and 32K for the 14-bit G1X. I just can't bring myself to bit shift away all the extra precision of 12 and 14 bit cameras for a measly 8K or 32K memory savings. Activating a histogram is optional, but if you want it, you want it all the way.

The next thing is getting the most out of the extra histogram memory. When I added the ability to do 4 meters  (or more), I din't think it would be that useful. But as I test it, I see it will add a significant capability to the camera metering. I also realized that I can add up a full histogram for each of the meters for very little time, and no extra memory overhead. Only the last meter would be saved between shots, but I could compute and save ETTR exposure change values (and maybe ETTL) for all the meters.

So the next step is to go back to the full histogram size, based on the bits per pixel of the camera. I did that once and threw it away, so it shouldn't be hard too put it back (in an even better way). Then, I'll add the code to compute a histogram for each meter (trivial). Finally, I'll work on a new function that uses the meter histograms to calculate recommended exposure changes to give to the Lua script.

Each meter histogram would have its own area. So let's say you're doing a sunset. If you use a histogram of the whole shot, it will include the sun, and you'll never get ETTR on the sun. So you could set your metering areas to exclude the sun, which would be the area to the right of the initial position of the sun, down to the horizon. (people in Australia, who live their lives upside down, might not be able to use this technique:). This might also avoid having the image brighten temporarily as the sun goes down, which doesn't look natural.

So I'll add the capability, with the hope that professional photographers with a lot more knowledge than I have, will find new ways to use it.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline reyalp

  • ******
  • 13673
Re: Shot Histogram Request
« Reply #62 on: 16 / December / 2012, 17:37:55 »
OK, first of all, I changed my mind (again) on the size of the histogram. It's now 2K, would go up to 8K for 12 bit cameras, and 32K for the 14-bit G1X. I just can't bring myself to bit shift away all the extra precision of 12 and 14 bit cameras for a measly 8K or 32K memory savings. Activating a histogram is optional, but if you want it, you want it all the way.
What application actually needs this precision ? 32K is actually quite a lot in CHDK land...

If you are calculating exposures, it seems to me the discarded precision is going to be a tiny fraction of a  stop, utterly meaningless from a photographic perspective.
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3407
    • Photos
Re: Shot Histogram Request
« Reply #63 on: 16 / December / 2012, 18:15:59 »
OK, first of all, I changed my mind (again) on the size of the histogram. It's now 2K, would go up to 8K for 12 bit cameras, and 32K for the 14-bit G1X. I just can't bring myself to bit shift away all the extra precision of 12 and 14 bit cameras for a measly 8K or 32K memory savings. Activating a histogram is optional, but if you want it, you want it all the way.
What application actually needs this precision ? 32K is actually quite a lot in CHDK land...

If you are calculating exposures, it seems to me the discarded precision is going to be a tiny fraction of a  stop, utterly meaningless from a photographic perspective.


The G1X has 2.5MB free memory without using exmem so should be no problem using 32K extra.

Phil.
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)


*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #64 on: 16 / December / 2012, 21:01:38 »
What application actually needs this precision ? 32K is actually quite a lot in CHDK land...
If you are calculating exposures, it seems to me the discarded precision is going to be a tiny fraction of a  stop, utterly meaningless from a photographic perspective.
That's what I was thinking when I decided to stay with 10 bits and 2K. But it gets more significant at low light levels. One of the reasons I wanted to try metering the shot in the raw buffer was that the standard meter started jumping by 1/2 Fstop when it got real dark. My time lapses were flashing noticeably.

Starting from 0, each extra bit of precision is an Fstop. And remember the memory is dynamically allocated, so I will only use the extra 2, 8, or 32K memory while a script is running that enabled the shot histogram. It will also be interesting to be able to show the full resolution histogram to see what's going on in the lower bits. I'm wondering if the G1X really has 14 significant bits of precision.

Are there any 16 bit sensors on the horizon?

The G1X has 2.5MB free memory without using exmem so should be no problem using 32K extra.
Thanks Phil. I appreciate you putting in your two bits worth. :) And I promise to bit shift the 16 bit cameras. Or maybe . . . ??

EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Using capt_seq_hook_set_nr() for interval delay
« Reply #65 on: 17 / December / 2012, 17:31:29 »
I got my continuous mode interval timer working pretty well by adding a delay in raw_savefile() right after build_shot_histogram(). But this happens AFTER the shot, and you really want to time the interval from the start of the shot. I've been looking for a way to do this for awhile, but I think I finally found it.

There's already a hook that happens immediately before the shot. It looks like the purpose of this hook is to turn off dark frames, which is one of the most useful features of CHDK for night shots. But I also discovered that I can put my interval timer delay at the end of this function. It works!

With the delay right before the shutter opens, it should be almost perfectly accurate, since it doesn't depend on the shutter speed, or file save time. Delaying after the shot is not accurate when the shutter time or file save time changes between shots.

I recently discovered that in continuous drive mode, the last picture taken is displayed on the screen, instead of the screen going blank for the entire exposure (with review mode off). But while delaying in raw_savefile(), the picture isn't ready to show, so the picture before it shows on the screen during the delay. Moving the delay to right before the next shot solves this problem. The screen shows the shot just taken while waiting to take the next shot.

The delay only happens when a script is active, and the script called "set_shot_interval(delay)." But the delay happens in any mode, not just continuous.  After setting a shot interval, each new shot will delay until the time between the new shot and the last shot exceeds that interval, even if you use a new half_press, or the shoot() function. A simple time lapse script would be:

set_shot_interval(10000) -- 10 seconds
repeat shoot() until false

When the script is terminated by pressing the shutter button, script.c calls set_shot_interval(0), and the delay is cancelled. The last picture will then be taken immediately.

Code: [Select]
void __attribute__((naked,noinline)) capt_seq_hook_set_nr()
{
 asm volatile("STMFD   SP!, {R0-R12,LR}\n");
    switch (core_get_noise_reduction_value()){
    case NOISE_REDUCTION_AUTO_CANON:
        // leave it alone
...
 raw_shot_delay(); //wait delay interval, if any, before continuing shot ******************
 
 shutter_open_time=_time((void*)0);
 shutter_open_tick_count = get_tick_count();

 asm volatile("LDMFD   SP!, {R0-R12,PC}\n");
}
I also added a double shot option to use with shot metering in continuous mode. It's activated with set_shot_interval(-2). After this, every other shot will have no delay.

Since shot metering takes place after the shot, the new exposure can't be applied until the next shot. If the shots are far apart, say 1 or 2 minutes, then the metering may not be accurate since the scene might change. So for long shot intervals, this option takes a "metering" shot, followed by a correctly exposed shot derived from the metering shot.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
DIFF files coming later
« Reply #66 on: 17 / December / 2012, 21:56:55 »
[EDIT] diff file attachment removed. Making too many changes now. See the documentation in the next post for more info on what's coming soon.
« Last Edit: 19 / December / 2012, 08:43:00 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Preliminary Documentation
« Reply #67 on: 18 / December / 2012, 23:06:49 »
I've attached a rough draft of the documentation I've written so far. I'm working on the shot_histogram part now, so those functions won't work like the documentation yet. I've included some Lua examples, which I haven't tested yet, but explain how to use the functions.

Rather than releasing new diff files, it might be easier to send them to philmoz to put in his branch?
« Last Edit: 19 / December / 2012, 08:43:56 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


Re: Shot Histogram Request
« Reply #68 on: 19 / December / 2012, 01:28:57 »
http://xkcd.com/1148/
Making too many changes now. See the documentation in the next post for more info on what's coming soon.
Lapser !

I'll be back in two weeks.

Let me know how this all worked out ? Do the drugs wear off after a while ?

WW
« Last Edit: 19 / December / 2012, 01:34:38 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #69 on: 19 / December / 2012, 09:04:55 »
I'll be back in two weeks.
Let me know how this all worked out ? Do the drugs wear off after a while ?
Good one! Have a nice trip, assuming you're tripping!

Hopefully, before you get back, I'll have this all done and organized. I accidentally deleted the documentation file last night instead of the diff fie (after the morning drugs had worn off  ::)).  It's in the last post again if you want to take a look at it.

"The distance between insanity and genius is measured only by success."
James Bond: Tomorrow Never Dies
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics