set_mf() and set_focus() - Script Writing - CHDK Forum  

set_mf() and set_focus()

  • 13 Replies
  • 5260 Views
*

Offline dvip

  • ****
  • 451
set_mf() and set_focus()
« on: 14 / January / 2015, 21:17:06 »
Advertisements
I can get this to focus to 2 feet:

  set_mf(1)
  print("2 feet")
  set_focus(523)
  set_mf(0)
  sleep(1000)
  shoot()

But I can't get this to focus to 2 inches:

  set_mf(1)
  print("2 inches")
  set_focus(50)
  set_mf(0)
  sleep(1000)
  shoot()

However, this does focus to 2 inches:

  post_levent_for_npt("PressSw1AndMF")
  print("2 inches")
  set_focus(50)
  sleep(1000)
  shoot()

Any ideas why the second case won't focus to 2 inches?


Re: set_mf() and set_focus()
« Reply #1 on: 14 / January / 2015, 21:31:50 »
Camera ?  CHDK version used ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline dvip

  • ****
  • 451
Re: set_mf() and set_focus()
« Reply #2 on: 14 / January / 2015, 21:33:29 »
a590-101b-1.4.0-3916-0-full

Re: set_mf() and set_focus()
« Reply #3 on: 14 / January / 2015, 21:43:19 »
a590-101b-1.4.0-3916-0-full
Thanks!  FWIW, the whole CHDK manual focus override thing has gotten a lot better with 1.3.0's release.  But it still hits "road bumps" regularly and exact behavior varies from camera to camera model.

According to the "official" spreadsheet linked here : ( http://chdk.setepontos.com/index.php?topic=11078.0 ) the a590 should allow you to set the focus distance in pretty much every MF mode.  Including not using set_mf() at all!   And the fact that if focusses at 2 feet seems to confirm this.

This :

Code: [Select]
  print("2 inches")
  set_focus(50)
  sleep(1000)
  shoot()
should work all by itself.  Give it a try and report back?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14109
Re: set_mf() and set_focus()
« Reply #4 on: 14 / January / 2015, 21:47:02 »
  set_mf(1)
  print("2 feet")
  set_focus(523)
  set_mf(0)
  sleep(1000)
  shoot()
I don't understand why you are doing set_mf(0) before shooting. If you do that, the camera should go back to autofocus, and your setfocus setting may or may not be applied.
Don't forget what the H stands for.

Re: set_mf() and set_focus()
« Reply #5 on: 14 / January / 2015, 21:48:09 »
doh
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline dvip

  • ****
  • 451
Re: set_mf() and set_focus()
« Reply #6 on: 14 / January / 2015, 22:23:59 »
Yep, using set_mf(0) was messing things up.  :o
Thanks!  :D

Re: set_mf() and set_focus()
« Reply #7 on: 14 / January / 2015, 22:33:58 »
Yep, using set_mf(0) was messing things up.  :o
Thanks!  :D
Does not using set_mf() at all work for the A590 as I suggested?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline dvip

  • ****
  • 451
Re: set_mf() and set_focus()
« Reply #8 on: 14 / January / 2015, 23:47:57 »
Yes, it works without using set_mf() at all work.

But now I'm having another problem.
I am using set_focus(65535) and the image is not sharp.
But the image is sharp if I use AF. And if I switch to MF the cam is at infinity.

I'm using the same distance (25 feet)  and subject on a tripod, using the timer to avoid cam shakies.
Used all kinds of numbers ( 523 - 65535) with set_focus() but nothing beats AF in sharpness.

When I use get_focus with the same distance and subject it returns 65535.
How accurate is get_focus()?
It keeps returning 65535 (infinity?) even when the subject is 25 feet away.
 
This is what I'm using to test it:

press "shoot_half"
sleep 1000
get_focus f
sleep 1000
print "get_focus returns: ", f
sleep 3000
release "shoot_half"


Re: set_mf() and set_focus()
« Reply #9 on: 15 / January / 2015, 08:13:07 »
But now I'm having another problem.
I am using set_focus(65535) and the image is not sharp.
But the image is sharp if I use AF. And if I switch to MF the cam is at infinity.
This is becoming an "old story".  For cameras without built-in MF capability, the set_focus() function does not work particularly well.   The camera's AF mode functions in a feedback loop - the camera moves the focus mechanism to get a sharp picture and does not know or care what the actual focus distance is.

More stuff to read here if you are interested :

Manual Focus @ Infinity not working
Setting focus from scripts or menus
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal