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

Manual Focus @ Infinity not working

  • 151 Replies
  • 39007 Views
Re: Manual Focus @ Infinity not working
« Reply #110 on: 16 / November / 2014, 10:02:29 »
Advertisements
gloomy sunday.
However continued some testing.
installed CHDK on the first S100 I've used which is a 101b.
values returned for mechanical position are
at wider angle 307, 308, 307, 307.
one step zoom further (where i usually have more focus issues) 308, 308, 309, 309.
Images are OK, at least acceptable due to low light (iso at 80, all focus options off).

I've redone test for old101a, the one which failed yesterday.
Values returned are 291, 291, 291, 300 at wa. images are a bit more blurred but would be "acceptable".
(yesterday it was 290, 298, 300, 300)
1 zoom step further, values are 283, 300, 301, 301 only the first one (AF) is acceptable. other are blurred.
with this camera AF is OK. I've tested MF mode without loading CHDK, and results are not correct.

reminder: the tests done yesterday with new101a (only used for a couple of days) are correct. values were 346/348


All this tends apparently to incriminate the old101a camera. However i remain humble in conclusions as for months, I have experimented so many up and down in the way S100 MF is working ( more down probably),

some questions however:
what are the anticipated value for mec. position if correctly set at infinity ?
is it normal there is such fluctuation in these values for different cameras (but same model).
if we assume that defaut is generating a shift in focus, as shown in pictures with the kite line in frame, could we imagine to reduce/limit the shift by assign a specific set focus to ? any idea for testing this ?
(as far as I can judge for hundreds of blurred pics, I would assume focus is set at 5-6 m, to be confirmed )

Re: Manual Focus @ Infinity not working
« Reply #111 on: 16 / November / 2014, 11:16:19 »
All this tends apparently to incriminate the old101a camera.
Same conclusion I finally reached with the S100 tester on the KAP forum that was having this issue.

Quote
what are the anticipated value for mec. position if correctly set at infinity ?
Your guess is a good as mine.  We are out on the "bleeding edge" here - it's not like Canon publishes a reference guide for this stuff.

Quote
is it normal there is such fluctuation in these values for different cameras (but same model).
We don't actually know what the mechanical position number means.  For us, it's just a relative number whereby a lower values indicate focus out towards infinity and a higher values correspond to macro settings.  In fact, it's quite likely that it's not calibrated to anything.  When the camera is in AF mode,  it doesn't care.  In AF, the camera uses a feedback loop to essentially move the lens position to the point of maximum contrast (i.e. sharpest focus).   So if the mechanical position vs reported position number shifts because maybe a hard knock makes it shift a couple of gear teeth or slip the actuator surface (guessing) then it will still work in AF mode but the calibration in MF (assuming the camera actually supports MF natively) will be off.  And  99.9% of the camera owners will never know or care.

Quote
if we assume that defaut is generating a shift in focus, as shown in pictures with the kite line in frame, could we imagine to reduce/limit the shift by assign a specific set focus to ? any idea for testing this ?  (as far as I can judge for hundreds of blurred pics, I would assume focus is set at 5-6 m, to be confirmed )
This is probably where we need to go next.  For some reason, we have not found a distance setting that does work - maybe for a lack of trying so far.   Given the incredible DOF of these cameras,  we should be able to do a set_focus() at a few metres and have sharpness out to infinity.  So a little experimenting outdoor with a hard target like a building and a script that walks through focus settings might work.  I've attached one of my test scripts that does all that - run some sequences with your S100's, examine the resulting images, and lookup the set_focus values that were used in the log file it creates?

One of my other test script tried for shots at the calculated hyperfocal distance. I don't think that worked much better.  But I guess give a mechanism that is out of calibration that might have been offset too.  Maybe calculate the hyperfocal distance and then try 2x, 3x & 4x that ?

Finding a mechanical position that works reliably might be an approach but its seems like it should map exactly to a set_focus position. Doing so would also require calibration across the zoom range - some sort of look-up table I guess.   I only had a little time to try and add a set_mechanical_position() function for testing and was unable to make it work in the time I had.   But that might be another approach.

Note that the KAP tester was unable to make Canon MF work at any setting either - although the camera would autofocus. Not sure what that tells us other than that there are other possible interactions with the Canon firmware that we don't understand.

