Shot Histogram Request - page 17 - CHDK Releases - CHDK Forum

Shot Histogram Request

  • 467 Replies
  • 93326 Views
*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #160 on: 19 / March / 2013, 14:08:58 »
Advertisements
I finished adding the shot meter area drawing function posted above to my main time lapse program. It works well, and lets you set the meter areas based on what the camera is seeing.

For sunsets, I'd like to try putting a relatively small metering area over the sun before it sets. That should keep the sun from blowing out everything around it without having to underexpose the whole time lapse. It should work kind of like a histogram.

When I added the capability to do multiple meters, I didn't know how I would use them. But now that I can adjust the location and size of each meter, there are a lot of possibilities. A small meter on the brightest part of the picture would be like histogram based exposure compensation. Averaging the meters and putting one inside the other would give a kind of center weighted metering.

To do HDR, for example, you could place one meter on the brightest area, and one meter on the darkest. Then you would take 2 pictures, one based on each meter.

You could even use the meters for motion detection. You could focus the camera on a bird feeder at night with a 1 second exposure time, and put a small meter where the bird lands. When the meter detected a sudden change in brightness, it could trigger the camera to take a picture with flash.

I'm looking forward to exploring the possibilities opened up by being able to set the size and location of 4 different exposure meters. Try the test script in the post above to get an idea of how the meter sizes and postions are set.
====
On another subject, I decided to enter the interval time in seconds*10, i.e. tenths of a second, instead of milliseconds. The tick count is only accurate to 1/100 second, so the last digit is always 0. But I've found that I never need 1/100 second precision either. 1/10 second is perfect.  So one second is entered as "10".
« Last Edit: 19 / March / 2013, 14:14:21 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline hwntw

  • ***
  • 159
Re: Shot Histogram Request
« Reply #161 on: 20 / March / 2013, 08:06:04 »
Quote
To do HDR, for example, you could place one meter on the brightest area, and one meter on the darkest. Then you would take 2 pictures, one based on each meter.
My iPod Touch 4g has a few apps that do what you describe, dob the touch screen and the exposure points can be moved around and the shot exp comp is previewed.
Would you mind summarising your work so far on shot histogram and say how it will fit into the general usage of CHDK, for simpletons like me?

Colin
Ixus 300HS S100


Windows 10

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #162 on: 20 / March / 2013, 11:54:06 »
My iPod Touch 4g has a few apps that do what you describe, dob the touch screen and the exposure points can be moved around and the shot exp comp is previewed.
That's interesting. I think of CHDK as an interface for Lua "apps". It's a good idea to be able to move the metering areas around and see the result. My metering is done after the shot, and applied to the next shot. But you can see the pictures as they're taken when in continuous mode. So I could move the meters during the time lapse and see the result. It might be useful.
Quote
Would you mind summarising your work so far on shot histogram and say how it will fit into the general usage of CHDK, for simpletons like me?
So far, I've just increased the resolution of the histogram. There's only one way to get the results of the histogram, at the moment:

get_histo_range(from,to)

The width of the histogram (range of from,to) is 1024,  The values returned are in percent, from 0 to 100, so it's not accurate enough to set exposure.

I've added the ability to specify a scale:

get_histo_range(from,to,scale)

A scale of 0 gives the actual number of points sampled in that range. I also return the total number of points with get_histo_range(-1)

I'm still experimenting with adding new features to the shot histogram routines. I got side tracked on the shot meter and time lapse timing functions. My plan is to return an exposure compensation value to achieve ETTR or ETTL on the next shot.

So the plan for the histogram routines in the future is to be able to use it for setting exposure similar to the way the shot meters work now.  Stay tuned.

You may want to look at this thread for more info about the new histogram routines I'm working on:
http://chdk.setepontos.com/index.php?topic=9270.0
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Shot Meter Area test
« Reply #163 on: 22 / March / 2013, 10:39:20 »
I did my first test with my new script where I can move and resize the meter areas while looking at the live view. I was able to put a metering area in the bright spot between cloud layers where the sun was setting, resulting in a 2 fstop reduction in exposure compared to the camera meter. I guess it worked.

I need to work on my focus method a little, so it will work with any camera. I've been using:

  post_levent_for_npt("PressSw1AndMF") --toggles manual focus mode

It works on my cameras, but I got a report that it crashed on a camera without manual focus. I need a more generalized method.

I think what I can do is: set_focus(d), press half_shoot, and see if it focused. I think that works on cameras without manual focus. If it didn't focus, then I can try switching to manual focus with the above statement. Hopefully, cameras without manual focus won't get to that statement.

I can't find any way for a script to tell if a camera has manual focus capability. Does anyone know how to do that in a script?

Here's the video with the meter area and size set from the live view:

http://www.youtube.com/watch?v=iFmMxsjB1kM#ws
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


*

Offline reyalp

  • ******
  • 13500
Re: Shot Histogram Request
« Reply #164 on: 24 / March / 2013, 16:18:03 »
If the bug is in fact caused by repeated yields, that should be a significant step toward nailing down the root cause.
FWIW...

To test the hypothesis that there could be some conflict between debug hook yield and explicit yield with sleep() etc, I modified luascript.c to be call the debug hook every vm instruction. (edit  #define YIELD_CHECK_COUNT 1)

with this change set_yield(1...) hangs the camera script. set_yield(2,...) works, and should cause lua to yield every other vm instruction. I've tried running script with while(true) sleep(1) end on my a540 for > 12 hours, and have not seen the error. I also ran it on my d10 for several hours and did not see the error.

As an aside, there is a lua assert if the script is interrupted in the shutter button, presumably due to trying to yield in the restore() function. Problems with restore yielding have been noted before.
« Last Edit: 24 / March / 2013, 16:22:35 by reyalp »
Don't forget what the H stands for.

*

Offline hwntw

  • ***
  • 159
Re: Shot Histogram Request
« Reply #165 on: 24 / March / 2013, 19:51:43 »
I finished adding the shot meter area drawing function posted above to my main time lapse program. It works well, and lets you set the meter areas based on what the camera is seeing.

For sunsets, I'd like to try putting a relatively small metering area over the sun before it sets...
When I added the capability to do multiple meters, I didn't know how I would use them. But now that I can adjust the location and size of each meter, there are a lot of possibilities. A small meter on the brightest part of the picture would be like histogram based exposure compensation. Averaging the meters and putting one inside the other would give a kind of center weighted metering.

To do HDR, for example, you could place one meter on the brightest area, and one meter on the darkest. Then you would take 2 pictures, one based on each meter.
I'm looking forward to exploring the possibilities opened up by being able to set the size and location of 4 different exposure meters. Try the test script in the post above to get an idea of how the meter sizes and postions are set.
...
Making this work on a touch screen camera would replicate app behaviour on iDevices/Android 4.2 devices, where HDR exposures are not made by using preset Ev ranges, but are metered from relevant areas of the shot, multi spot readings if you like, which are identified as High or Low (exposure). I think @philmoz has got CHDK working on a touch screen model, Ixus 310 HS I think. Your shot metering thingy seems to have a large potential for constructive uses
Colin
Ixus 300HS S100


Windows 10

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #166 on: 24 / March / 2013, 20:12:37 »
Making this work on a touch screen camera would replicate app behaviour on iDevices/Android 4.2 devices, where HDR exposures are not made by using preset Ev ranges, but are metered from relevant areas of the shot, multi spot readings if you like, which are identified as High or Low (exposure).
I didn't realize there was "an app for that." Thanks for the info. I love when other people use my ideas before I think of them.  :)

Cell phone cameras area getting way ahead of "real" cameras in functionality because of app capability. It's only a matter of time before a camera company realizes this, and puts app capability on a high end camera. Maybe even the Android operating system would work? But at least for now, we have CHDK.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #167 on: 24 / March / 2013, 20:15:30 »
To test the hypothesis that there could be some conflict between debug hook yield and explicit yield with sleep() etc,
I'm pretty sure this isn't the problem because the bug happened with set_yield(-1,-1). It happened with sleep(10) or coroutine.yield(). It's prevented by using the action stack to wait for the shot to be ready, rather than repeated sleep(10) or coroutine.yield()
Quote
As an aside, there is a lua assert if the script is interrupted in the shutter button, presumably due to trying to yield in the restore() function.
I assume that's one of the "ugly" problems with pcall() you were talking about. Does this only happen with a yield in the yield hook? It seems like doing a sleep() in restore works.

Maybe the C equivalent of set_yield(-1,-1) should be done before calling restore()?

====
I just got back from a camping trip where I left the G1X shooting 1 shot per 1.5 seconds starting at 7 P.M. It was connected to an 8.4 volt lithium external battery that weighs about 1 pound. I was hoping to get a sunset and sunrise in the same time lapse.

The G1X lasted until 11:15 A.M. the next morning, over 16 hours, and was still running. I had to shut it off because it was past time to leave. I ended up with 19,000 pictures, which I'll turn into a test video and post sometime soon.

The moon was out most of the night, so it was hard to see any stars. The moon was badly overexposed, since the shot was metered by the upper half of the picture, and not just the moon. This is where it might be really useful to be able to set the exposure using the histogram instead of the light meter.


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


*

Offline lapser

  • *****
  • 1093
Re: Shot Histogram Request
« Reply #168 on: 25 / March / 2013, 11:22:22 »
Here's the 16 hour time lapse I mentioned in the last post. I actually like the effect of the over-exposed moon and sun, with the clouds going by. I guess it's all art.

To protect the camera, I used plastic wrap, with a rubber band and scotch tape holding it around the base of the lens of the G1X. I screwed in the tripod quick release plate through the plastic wrap with no problem. I also used a lens hood. You can see the screen through the plastic, and all the buttons work fine. The lens and barrel are left uncovered. If it were raining, it might be a good idea to wrap a thin piece of plastic wrap around the extended lens barrel with the camera on.

I think the plastic wrap held in the heat of the camera so it didn't fog up. The lens didn't fog or frost over, although the lens hood was covered with frost.

http://www.youtube.com/watch?v=5O3Jn2OX9P8#ws
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline ahull

  • *****
  • 634
Re: Shot Histogram Request
« Reply #169 on: 25 / March / 2013, 20:08:20 »
lapser  :D - I could watch that all day (don't think I'd get paid though).

 

Related Topics