New uBasic commands for motion stillness, spotmeter,camera shake, etc. - General Discussion and Assistance - CHDK Forum

New uBasic commands for motion stillness, spotmeter,camera shake, etc.

  • 4 Replies
  • 3417 Views
Advertisements
By request in another thread and by personal message, 'tgran' has asked me to post a build for the A570 101a that supports the new 'motion stillness' commands.
He has also requested detailed information regarding what else is included.

You can download the ZIP file here http://www.zshare.net/download/68382044f3d61d4e/


There are two new commands 'shoot_when_camera_steady' and 'shoot_when_no_movement_for'
The first detects minimum camera movement and then takes a photo.
Useful when camera is on a monopod in a dull environment or when hand-holding at telephoto setting.
It requires just two parameters, a sensitivity setting and a parameter for success/time-out return value.
Time-out is fixed at ten seconds.
Motion detection is checked three times over 700 msec.
If the difference between both the first two readings and the last two are less than calculated value photo will be taken and value '1' returned.
If no photo taken within ten seconds, command ends and returns '0'.
To help indicate camera-shake, the inner 77 of the 96 luminance sample-points are displayed as small,rectangular boxes.
You can concentrate on the contents of one of the boxes and try to keep it as steady as possible.
It is not yet known if this command or 'shoot_when_no_movement_for' will be more suitable for KAP.

Here is a simple test script :-


Code: [Select]
@title Camera-shake test
@param a sensitivity
@default a 128
sync_off
:md_loop
rem the larger the sensitivity value, the more difficult to hold steady enough
rem 'b' returns '0' if timeout, '1' if success
b=0
print "About to shoot"
shoot_when_camera_steady a, b
print N," ", b
N = N + 1
sleep_for_seconds 5
goto "md_loop"
end

The 'shoot_when_no_movement_for' command operates over a longer time-scale.
It could be useful for microscopy (protists ?), nature photography or possibly KAP.
It has two mandatory parameters, the length of time (in seconds) that there must be no movement for and a return parameter for success/time-out indication.
The default time-out is ten seconds and sensitivity is 128.
Both those values can be parameters three and four.
Motion is checked-for at the start, middle and end of the 'no motion' time.

Here is a simple script :-

Code: [Select]
@title No-movement test
@param a time still
@default a 5
@param c sensitivity
@default c 128
@param d timeout
@default d 10
sync_off
:md_loop
b=0
print "About to shoot"
shoot_when_no_movement_for a, b, c, d
print N," ", b
N = N + 1
sleep_for_seconds 5
goto "md_loop"
end


There is also a new 'get_luminance' command that returns the average luminance value of 96 samples taken from a 24x16 pixel area in the middle of the screen.
It acts as a spotmeter, but how that relates to scene brightness is unknown.

Code: [Select]
@title Spot meter
N=1
:test_md_loop
get_luminance a
  print N," Luminance ", a
 N = N+1
goto "test_md_loop"


Fudgey's MDFB-080914 now has an option to display the luminance sample-point locations with or without the grid.
A modified version of the script is in the ZIP file.


Finally, two commands for making the entry of aperture or shutter-speed overrides easier:

shutter_speed  1/5000
aperture       5.6

(those are the commands and that is how the values are entered)

This build is for testing only.


David

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: New uBasic commands for motion stillness, spotmeter,camera shake, etc.
« Reply #1 on: 14 / November / 2009, 06:52:42 »
Sounds good.

These are all useful functions. But all these functions are used only with SDM. I don't use SDM.

Why do you not post the source code? That would be very helpful for all. Even better would be a patch  file against chdk trunk. Then everyone could certainly test this very useful functions.

msl

CHDK-DE:  CHDK-DE links

Re: New uBasic commands for motion stillness, spotmeter,camera shake, etc.
« Reply #2 on: 14 / November / 2009, 07:23:12 »
Sounds good.
If you tell me your camera I can build you a version.

Quote
I don't use SDM.
It depends what your requirements are.
As a matter of interest, what features do you use in CHDK that are not in SDM ?

Quote
Why do you not post the source code?
When new versions are officially released the source-code is posted on the website.
The link is at the bottom of the individual camera links.

Quote
Even better would be a patch  file against chdk trunk.

You must be joking  :)

SDM is so different to CHDK that is not possible.

(SDM was the first independent version of GrAnd's original code).

You must realise that I am not an expert programmer, I am a (stereo) photographer who is simply creating a useful  tool.
People like 'reyalp' who can write elegant, tidy, efficient code must despair at my efforts !

I have other things to do, I do not have time to learn about SVN, compiling, etc.

SDM users could not care less how elegant the code is  :)

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: New uBasic commands for motion stillness, spotmeter,camera shake, etc.
« Reply #3 on: 14 / November / 2009, 08:41:52 »
Of course was asking for a patch file against CHDK trunk a little provocation. ;)

You make a great job with your SDM.

But SDM is not my thing and I'm not a stereo photographer. I like better the normal version, for example, because Lua.

It would be very nice if there were better ways to use your brilliant ideas in the normal version.

And by the way, is SVN an easy thing without investing much time.
CHDK-DE:  CHDK-DE links


Re: New uBasic commands for motion stillness, spotmeter,camera shake, etc.
« Reply #4 on: 14 / November / 2009, 09:24:12 »
I like better the normal version, for example, because Lua.

Fair enough, it is very unlikely that I will ever provide Lua support, for a variety of reasons.

Quote
SVN an easy thing without investing much time.

Reyalp mentioned that to someone (Whim ?) and they immediately had problems.

 

Related Topics