Edit : modified the script to fix several bugs
« Last Edit: 15 / December / 2015, 19:31:31 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Manual Focus @ Infinity not working
« Reply #112 on: 16 / November / 2014, 15:09:35 »
Quote
In fact, it's quite likely that it's not calibrated to anything.
However, i"ve tried to understand how this value is changing. with the chdk build with the value displayed, it is quite simple to see effect of the use of jogwheel when MF is on.
and for my old101a - the one with the default - the value never goes under 301, when the value returned when camera is in AF is 296.
It is then tempting to think that the MF is not under full control of the wheel. Maybe because the camera has a problem (kap life in not always an easy one for a camera ;-).

I will explore a bit more tomorrow when daylight will be there, but your script does not shoot for my camera and interrupts with a :60 message.
Quote
So if the mechanical position vs reported position number shifts because maybe a hard knock makes it shift a couple of gear teeth or slip the actuator surface (guessing) then it will still work in AF mode but the calibration in MF (assuming the camera actually supports MF natively) will be off.  And  99.9% of the camera owners will never know or care.
Agree ! to be honest, for months I gave up with MF, using AF. but MF is still faster and more favrable for kap when wind is not steady.

I really appreciate the new feature of displaying the mecanic value.  This has really helped me to isolate and  understand the pb for me. This could maybe used as a "check indicator" in a script (because get_focus is -1 even if focus is wrong)
2 other things i will explore with the value displayed.
* would it work to Autofocus first and then lock.
* what about MF safety functions. I never understood such feature.

Re: Manual Focus @ Infinity not working
« Reply #113 on: 16 / November / 2014, 16:11:15 »
I really appreciate the new feature of displaying the mecanic value. 
FWIW - the various scripts I posted measure and log the same value.  It would be easy to have them also display that value - although running script when not in <ALT> mode is not necessarily a  good thing to do.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: Manual Focus @ Infinity not working
« Reply #114 on: 17 / November / 2014, 03:53:49 »
Unfortunately, I cannnot run the MF mecha test3 script. I get a message
:60 attempt to index global 'capmode" (nihil value).

remark: I've explored meca values for different zoom positions. and it confirms that for the deviating camera, when I zoom in, I can reach lower values: 292 at wa, 203 at longer zoom. this explains why sharpness is OK at longer zoom positions, as seen in real situations. only short focals are MF limitated.

Is there a way to get the mechanical position value in ubasic? It could be useful to monitor it while testing scripts. and maybe try to use the AF lock system.

*

Offline msl

  • *****
  • 1276
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Manual Focus @ Infinity not working
« Reply #115 on: 17 / November / 2014, 04:15:25 »
Unfortunately, I cannnot run the MF mecha test3 script. I get a message
:60 attempt to index global 'capmode" (nihil value).
The chdk installation is not completed. You need the file CHDK/LUALIB/capmode.lua. Download the complete CHDK package for your camera and copy all files from the zip file to the sd card.

msl
CHDK-DE:  CHDK-DE links

Re: Manual Focus @ Infinity not working
« Reply #116 on: 17 / November / 2014, 08:15:17 »
remark: I've explored meca values for different zoom positions. and it confirms that for the deviating camera, when I zoom in, I can reach lower values: 292 at wa, 203 at longer zoom. this explains why sharpness is OK at longer zoom positions, as seen in real situations. only short focals are MF limitated.
Be aware that the lens mechanical position for any given focus distance (including infinity) will change as the zoom position changes.  It's not fixed.  You'll see that when you get a complete recent version of CHDK 1.3.0 installed and the test script running.

Quote
Is there a way to get the mechanical position value in ubasic?
No.  You need Lua's ability to make native calls or a custom hacked version of CHDK that adds a new uBASIC function.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Manual Focus @ Infinity not working
« Reply #117 on: 03 / December / 2014, 10:53:08 »
I've tried some different tests with Philmoz files and checked wether I could reach manually what seems to be the correct lens position for my two similar camera S100 in 101a fw.
I can now confirm the following (sorry if all of this is already know from experts):
value of lens mecha position is different from a camera to the other ( and for different zoom values)
one camera seems to manually focus correctly, the other not: I cannot reach the value got from AF with manual focus.
this tends to demonstrate a camera issue.
on another hand I also saw that activating MF safety ON allows the camera to reach infinity value. I never understood the idea of this feature but now, I understand this is a feature to correct camera bug !



