Author Topic: Script that will fire on focus change?  (Read 4091 times)

Offline A_Str8

  • Jr. Member
  • **
  • Posts: 59
    • www.ahdchild.com
Re: Script that will fire on focus change?
« Reply #15 on: 31 / May / 2008, 01:53:18 »
Just tried fudgey's script and all I get is ***STARTED*** after I push the shutter. I put it into <alt> mode, press and release the shutter while pointed at infinity, and get ***STARTED***. Then I move until I'm pointed at something closer and it never focuses. I've tried in P and AUTO, I've tried pressing and releasing the shutter, and just pressing and holding. I think I'm missing something, or the script doesn't work.

Keep trying guys it looks like we're getting close!!
I just tried fudgey's script and it seems to be working for me.

Offline vwalton

  • Rookie
  • *
  • Posts: 8
Re: Script that will fire on focus change?
« Reply #16 on: 31 / May / 2008, 19:16:11 »
I tried the new script and got: uBasic:30 unk stmt

So I figured, that must be the N on line 30 - it doesn't like upper case at all. I changed the whole script into lower case and ran it again. Now I get "starting" in the viewfinder and no uBasic errors, but I can't get it to fire. I left it at the default settings 26 for distance and 2 for range, and it just sits there for about 2 minutes then shuts off. It does focus during that 2 minutes so something is happening, but not what we want.

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Script that will fire on focus change?
« Reply #17 on: 31 / May / 2008, 22:42:22 »
I tried the new script and got: uBasic:30 unk stmt

So I figured, that must be the N on line 30 - it doesn't like upper case at all. I changed the whole script into lower case and ran it again. Now I get "starting" in the viewfinder and no uBasic errors, but I can't get it to fire. I left it at the default settings 26 for distance and 2 for range, and it just sits there for about 2 minutes then shuts off. It does focus during that 2 minutes so something is happening, but not what we want.


The only thing I can think of is that your build is ancient enough not to support capitalized variables in ubasic.
Upgrade your CHDK, for instance http://malbe.nm.ru/chdk/.

And remember to disable the flash while testing, problems caused by flash modes can lead us astray.

Offline vwalton

  • Rookie
  • *
  • Posts: 8
Re: Script that will fire on focus change?
« Reply #18 on: 01 / June / 2008, 03:08:27 »
The only thing I can think of is that your build is ancient enough not to support capitalized variables in ubasic.

...


