Originally Posted by sparklet
I had some success with earlier versions of keychain cameras after seeing a focusing method posted somewhere online.
Use something outdoors a reasonable distance away that you can take a photo of and then repeat the procedure.
Take a still photo. Then connect the camera to a computer and look at the size of the file for the still photo. Note the size.
Move the lens a fraction. Take another still photo. Compare the file size of the second photo with the file size of the first one.
Make another small adjustment, take photo, compare file size.
Keep adjusting the lens until you obtain the biggest file size for a still photo that you can, at some stage the file size will reduce so you need to adjust the lens back to the position with the largest file size.
You should now be done and the camera should have the focus set at it's best position. The file size increases as the camera captures more detail.
I had seen this method mentioned previously, but never tried it because it just seems to me to be approximate at best because it's using indirect results, relying on the JPEG compression algorithm to increase file size as detail in the image becomes better defined. That may be actually what happens, but unless the EXACT same image and lighting conditions are present for each photo, it could easily give a false positive, I'd think? So I never tried it, relying instead on what my eye discerns as being best focus (seeing is believing!
But now you've got me thinking there might be a better way than what I was doing using the photo time lapse mode! If the camera could be rigidly anchored to capture the same scene while the lens is rotated tiny increments between photos, zeroing in on the best sequence of maybe 4-5 photos would get you pretty close if you kept track of what rotation position the lens was in for each picture. Then repeat with even smaller rotation increments to zero in. When I did this with video, I'd put a piece of tape on the CMOS module and another on the lens barrel, get close with the web cam, then draw a line across the two pieces of tape with a ball point pen. Then shoot video samples on both sides of that line, using "one line width" increments. Then using the best focus from that, repeat with "1/2 line width" increments. Changes that small can produce visible focus changes. But with this method, there would be no motion blurring from a hand held camera and the same scene and lighting could be achieved (close enough) in each photo. It would be a good way to test the validity of the file size method as well!
I think I'll try this when I have some time. It would be faster than taking videos and comparing them frame by frame, and possibly more accurate as well with less compression in the photos!