Bump : Manual Focus @ Infinity not working
« Reply #118 on: 26 / November / 2015, 11:24:38 »
(tl;dr -> see last two paragraphs)

It has been a while since this thread and the Setting focus from scripts or menus thread have had any activity.  However, this recent post by srsa_4c reminded me that we never reached a satisfactory conclusion to the original question about reliably setting focus at infinity using CHDK.

I've scanned through this thread again and realized that while we tried an awful lot of things,  we failed to follow-up completely on a suggestion posted here :
The goal was a calibration chart of Canon focus against CHDK focus against lens mechanical position against zoom position.   
mostly because the thread became distracted testing mechanical position vs infinity settings.

To summarize what I think we have learned :
  • The cameras tested could almost all take a picture with good focus of objects off in the distance (infinity) using Canon autofocus (AF) (and that we should probably ignore those that could not as they are likely mechanically damaged.)
  • Most of the tested cameras that have Canon manual focus (MF) capability tend to take picture with good focus of objects off in the distance (infinity) when set to infinity in the Canon UI.  But not every MF enabled camera actually did this well.
  • CHDK can set focus on almost every ported camera regardless of whether the Canon UI provides MF capability or not.
  • The focus value CHDK  tries to set (in mm) will not necessarily result in the lens being set correctly to achieve focus at the specified distance and/or zoom position.
  • How well setting focus works may vary by camera model.
  • How well setting focus works does vary between cameras of the same model and firmware version.
  • The actual lens mechanical position reported by the Canon firmware when the focus is at infinity changes from camera to camera.
  • The actual lens mechanical position reported by the Canon firmware when the focus is at infinity changes with zoom position

My operating theory, posted several times on this forum, is :
Quote
Canon P&S camera manual focus settings are often poorly calibrated - even on cameras that claim to offer MF capability.  The reason that this does not affect pictures taken in auto-focus mode is that the Canon firmware AF function adjusts the lens position via a closed loop feedback system until it sees the sharpest image.  It has no concept or need for physical distance values as it simply moves the lens mechanism until the picture is sharp.

srsa_4c has repeatly pointed out (and I confirmed from the some of the original test results) that:
my sx280 reaches infinity at around 1000 mm, setting native manual focus beyond that gives increasingly blurred pictures (that means, focus goes beyond infinity). This is at wide angle of course.
This question will continue to come up as users stumble across the difficulties in setting MF with CHDK - especially at infinity.   

One solution that I can't see us having tried (?) is a simple script that takes a series of many images (averaged at each zoom step) in AF mode while the user has pointed the camera off at a distant subject.  The script would record the zoom setting and average lens mechanical position to a file on the SD card.  If this works, then a simple Lua function to look up the correct mechanical position setting for any give zoom step would be easy to implement and test - providing a reliable way to set focus at infinity.  Ultimately, I suppose, we could build this capability into a "set focus at infinity" function in the CHDK C code (realizing that the calibration table would need to be generated by the end user for their particular camera).

The only snag here is that I do not have a camera that does a poor job on CHDK MF so testing this will be hard.  I can try contacting the original forum members who reported problems 18 months ago.  But before I do so, I'm hoping for some feedback on my theory and suggested "fix"?


« Last Edit: 26 / November / 2015, 11:44:46 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4426
Re: Bump : Manual Focus @ Infinity not working
« Reply #119 on: 26 / November / 2015, 20:38:12 »
Some thoughts.
One solution that I can't see us having tried (?) is a simple script that takes a series of many images (averaged at each zoom step) in AF mode while the user has pointed the camera off at a distant subject.
While this sounds like a good plan, it may present some difficulties, especially on cameras with longer zoom.
- Finding a distant target that can be easily focused on throughout the whole zoom range might not be easy for everyone. Examples: weather conditions (atmospheric distortion, mist/fog, ...), lack of nearby mountains/hills/big objects...
- Less distant objects enter the scene when nearing wide angle - this might spoil the AF results
- With several dozen zoom steps, the test run would take a fair amount of time

Also, there will be users who only need accurate focus at wide angle.

 

Related Topics