You say your external microprocessor is adjusting zoom and focus through servos. How does that external processor know the focus setting is "correct?" Earlier you said you're focusing with Live view at 10x magnification, so the external processor is not actually focusing? I'm not understanding what part of this is processor-driven and what part is not.
Ok, sorry; that was confusing how I worded it. To get the focus correct at any given distance I have to calibrate it at many points between 2ft and 15ft. The process looks like this:
1. Set camera 24" from target, zoom in 10x on live view (focus is at 90 degrees, image is blurry).
2. Create an entry in the microcontroller's look-up table for 24" input and 20 degrees focus rotation output, save lookup table. Focus actuator rotates to 20 degrees. Image is less blurry.
3. Adjust the 24" entry in the lookup table to 0 degrees, save lookup table, watch live view. As the motor turns focus from 20 degrees to 0 degrees, image gets clearer and clearer, then blurry again. I have passed the correct # of degrees for 24".
4. Try modifying and saving the lookup table a few more times with different values while watching in live view (still zoomed in 10x on center) until the perfect number is found, for example, let's say it's 4.5 degrees.
5. Move the camera 30" from the target and repeat steps 1-4 for 30". Let's say the right number for 30" is found to be 6 degrees. I save that.
Now if I move the camera back to 24" the focus will rotate back to 4.5 degrees. And moving it back to 30" will rotate focus back to 6 degrees. At any point between 24" and 30" the focus ring will be at a calculated corresponding degree between 4.5 and 6. For example 27" would be 5.25 degrees.
6. Repeat above at 6" increments all the way to 180".
After doing that, you can place the camera anywhere between 2ft and 15ft and the image will be focused (still, 10x zoomed in on live view).
I spent hours doing that. Then, I took it out of 10x zoom for the first time and saw the full image for the first time, realized the left side was totally out of focus at all distances.
It would be simpler to just set 24" at 4.5 degrees and 180" at 58 degrees, and let every distance in between be calculated, but the distance:degrees relationship isn't linear.
This probably seems like a lot of effort to replace what is already there, autofocus. But the environment in which I'm taking pictures is all one color, and almost featureless. There is nothing for autofocus to focus on. It doesn't work.
Also, in your very first image, the numbers at the bottom left are sharper than the numbers at the top left. Also, the surface imperfection on your board are sharp at the top right, but not at the bottom right or bottom center. I don't think your board is as flat, or as parallel to the focal plane, as you think it is.
Ok I will check this. Thanks.