Manual Focus @ Infinity not working - page 9 - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum
supplierdeeply

Manual Focus @ Infinity not working

  • 151 Replies
  • 46018 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: Manual Focus @ Infinity not working
« Reply #80 on: 06 / November / 2014, 17:40:27 »
Advertisements
Okay, here's the test procedure (with the script loaded and ready to go)
sx280, 1st run starts with AF, second run starts with cam in MF and at "infinity" according to its bar graph. Target is about 60 meters away.
Code: [Select]
MF Test 2.2 65.5m SD modes:AF&MF
focus=0.7m hyperF=1.0m
AUTO: SD:0.6m mecha:1118
warning : may not focus in AFL mode
AFL inf: SD:0.6m mecha:1118
AFL hyp: SD:0.6m mecha:1118
AFL hx2: SD:0.6m mecha:1118
MF  inf: SD:infinity mecha:1111
MF  hyp: SD:0.9m mecha:1116
MF  hx2: SD:2.1m mecha:1113
*** FINISHED ***
MF Test 2.2 65.5m SD modes:AF&MF
focus=0.9m hyperF=1.0m
AUTO: SD:0.7m mecha:1117
warning : may not focus in AFL mode
AFL inf: SD:0.9m mecha:1116
AFL hyp: SD:0.9m mecha:1116
AFL hx2: SD:0.9m mecha:1116
MF  inf: SD:infinity mecha:1111
MF  hyp: SD:0.9m mecha:1116
MF  hx2: SD:2.1m mecha:1113
*** FINISHED ***
As expected, #1, #2, #3, #4 and #6 are OK, #7 is somewhat blurry, #5 is blurry. Blur is caused by focus being over infinity.

I'd like to note that there are still lots of (focus)lens related event procedures to try...

Re: Manual Focus @ Infinity not working
« Reply #81 on: 06 / November / 2014, 18:13:35 »
sx280, 1st run starts with AF, second run starts with cam in MF and at "infinity" according to its bar graph. Target is about 60 meters away.
As expected, #1, #2, #3, #4 and #6 are OK, #7 is somewhat blurry, #5 is blurry. Blur is caused by focus being over infinity.
The focus distances reported (which come from a get_focus() call) are strange,  I'd put that down to the sx280 being a "work in process" DIGIC6 port except that I've seen that on other cameras.  The value is grabbed after a press("shoot_half")  and get_shooting() == true so I'm not sure what is wrong.

Quote
I'd like to note that there are still lots of (focus)lens related event procedures to try...
There certainly are.  And many of them have very scarey names unless bricking your camera is the goal. :P

I played with
Code: [Select]
call_event_proc("MoveFocusLensWithPosition",p) and
Code: [Select]
call_event_proc("MoveFocusLensToPosition",p)after using
Code: [Select]
if (call_event_proc("Mecha.Create") == -1) then
  if (call_event_proc("MechaRegisterEventProcedure") == -1) then
    error("Mecha.Create failed")
  end
end

Nothing much happened - not sure if I'm registering it wrong or maybe the value I passed as "p" was wrong.  I did get a return value of 7 - which suggests it did not reject it with a -1 (although I understand -1 can be valid too).

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Manual Focus @ Infinity not working
« Reply #82 on: 06 / November / 2014, 18:57:57 »
The focus distances reported (which come from a get_focus() call) are strange,  I'd put that down to the sx280 being a "work in process" DIGIC6 port except that I've seen that on other cameras.
I don't think the underlying fw routines are incorrectly identified. It's just that SD values are way off at wide angle.

Quote
There certainly are.  And many of them have very scarey names unless bricking your camera is the goal. :P
Indeed. I'd stay away from anything that seems related to calibration (especially that "load" and "save" does not always mean what they are supposed to - when they appear in an eventproc name).

"MoveFocusLensWithPosition" has 3 arguments: 1) signed halfword 2) halfword 3) word
"MoveFocusLensToPosition" has two: 1) halfword 2) word
"MoveFocusPosition" has only one (halfword)

If less arguments are provided, the eventproc will get junk for the remaining arguments.

Re: Manual Focus @ Infinity not working
« Reply #83 on: 07 / November / 2014, 03:54:40 »
Quote
It certainly is a big script.  You might try simply enabling Canon AFL mode via the Canon buttons prior to launching the script and then your kite.
I've already tried this. as far as any other action is disturbing all ran correctly. but randomly, some zoom, playback.... commands may interact with MF, changing the focus !
I"ve so many times experienced very good results "at home", implementing them in script and - randomly - got hundred of blurred pics. with multiple cameras, assuming that maybe the camera was guilty. my conclusion is that for unknown reasons, MF is still under camera control when running scripts.
for the test here are the results
MF Test 2.2 65.5m SD modes:AF,AFL,MF
focus=infinity hyperF=1.8m
AUTO: SD:infinity mecha:291
AFL inf: SD:infinity mecha:300
AFL hyp: SD:1.8m mecha:307
AFL hx2: SD:4.4m mecha:303
MF  inf: SD:infinity mecha:300
MF  hyp: SD:1.8m mecha:307
MF  hx2: SD:4.4m mecha:303
*** FINISHED ***
MF Test 2.2 65.5m SD modes:AF,AFL,MF
focus=infinity hyperF=1.8m
AUTO: SD:infinity mecha:292
AFL inf: SD:infinity mecha:300
AFL hyp: SD:1.8m mecha:307
AFL hx2: SD:4.4m mecha:303
MF  inf: SD:infinity mecha:300
MF  hyp: SD:1.8m mecha:307
MF  hx2: SD:4.4m mecha:303

I guess these are anticipated values, at least for "at home" tests  :D


*

Offline srsa_4c

  • ******
  • 4451
Re: Manual Focus @ Infinity not working
« Reply #84 on: 08 / November / 2014, 18:51:27 »
Script v 2.2 crashes the S3IS when either AFL or MF is selected as script option. V 1.0 does not crash the camera. Crash reason is the usual FocusLensController.c assert. Note that I commented out these lines for this propset 1 camera (at least one of the propcases is undefined)
Code: [Select]
--if ( get_prop(props.CONTINUOUS_AF)  ~= 0) then print("   ..warning : Continuous AF mode enabled ".. get_prop(props.CONTINUOUS_AF)) end
--if ( get_prop(props.SERVO_AF) ~= 0) then print("   ..warning : Servo AF enabled "..get_prop(props.SERVO_AF)) end

Re: Manual Focus @ Infinity not working
« Reply #85 on: 08 / November / 2014, 19:06:18 »
As an interesting update / aside,  the S100 user who originally reported "focus at infinity" issues has the same issue using Canon MF.   So if the Canon UI can't MF at infinity either,  I guess it makes sense for CHDK to have issues too. 

So now I'm not sure how much of a problem we really have? 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Manual Focus @ Infinity not working
« Reply #86 on: 09 / November / 2014, 09:45:20 »
So now I'm not sure how much of a problem we really have?
People relying on the CHDK "Inf" distance may get frustrated - depending on how ideally their camera behaves.
We could either remove it from the menu, or give a UI that lets one record the camera's "real" infinity distance. Since that depends on the current zoom step, it could be stored in a table.
Since that kind of UI can be overkill for the CHDK core, perhaps it can be done by scripting.
(Usage could be like: point the camera to a distant target that the camera's AF can find easily, the script will crawl through all zoom steps and record the measured distance value)...?

Also, I'm not completely sure what fabri22's problem is: is he unable to find a distance value that will set his cam to infinity?

Re: Manual Focus @ Infinity not working
« Reply #87 on: 09 / November / 2014, 11:17:19 »
tl;dr :need a way to find and set a "safe" value for set_focus() to use as "infinity"

People relying on the CHDK "Inf" distance may get frustrated - depending on how ideally their camera behaves.
Very true - that's exactly what led to this thread and the other one :  Setting focus from scripts or menus

Quote
We could either remove it from the menu, or give a UI that lets one record the camera's "real" infinity distance. Since that depends on the current zoom step, it could be stored in a table. Since that kind of UI can be overkill for the CHDK core, perhaps it can be done by scripting. (Usage could be like: point the camera to a distant target that the camera's AF can find easily, the script will crawl through all zoom steps and record the measured distance value)...?
I was thinking along the same lines and actually have an (unpublished) script that does that now. Over six zoom settings ( 0,25%,50%,755,100%) it also asks for AF shots at intermediate distances ( e.g. 1m 2m 5m 10m 20m 30m ...), records get_focus() and lens mechanical positions at each, and then tries to take a set_focus() picture at that same distance and stores the result. The goal was a calibration chart of Canon focus against CHDK focus against lens mechanical position against zoom position.   Obviously, it's not a big deal to write something like that but physically looking at every image and comparing the focus quality or the result and comparing that to the log file is a lot of work!

