Manual focusing with zoom button SX20 - Script Writing - CHDK Forum  

Manual focusing with zoom button SX20

  • 10 Replies
  • 4245 Views
Manual focusing with zoom button SX20
« on: 06 / January / 2011, 05:18:05 »
Advertisements
I don't know where to post this but is there someone working on that option for the SX20? This would be one of the most used option for me. Thanks to anyone who can give me an answer.
SX20 1.02d

Re: Manual focusing with zoom button SX20
« Reply #1 on: 07 / January / 2011, 13:40:20 »
I can't believe no one with an SX20 wouldn't like that option? What about a Guru here on these forums answer me on this??? ???
Where are all these people who can write scripts. Can I get some feedback here please?
SX20 1.02d

*

Online reyalp

  • ******
  • 13156
Re: Manual focusing with zoom button SX20
« Reply #2 on: 07 / January / 2011, 15:58:36 »
Focus override with zoom keys is usually only done for cameras that lack MF.

You should be able to write a script that detects zoom clicks and presses whatever the normal focus keys are instead. Of course, you'd have to be running this script whenever you wanted to use it, which may not be convenient.
Don't forget what the H stands for.

Re: Manual focusing with zoom button SX20
« Reply #3 on: 07 / January / 2011, 17:09:28 »
On the contrary. For the type of shooting I do, that would be very convenient. But the thing is...I have absolutely no knowledge about script writing, so now my question is this. Is there someone somewhere that has a script that would work on an SX20 and if not, can someone please write one?
SX20 1.02d


*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Manual focusing with zoom button SX20
« Reply #4 on: 08 / January / 2011, 19:39:21 »
« Last Edit: 19 / April / 2011, 17:48:56 by SkyWalker9 »

Re: Manual focusing with zoom button SX20
« Reply #5 on: 08 / January / 2011, 23:35:52 »
Thank you very much! It is getting late here so I will try to make this work probably tomorrow or in a few days and tell you how it went. Very kind of you.
SX20 1.02d

Re: Manual focusing with zoom button SX20
« Reply #6 on: 09 / January / 2011, 09:44:49 »
I played with this script a little while this morning and it work but the default "step" parameter is too low to even see a difference in focusing. I only started to see a difference when at approx. 30. Then I switched it to 40 and there with every click of the zoom button, the effect were more noticeable.

One question. What are these "steps" anyway? Do they represent centimeters or inches? Either way that can't make sense because when set at 30 or 40 it would mean that every click would have an increment of 40 centimeters which would be like 16 inches. And if these steps are in inches, it make even less sense because with every click, there sure ain't that big of a step even at 40. So what are they?

Again I thank you very much for taking the time to write that script and i am sure that in the future, this will be very helpful for me.
SX20 1.02d

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Manual focusing with zoom button SX20
« Reply #7 on: 09 / January / 2011, 14:04:27 »
...the default "step" parameter is too low ... switched it to 40 and there with every click of the zoom button, the effect were more noticeable...What are these "steps" anyway? Do they represent centimeters or inches?
Recommend changing the "@default b 5" line in the code to read "@default b 40" to make the script easier to use at startup - thanks for your input. During my testing I noticed similar results, but I got distracted while verifing the focus values were changing appropriately and forgot to go back and change to a more realistic default.

As to your question on what the focus value represents. According to the UBasic refernce guide the command "get_focus x" represents the distance value in mm. Unfortunately, ExifPro didn't indicate what the "Subject distance" is measured in, but it appears the value is measured in cm. (My camera was around 42 inches from the subject and the ExifPro "Subject Distance" indicated "108" as the value.) Knowing this, it might then be easier when doing DOF bracketing/stacking images using this script. You would just measure the distance to a subject, adjust "focus" accordingly and then do DOF bracketing/stacking to ensure a better quality image with greater DOF. This theory remains to be tested...
« Last Edit: 09 / January / 2011, 14:36:53 by SkyWalker9 »


Re: Manual focusing with zoom button SX20
« Reply #8 on: 09 / January / 2011, 14:41:04 »
From what I have experienced, the Step parameters are in Millimeters (mm).

For very close Macro work like the SX20 is capable to achieve...meaning that the object is only 1 or 2 centimeters away from the front of the lens, I have found that I need to lower the value to about 10 or 15. Having said that, if I were to photograph something much farther (like I was trying to do in my first test shots) it seems that this is when the Steps need to be higher.
SX20 1.02d

*

Offline SkyWalker9

  • ****
  • 301
  • SX20 IS (fw 1.02b)
Re: Manual focusing with zoom button SX20
« Reply #9 on: 09 / January / 2011, 17:30:47 »
For very close Macro work like the SX20 is capable to achieve...meaning that the object is only 1 or 2 centimeters away from the front of the lens, I have found that I need to lower the value to about 10 or 15. Having said that, if I were to photograph something much farther (like I was trying to do in my first test shots) it seems that this is when the Steps need to be higher.
I changed the script to incorporate your observations. Instead of the "Step" parameter being the "amount" to change each time, I changed the "Step" parameter to be the "amount times 5" to change each time. Should make it easier to change step values - the Step parameter would be "2 or 3" for macro and "7 or 8" for routine photos.

I also incorporated a safety check in case the user sets the "Step" parameter less than 1.

Code: [Select]
rem Author SkyWalker9
@title ZmFocus
@param b Step size [x5]
@default b 8

if b<1 then b=1
b=b*5

sleep 500

get_focus f
print "focus: ", f
print "Zoom IN or OUT"

sleep 1000
press "shoot_half"

:loop
   wait_click 10000
   is_key k "zoom_in"
   if k=1 then gosub "zoom_in"
   is_key k "zoom_out"
   if k=1 then gosub "zoom_out"
goto "loop"

:unknown
  print "Zoom IN or OUT"
return

:zoom_in
  f=f+b
  set_focus f
  print "focus: ", f
return

:zoom_out
  f=f-b
  set_focus f
  print "focus: ", f
return

sleep 1000
release "shoot_half"

:end
end

Update 4-19-11: When using the wait_click statements, some cameras require the timeout be specified; recommend starting with "wait_click 10000" (10secs). The script has been updated to reflect the change.
« Last Edit: 19 / April / 2011, 17:49:40 by SkyWalker9 »

 

Related Topics