proposal - script shooting hooks - page 27 - General Discussion and Assistance - CHDK Forum

proposal - script shooting hooks

  • 290 Replies
  • 120974 Views
*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #260 on: 01 / September / 2015, 15:44:13 »
Advertisements
Yes, of course. On the first run, I want only to try how my stuff works.
So an –1EV shift gives you mval96 == -96?
Correct. The mval96 is in (approximately) the same units as the APEX*96 units used by the canon firmware for settings, with 0 set at the "neutral" value.
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1251
Re: proposal - script shooting hooks
« Reply #261 on: 07 / September / 2015, 03:58:53 »
Quote
I originally started with lots of ifs like this.

According to some experiences, I now understand what you mean. The adaptation of overexposure I first abandoned.

I then concentrated only on the oscillation at constant lighting condition.

When I run rawopint with constant lighting condition (same like isoinc), it was pretty easy to generate oscillation. How do you run isoinc.lua? Also like you describe for drtest.lua against a monitor?

First I analyzed the smooth stuff in rawopint and I can say, the smooth stuff did already a good job. Without smooth it gets even worse.

Then I added only the following code on the end of the smooth stuff. I tried other functions like ev_change^2 but this was even harder. This code only reduces changes. So ev_change 3 goes to 2, 2 to 1 and 1 to 0.

Code: [Select]
        if (ev_change >= -3 and ev_change <= -1) then
             ev_change_mod = ev_change + 1
         end
         if (ev_change >= 1 and ev_change <= 3) then         
             ev_change_mod = ev_change - 1
         end

Yes of course, this helps for oscillation at constant lighting condition.
When you see the ‘rawopint_compare3’ plot, you see 100 shots with my code changes and 100 with your original code on constant lighting condition. So you don’t see oscillation produced by the code anymore. Yes meter96 stays I little bit more far away from 0, but this should be Ok.

Then I run the changes under real condition.

http://youtu.be/T5YagfYfPA0


The plot  ‘JCrawopint_test3’ shows you the result. Meter96 is now above or under 0. There is no up and down more in d_ev but you can still see parts of oscillation. Around picture 420 you see even oscillation, when rawopint made no changes. But this might be come from the scene. I think the changes are not really a improvement.

I saw in your comments, to make smoothed fraction be configurable. This might be a good idea.

My understanding about meter and meter96 was, that meter has a high resolution. So it may be helpful, not to work with a meter96 value, and to work with a meter96*100 internal. Also to work with a smoothed fraction it would be helpful, to work with an ev_change *100 value internal, and only change this value when it is set to the cam.


At the end of the day I definitely now much more understood by the algorithm in rawopint...



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

*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #262 on: 07 / September / 2015, 13:12:31 »
When I run rawopint with constant lighting condition (same like isoinc), it was pretty easy to generate oscillation. How do you run isoinc.lua? Also like you describe for drtest.lua against a monitor?
Yes. Note an LCD monitor can have some flicker, but under normal conditions I think exposure will be long enough that it doesn't matter.

I don't think there should be oscillation in rawopint in constant lighting if over or under protection isn't active, unless shutter speed is high enough to run into precision issues. However, I haven't actually tested like that, so maybe there is.

edit: You should be able to tell if it's real change or the algorithm by looking at the meter value. Of course, noise an thermal effects will cause some changes in sensor values even if the actual scene isn't changing.
edit 2: of course, meter will change *after* the exposure changes. Bv should tell you the real scene brightness, assuming there is no clipping and exposure controls are accurate.


Quote
I saw in your comments, to make smoothed fraction be configurable. This might be a good idea.
Now you understand why the script has so many options ;)
There are probably some more sophisticated smoothing algorithms that could be used too.

Quote
My understanding about meter and meter96 was, that meter has a high resolution. So it may be helpful, not to work with a meter96 value, and to work with a meter96*100 internal. Also to work with a smoothed fraction it would be helpful, to work with an ev_change *100 value internal, and only change this value when it is set to the cam.
Meter is the raw sensor count, meter96 is converted to log scale like APEX values. Working with a higher precision version of meter96 an interesting idea. A simple way to do this might be to use imath http://chdk.wikia.com/wiki/Lua/Lua_Reference#Mathematical_functions_.28imath_library.29 (but you have to be careful of overflow)

The C code would need a function to return raw_to_ev96 as a scaled value, which is probably a good idea anyway.

Another note, in theory we can set the shutter speed directly in microseconds. The actual precision of the hardware is unknown (a shutter testing script like isoinc would be useful), but it should be possible to adjust exposure in steps smaller than 1/96th ev for some of the range. This isn't currently possible through script though.
« Last Edit: 08 / September / 2015, 16:34:38 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #263 on: 07 / September / 2015, 19:17:02 »
In trunk 4241, I changed the rawop functions raw_to_ev96 and ev96_to_raw. They are now called raw_to_ev and ev_to_raw, and take an optional scale factor as the second argument. The default scale factor is 96, giving the same results as the previous functions.

Other scale factors that might make sense are 1000, if you wanted to work in standard APEX using imath, or 96000, if you want to work in APEX*96 using imath.

By way of example, drtest now reports the meter96 values to 3 decimal places.

I temporarily added the ev96 names in rawoplib.lua, so the current version of rawopint etc will continue to work. I plan to remove these before 1.4 is released.

I also noticed that the double/int conversions in the current code truncate rather than rounding. I will probably change this.

edit:
Done in 4243. I don't think this will have a big effect, but the meter96 values should follow the meter values a bit more accurately. Note the the meter function itself (taking the average raw values) is all integer, so it still truncates.
« Last Edit: 07 / September / 2015, 21:17:34 by reyalp »
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #264 on: 07 / September / 2015, 23:50:32 »
I started a documentation page for the rawop stuff on the wiki http://chdk.wikia.com/wiki/Lua/Raw_Hook_Operations

This is mostly based on comments in the rawhookop.c source, so nothing really new.
Don't forget what the H stands for.

Re: proposal - script shooting hooks
« Reply #265 on: 08 / September / 2015, 00:06:40 »
I started a documentation page for the rawop stuff on the wiki http://chdk.wikia.com/wiki/Lua/Raw_Hook_Operations

This is mostly based on comments in the rawhookop.c source, so nothing really new.
Nice.

For reference,  the actual hooks were there in 1.3.0 though?  The additional functionality is related to manipulating the raw data once you hit the callback in the hooks?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #266 on: 08 / September / 2015, 00:42:50 »
For reference,  the actual hooks were there in 1.3.0 though?  The additional functionality is related to manipulating the raw data once you hit the callback in the hooks?
Right "Script Shooting Hooks" were added in 1.3, and have their own page  http://chdk.wikia.com/wiki/Script_Shooting_Hooks

The new page only describes "rawop", the system for interacting with the raw buffer while you are in the raw hook.

I'll add a link from the raw hook section of the shooting hooks page to the rawop page after I have the rest of the the content up. I put rawop on it's own page, because it's distinct from the general hook system, and pretty long all by itself.
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1251
Re: proposal - script shooting hooks
« Reply #267 on: 15 / September / 2015, 03:49:41 »
I have a mismatch between the log file and what I have calculated from the pictures on over fraction.
The data from log file shows me a jump in over fraction between line 635 and 636 from 0.1013 to 0.984. When I calculated over fraction from the picture, I don’t have the jump. Yes of course, my threshold is different so the curves have an offset. But I don’t find the jump.

For me it looks like that the correct value on Line 636 is not 0.984 rather 0.0984. So it might be an error of conversion or may be my tooling.

Don’t hurry about this…

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

*

Offline reyalp

  • ******
  • 14125
Re: proposal - script shooting hooks
« Reply #268 on: 26 / September / 2015, 23:39:34 »
c_joerg: That jump sounds like a bug in the logging code, I'll have a look.

Another moon test with elph130


Settings
Zoom 224mm (35 mm equivalent)
Focus at infinity (canon UI)
Interval 2 sec
Meter width and height 90%
Meter step 13
Bv Ev shift % 20
Bv Ev shift base Bv 8
Max Tv 4000 (4 second)
Target ISO 100
ISO adj TV 250 (1/4 sec)
Max ISO 400
Meter low thresh -Ev 2 1/2
Meter low limit -Ev 3 3/4
Meter low max weight 100 (no meter weight increase for low, but thresh and limit are still used for Bv Ev shift)
Overexp thresh 5
Overexp Ev range 1/2
Oeverexp prio 5
Underexp thresh 0 (disabled)
Histogram step 9

It gets dark suddenly at the end because of the streetlight triggering overexposure. Oops :haha
Now I have a reason to make the histogram area adjustable.

Aside from that and the camera being on a slightly unstable surface, I think it worked pretty well. (edit: but the moon left the frame before it was really dark, so it wasn't a really challenging scene)

A few frames at the start and end of the run aren't included in the video since I was moving the camera around.
« Last Edit: 26 / September / 2015, 23:42:31 by reyalp »
Don't forget what the H stands for.

*

Offline c_joerg

  • *****
  • 1251
Re: proposal - script shooting hooks
« Reply #269 on: 27 / September / 2015, 11:51:28 »
It looks good. I have seen you have some new information in the log file.
Quote
Aside from that and the camera being on a slightly unstable surface,
I had a couple of runs which get a Image registration …

I would be helpful, if you could post the saved parameter sets, so I have only to copy it on my SD card to test the same set of parameters.

Tonight we have a full lunar eclipse. Hope the weather clears up. All my cams a prepaid…

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


SimplePortal © 2008-2014, SimplePortal