Auto-Focus vs Fixed-Focus

TL;DR

Select Fixed-Focus (FF), if you are planning on mounting your OAK camera to something with vibration (like a drone).

Select Auto-Focus (AF) if you absolutely need things closer than ~50 cm to be perfectly in focus.

Do neither of those apply to you? If so, just pick at random. Either will work for you most likely.

Trade-offs

A) Handling High Vibrations

Fixed-Focus (FF) is best here. Fixed-Focus is best for handling high-vibration environments.

Auto-Focus uses an electromagnet to move a magnet that is mounted to a free-moving lens. In high vibrations, this electromagnetic force is overpowered and the lens vibrates all over the place, causing blurry/weird/”jello” images/video.

Examples of high-vibration installations include mounted to a:

  • Drone

  • Lawn mower

  • Heavy machinery

  • Harley Davidson motorcycles (which are notorious for their vibrations), etc.

B) Seeing Close Objects Clearly

Auto-Focus (AF) is best here. Fixed-Focus can see clearly from ~50 cm (~20 inches) to infinity, whereas Auto-Focus can see clearly from 10 cm (~4 inches) to infinity.

Auto-Focus accomplishes this wider range by actually moving the lens to a different position (~255 different steps) to focus at specific distances. The Auto-Focus model can be manually controlled as well, in 1/256 steps.

Pros and Cons Summary

Auto-Focus (AF) pros: Can focus on objects dynamically, which is mainly useful for objects within 50 cm of the OAK camera. You can also set the focus manually for AF camera (which disables the auto-focus feature), either in runtime (example here - use , and . to change focus) or when initializing the pipeline:

pipeline = dai.Pipeline()
rgbCam = pipeline.create(dai.node.ColorCamera)
rgbCam.initialControl.setManualFocus(100) # 0..255

Note that in high-vibration environments, even if you set manual focus, the AF coil (which holds the lens) won’t be able to keep the lens in place, which will result in a blurry image.

Auto-Focus (AF) cons: Does not work properly in heavy-vibration applications (e.g., drones, lawnmowers, bikes w/out suspension, etc.)

Fixed-Focus pros: Handles vibration better. The lens won’t vibrate, so it’s suitable for drones, robots, machines, etc. Better for RGB depth alignment (as the lens does not move). For RGB depth alignment on an Auto-Focus camera, you need to set manual focus for the color camera.

Fixed-Focus cons: Objects have to be at least 30 cm away to be in focus. (50 cm is a good conservative estimate; why it is used above.)

And it’s worth noting that the 2x global shutter grayscale cameras on OAK cameras are Fixed Focus on all OAK camera models and can see quite close (down to 10 cm on OAK-D-Lite, and down to 20 cm on all other OAK cameras). The decision of Auto-Focus (AF) or Fixed-Focus (FF) is purely for the Color Camera on your OAK camera, which needs to have bigger optics because the color is less sensitive to light. These bigger optics are what result in the trade-offs below between vibration tolerance and close-in clarity.

Recognizing AF/FF camera

If you aren’t sure whether the OAK in front of you has Auto-Focus or Fixed-Focus color camera, you can recognize it by the silver metal ring on the Auto-Focus mechanism, as shown in the image below.

Another possibility would be to query this information using depthai library:

import depthai as dai
with dai.Device() as device:
    print(device.getConnectedCameraFeatures())

Which will print something like below. The hasAutofocus field will be 1 for the AF camera, and 0 for the FF camera. So in this case, our OAK-D camera is AF:

[
{socket: RGB/CENTER/CAM_A, sensorName: IMX378, width: 4056, height: 3040, orientation: AUTO, supportedTypes: [COLOR], hasAutofocus: 1, name: color},
{socket: LEFT/CAM_B, sensorName: OV9282, width: 1280, height: 800, orientation: AUTO, supportedTypes: [MONO], hasAutofocus: 0, name: left},
{socket: RIGHT/CAM_C, sensorName: OV9282, width: 1280, height: 800, orientation: AUTO, supportedTypes: [MONO], hasAutofocus: 0, name: right}
]

AF/FF Availability

Auto-Focus and Fixed-Focus center color camera options are available standard for all OAK models. The one exception is the OAK-D, which doesn’t offer a Fixed-Focus option standard, however a Fixed-Focus camera can be swapped in custom on request. In this case however, it will likely make more sense to simply select a different OAK. Visit our store to see our full range of options.

Got questions?

Head over to Discussion Forum for technical support or any other questions you might have.