ON THIS PAGE

  • Auto/Fixed Focus
  • Overview
  • Vibration Tolerance
  • Focus Range
  • Manual Focus
  • Recognizing focus type

Auto/Fixed Focus

Overview

ParameterFixed-Focus (FF)Auto-Focus (AF)
Vibration ToleranceHighLow
Focus Range50 cm to infinity10 cm to infinity
Manual FocusNo - lens is gluedYes - programatically
Overall, Auto-Focus cameras are more versatile and can be used for a wider range of applications, while Fixed-Focus cameras are more robust in high-vibration environments. See Recognizing focus type for how to tell which type of camera module you have.

Vibration Tolerance

Fixed-Focus (FF) is better for handling high-vibration environments.Auto-Focus uses Voice Coil Motor (VCM) to move the 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" frames.
Some applications, where of high-vibrations:
  • Drone
  • Lawn mower
  • Heavy machinery
  • Harley Davidson motorcycles (which are notorious for their vibrations), etc.

Focus Range

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 Depth of Field (DoF) 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 via API as well, in 1/256 steps (see below).

Manual Focus

Auto-Focus cameras can be manually controlled via DepthAI API. You can set the focus value (0..255) either in:
  • Runtime, with example here you can use , and . to change focus
  • At boot time, with the following Python code:
Python
1pipeline = dai.Pipeline()
2rgbCam = pipeline.create(dai.node.ColorCamera)
3rgbCam.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.

Recognizing focus type

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 API library:
Python
1import depthai as dai
2with dai.Device() as device:
3    print(device.getConnectedCameraFeatures())
Which will print something like below. The hasAutofocusIC field will be 1 for the AF camera, and 0 for the FF camera. So in this case, our OAK-D camera is AF:
Python
1[
2    {socket: CAM_A, sensorName: IMX378, width: 4056, height: 3040, orientation: AUTO, supportedTypes: [COLOR], hasAutofocus: 0, hasAutofocusIC: 1, name: color},
3    {socket: CAM_B, sensorName: OV9282, width: 1280, height: 800, orientation: AUTO, supportedTypes: [MONO], hasAutofocus: 0, hasAutofocusIC: 0, name: left},
4    {socket: CAM_C, sensorName: OV9282, width: 1280, height: 800, orientation: AUTO, supportedTypes: [MONO], hasAutofocus: 0, hasAutofocusIC: 0, name: right}
5]
Note that there are 2 fields:
  • hasAutofocus field is what is stored in EEPROM (can be incorrect) and is mostly there for backwards compatibility.
  • hasAutofocusIC field is the actual value read from the camera module (VCM controller). This field is the one you should rely on.