Yes that was it. I was using pre14-s2is-100f-148; upgraded to allbest-s2is-100f-50 and now the script runs. It doesn't fire the shutter though - I may be using it wrong and don't have time to double-check right now. I've set:
a=20
b=1
c=5
y=1 (0 didn't work either)

I get a display at the top of the screen which I guess is the distance, but it's in a weird format that I can't decipher, and it doesn't change much as I change where I'm pointing the camera.

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Script that will fire on focus change?
« Reply #19 on: 01 / June / 2008, 12:57:23 »
Maybe you should try my script first, with the default parameters it's pretty simple. Just point first at something fairly close by that you know the camera will be able to focus at and work from there.

To know what the camera is doing, you really should enable the DoF calculator to see the current focus distance on your LCD. With the subject distance (SD) and depth of field (DOF) on screen, you can better foresee what's going to be in focus. The way I like to have DoF calculator set is:

Go to CHDK menu OSD -> DOF Calculator and enable for instance "Show DOF Calculator In Misc" and "Shot Subj. Dist. in Misc" and "Show Depth of Field in Misc" and "Subject distance from lens".

Go to CHDK menu OSD -> Miscellaneous Values -> Show Misc Values: Always


Offline vwalton

  • Rookie
  • *
  • Posts: 8
Re: Script that will fire on focus change?
« Reply #20 on: 01 / June / 2008, 18:38:25 »
I tried your script just now and when I half-press the shutter I get some numbers at the top that I can't interpret (R1/R2/...) and when I push it all the way I get "starting" and the camera hangs until I turn it off.

When I enable DoF as you suggested (thanks for the instructions!) it's weird - when I point at an object about 25 feet away it says SD 1.8 ... 1.8 what?? It's way more than 1.8 meters away. Not only that, if I focus  on the same object four times I get four different values: 1.8, 1.3, 2.0, 1.5.

Offline fudgey

  • Global Moderator
  • Guru Member
  • *****
  • Posts: 1690
  • a570is
Re: Script that will fire on focus change?
« Reply #21 on: 01 / June / 2008, 19:08:34 »
I tried your script just now and when I half-press the shutter I get some numbers at the top that I can't interpret (R1/R2/...) and when I push it all the way I get "starting" and the camera hangs until I turn it off.


Did you forget to delete your old chdk.cfg before upgrading to Allbest?

When I enable DoF as you suggested (thanks for the instructions!) it's weird - when I point at an object about 25 feet away it says SD 1.8 ... 1.8 what?? It's way more than 1.8 meters away. Not only that, if I focus  on the same object four times I get four different values: 1.8, 1.3, 2.0, 1.5.


As for getting 4 different values, the camera is probably focusing to a slightly different distance each time, maybe even changing aperture.

And why SD is wrong.... well. I'm truly no expert in photography or the DoF calculator. Try reading the the new pdf manual, wiki and their links about the hyperfocal distance, DoF and DoF calculator. Basically, if the pdf manual is correct, the displayed DoF is near limit + 0.33*DoF. And according to http://en.wikipedia.org/wiki/Depth_of_field, that's just a common approximation which is only accurate if the subject happens to be at 1/3 of hyperfocal distance. So, add hyperfocal distance to your DoF calculator display and find out how far from it you are.

Offline A_Str8

  • Jr. Member
  • **
  • Posts: 59
    • www.ahdchild.com
Re: Script that will fire on focus change?
« Reply #22 on: 02 / June / 2008, 12:06:20 »
When I enable DoF as you suggested (thanks for the instructions!) it's weird - when I point at an object about 25 feet away it says SD 1.8 ... 1.8 what?? It's way more than 1.8 meters away. Not only that, if I focus  on the same object four times I get four different values: 1.8, 1.3, 2.0, 1.5.
at one point when I was testing my script, I had it printing all the focus values. I learned that focus distance can be really erratic, at least on my camera. If you ar elooking at the distance values, it may be normal for them to be weird. 4 different values when focusing on 1 object was definitely the norm for me.

Offline brainwash

  • Jr. Member
  • **
  • Posts: 95
  • Nikon D40x & A460
Re: Script that will fire on focus change?
« Reply #23 on: 22 / August / 2008, 20:11:17 »
My advice will probably not be very useful to you, but perhaps to others. I used to have the same problem with following birds and other objects in the sky. The only way to get a clear picture of a fast-moving object is to do panning. As a bonus you also get blurred background.
To set up: zoom in on an object at about the desired image distance and frame as desired. Focus on that (static) object and see what values you get for focus distance, focus depth and hyperfocal. Now set your manual focus, zoom and aperture (raise f-number if possible) to include the estimated depth of field. Half-press shutter to see if the displayed values are what you want.
The trick with high-speed panning is to know your camera well and treat it like a bionic eye ;) Practice tracking the object at wide angle while keeping it into the center of the frame. Then zoom in, little by little, and practice keeping it centered. It helps to use EVF instead of big LCD.
Remove picture review from menu (default is something like 2 secs) and while tracking either set burst mode or full-press, release to half press, full-press, a.s.o. until you get a set of pictures. Then you can start deleting from that.
As an example I have two photos which have taken about 4 seconds to shoot - that is: grab and switch on camera while removing lenscap, put camera to eye and follow object while zooming in at full tele (12x), half-press to acquire focus, shoot two or three photos if you're lucky while keeping the shutter half-pressed.
Poze Album/Sociale/2008_05_10_Valiug/IMG_6860.JPG/
Poze Album/Sociale/2008_05_10_Valiug/IMG_6873.JPG/

You can keep the other eye open while viewing through the EVF, might help you acquire the object into frame better.

CHDK Forum

Re: Script that will fire on focus change?
« Reply #23 on: 22 / August / 2008, 20:11:17 »

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal