Raspberry PI HQ camera autofocus

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hello. I have recently received my PI HQ camera and 16mm lens
https://magpi.raspberrypi.org/articles/get-started-with-the-high-quality-camera

I am capturing images of some items directly below the camera. Sometimes the items are smaller, sometimes they are bigger.

The only problem I have with Raspberry PI HQ camera is that I am not sure how to auto focus the camera? Everytime I move the camera up or down slightly, it goes out of focus and I have to manually adjust the lenses to get it back to focus and that is not a good solution since I want to use this camera for an automation system ( taking picture automatically) and I want to be able to receive decent pictures all the time.

Did anyone else faced this problem before and could advice me how to solve it? Thanks in advance.
 

Sensacell

Joined Jun 19, 2012
3,432
Use a USB webcam with autofocus built-in.

Autofocus is non-trivial, you could conceivably build your own, but it would require significant electro-mechanical and optical chops.
 

MisterBill2

Joined Jan 23, 2018
18,167
Certainly keeping the camera focused for the sharpest photo is a challenge. Does the camera have a motor drive for the focus adjustment, or do you need to manually adjust the actual lense? If there is no servo mechanism to electrically adjust the focus then the challenge is very large. You may experiment by focusing the camera at infinity and see if that provides adequate resolution.
Did you consider the issue of focusing the camera before you ordered it? Was it even mentioned? And are you aware of the complexity of an auto-focus algorithm? The very simplest ones adjust for the maximum sharp edges in the video signal, which is not simple.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Certainly keeping the camera focused for the sharpest photo is a challenge. Does the camera have a motor drive for the focus adjustment, or do you need to manually adjust the actual lense? If there is no servo mechanism to electrically adjust the focus then the challenge is very large. You may experiment by focusing the camera at infinity and see if that provides adequate resolution.
Did you consider the issue of focusing the camera before you ordered it? Was it even mentioned? And are you aware of the complexity of an auto-focus algorithm? The very simplest ones adjust for the maximum sharp edges in the video signal, which is not simple.
Thanks for the response. There is no sort of motor for the adjustment. I have to manually adjust the actual lense to focus the camera.

I have actually did not think that I will be having such problem because silly me thought that the camera will be able to automatically focus on the object based on the distance. I obviously do not have any photography knowledge.

I do not need the sharpest pictures possible I just need something atleast decent I usually take a picture from about 1 meter distance. If I try to take a picture from like 80cm the picture is so blurry its basically not even usable. \\

From what you said it sounds quite difficult. I should probably look for some easier solutions (as Sensacell) mentioned maybe I should look into USB webcams that have autofocus function
 

MisterBill2

Joined Jan 23, 2018
18,167
Once again, try with setting the lens for "infinity focus".That has been known to work in some cases, and it will not cost anything to try. Professional photographers complain that it reduces the depth of field, I don;t know how important that is in your application. But it is easy enough to try.
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
Once again, try with setting the lens for "infinity focus".That has been known to work in some cases, and it will not cost anything to try. Professional photographers complain that it reduces the depth of field, I don;t know how important that is in your application. But it is easy enough to try.
I dont really understand the infinity focus but I have tried rotating the lens maximum to one side, checking the focus and then the other side, checking the focus. That does not really work.

Also, I have noticed this USB camera:
https://www.logitech.com/en-us/product/hd-pro-webcam-c920#specification-tabular
It does mention something about autofocus, but the system requirements are for windows or macOS. Does that mean my Raspberry PI will not work with this camera?
 

MisterBill2

Joined Jan 23, 2018
18,167
I am not an expert on "infinity focus" by any means, what I am aware of has come from those folks who ARE the experts.
As for the requirement for the Win OS, consider that it is a few hundred times bigger that the memory capability of your Raspberry Pi device. So there may be a serious incompatibility.
 
Top