Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

I'm working with a megapixel camera and lens that needs to be focused for an OCR application. In order to measure the focus quality during the set-up, I've built a tool that gives the contrast value between two pixels. In very simply words, more the contrast is high more the focus is good... Due to optical distortions, the focus value in the sides of my field of view, is not the same as in the center. My question is how could I calculate the distortion between center and sides, in %. For examples fcenter = 62 ; fleftside = 42. Is that correct to say Leftdistortion = 1-(42/62)*100 ??



share|improve this question
What you are measuring is not distortion, it's field curvature. Distortion is when straight lines in the subject do not look straight in the image. –  Edgar Bonet Jul 5 '11 at 15:04
Your question isn't clear. Are you interested in distortion that bends the lines of a rectangular grid but keeps the image sharp or aberrations that affect sharpness? As you measure the contrast I assume the latter. –  whoplisp Jul 6 '11 at 23:53
Whosplisp, I want to measure aberration that affect the sharpness, yes. –  Raphael Jul 7 '11 at 6:47
Edgar, yes my measure is like a Petzval curvature. –  Raphael Jul 7 '11 at 6:52
add comment

2 Answers

You cannot figure that via pure math. It 100% depend of specific lens design you have - you could have 0 difference, you could have sphere-like focal plane, you could have anything.

So your best bet is to measure focal plane differences across the frame, and interpolate.

share|improve this answer
Thanks, but how to measure these differences? –  Raphael Jul 7 '11 at 6:40
The only viable way is to perform multiple shots at different lens focusing. Also, there is a hardcore way through Shack-Hartmann Wavefront Sensor ;-) thorlabs.com/NewGroupPage9.cfm?ObjectGroup_ID=2946 –  BarsMonster Jul 7 '11 at 22:47
add comment

If you don't know the specifications of your objective you can't calculate this. I describe a method you could try to measure the optical transfer function.

Print out gratings 10 (or so) gratings with different periods. Capture images of these gratings. Make sure that the central part of the camera is as sharp as possible for the finest grating and make sure that the gratings are oriented in the same way.

If your lens has an aperture try opening it as far as possible. This decreases your depth of field and allows you to find the focus more precisely. Conversely for your application of capturing OCR images you should close the aperture as far as possible (use a bright lamp) this improves the point spread function of the system.

If your lens doesn't have an aperture you can try to build one with black paper and a hole punch.

For a raytracer you have to evaluate this equation on every surface: $${\bf t}=\eta{\bf i}-\left(\eta{\bf i n}+\sqrt{1-\eta^2(1-({\bf i n})^2)}\right){\bf n}$$ with $\eta=n_1/n_2$, $n_1$ the index on the left (downstream) side of the surface, ${\bf n}$ the normal of the surface at the intersection with the ray.

Its possible to write a write a ray surface intersector for conic surfaces as a 10 line function that you can use among the other things for plane and spherical surfaces.

Another thing you might need to look into is the Sellmeier coefficients of the glasses in your system.

You can find the image position by tracing rays from the object into the image plane and look where beams starting from one point intersect. In a good system the focus spot will be smaller.

You can also draw a Gaussian sphere around each image point and sum up the optical distances along the ray. That way you'll obtain the wave aberrations.

share|improve this answer
Thanks, but I know the lens spec and I don't want to measure the MTF. –  Raphael Jul 7 '11 at 6:53
I would ask the guy who gave you the spec. They usually print out those curves during the design anyway. Alternatively you could enter the specs into a raytracer, e.g. winlens.de and see if you can generate your parameter but then you might still want to verify the MTF. If you have a lot of time to waste, you could write your own raytracer. –  whoplisp Jul 7 '11 at 8:56
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.