So prior to going down that path officially, I had hoped that we could at least show that every camera probably has a distance value that set_focus() can use that will give sharp pictures out to infinity.   That's what got me looking at the lens mechanical position information (based on your suggestion).   What confounded that attempts was one or two cameras that don't appear to focus correctly under manual control at all,  and possibly the huge DOF at wide angle settings.   

Having said that, I think the one good thing that came out of the study was the realization that (at least for the cheaper P&S cams that don't natively support MF) we are likely positioning the focus mechanism "out past infinity" in some cases by asking for a 65535 setting.

Quote
Also, I'm not completely sure what fabri22's problem is: is he unable to find a distance value that will set his cam to infinity?
Correct.  He started a "trial & error" process of gradually increasing the setting given to set_focus(). It worked when he was in "macro" range but stopped being focused on anything once the requested distance was more than about 1000mm (IIRC).

So, I guess we need to see if there is a distance value (or range of distance values) that give sharp focus at infinity for various zoom settings.   I have six different camera models at my disposal so I guess I can do a litttle study.

I'm also curious to see that the three "focus" settings on cheaper cameras ( Macro, Normal, Infinity ) actually do.  Maybe we've been trying to do this the hard way all along. For example, on one of my A1200's,  setting Canon infinity mode (Mountain icon) gives a mechanical lens position of 505 at widest zoom.  Letting it take an AF shot of something distant gives a lens mechanical position of 502. And CHDK set_focus(65535) give a mechanical position of 504. All pretty close but the "infinity" setting uses the shortest distance mecha position.

« Last Edit: 09 / November / 2014, 12:11:57 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Manual Focus @ Infinity not working
« Reply #88 on: 12 / November / 2014, 15:16:35 »
Quote
As an interesting update / aside,  the S100 user who originally reported "focus at infinity" issues has the same issue using Canon MF.   So if the Canon UI can't MF at infinity either,  I guess it makes sense for CHDK to have issues too.

So now I'm not sure how much of a problem we really have? 
1-2 years ago when i start using the S100 and though the focus issue was a camera issue, I made some tests using MF with canon interface. and never had infinity focus issues. I will try additionnal tests.

Today I used the  1.3 chdk build and an adapted script ( from my sdm scritp) for kap with MF. (I used a ubasic script as i'm not able to build lua). I've got a lot of blurred pictures. So results are as poor as using SDM MF script. no improvement. As usual pics at focal longer than 10 mm are sharper. (that' s a paradox for kap !)

Sorry for not bringing good news !

Re: Manual Focus @ Infinity not working
« Reply #89 on: 12 / November / 2014, 17:02:48 »


Today I used the  1.3 chdk build and an adapted script ( from my sdm scritp) for kap with MF. (I used a ubasic script as i'm not able to build lua). I've got a lot of blurred pictures. So results are as poor as using SDM MF script. no improvement. As usual pics at focal longer than 10 mm are sharper. (that' s a paradox for kap !)
Please post your modified script. It's hard to comment without being able to see what you have done.

Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics