I have a small business (just me) selling an inspection machine. The camera and lens work well, but I've had to print my own camera mount to get the lens further away from the CCD to get a good focus. The depth of field is extremely narrow, and I am interested in possibly making my own lens if I can buy the parts, and 3D print the barrel. I believe it's simple, but I really don't know anything about this. I downloaded software a year or two ago, I think called Synoptic. I dabbled, but don't know what I'm doing. The CCD is 1/3 inch, and it is placed six inches from the target, with the target being .7 inches diameter. The target is not normal to the lens, and is at a 30 degree angle. This angle causes problems with the top and bottom edges not being in focus. Is there a tutorial somewhere for software that I can freely download? Or, is there other reference material I should be reading?


Sounds like what you need is to tilt your lens to get everything in focus. Because the lens will be tilted, you'll probably need one with a larger image circle in order that it still covers your sensor when tilted, though you may find the existing lens has enough coverage.

Alternatively, try shifting the lens - that way, you can point the lens perpendicular to the target but not pointing straight at it - if you shift the lens away from being inline with the target, the image of the target moves away from the center of the image - but you can compensate for that by moving the sensor so it's where the image ends up. Again, this will usually need a lens with a larger image circle, so the shifted image of the target is still inside the image circle.

  • He can also tilt the CCD. He can elevate the illumination, this will allow a tiny aperture to gain DOF. Dec 29 '17 at 22:20
  • Yes - shifting or tilting either the CCD or the lens will work. Good suggestion about stopping the lens down if the light is bright enough to get away with it.
    – JerryTheC
    Dec 29 '17 at 22:22
  • This is an awesome idea. Since I'm printing my own lens mount, I can easily make one that's offset or angled. Is this a trial and error thing, or is there a calculation I can make related to the focal distance, size of target, and size of final cast image on the CCD? Dec 30 '17 at 22:27
  • Yes, there is a calculation, but I'm not sure I remember it.
    – JerryTheC
    Dec 30 '17 at 22:36
  • For tilt, I think the subject plane, the lens plane, and your sensor plane need to intersect in the same line. For shift, if you know the reproduction ratio, you can probably just scale the distance from the center - so if the image on the sensor is half original size, then the sensor shift should be around half the offset of the subject from the lens position. If you can find a book that covers how view camera movements work (like Ansel Adams The Camera ) that should explain it.... or just try a web search for "View camera movements" or "Large format techniques" which should find lots.
    – JerryTheC
    Dec 30 '17 at 22:45

You would likely be foolish to make your own lens. Likely Edmunds Scientific http://www.edmundscientific.com/ will have everything you need. Make sure to be ready with the specifications of the lens you want when you contact them.


Depending on the subject you're photographing, you could try focus stacking: https://digital-photography-school.com/an-introduction-to-focus-stacking/

Or Light field cameras such as the Lytro (may be discontinued?): https://www.lytro.com/ https://www.bhphotovideo.com/c/product/801644830-USE/lytro_b5_0035_illum_light_field_digital.html

I would say it's cheaper and easier to find someone in China to help prototype a product for you. Googling found this http://www.optics-online.com/Custom/prototype.asp

Also try Thor Labs for optical components: https://www.thorlabs.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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