Power & Source of Big Ideas

CAM 1320 - OV13850 AutoFocus

Moderators: chensy, FATechsupport

Hi everybody,
I want to use the ov13850 board on NanoPC-T4 board with the latest friendlyDesktop Image. Unfortunately the driver does not support the AFC. :evil:

Is there anyone who found an ov13850 driver supporting Autofocus Control ?


Thank you
Franck.mh wrote:
Is there anyone who found an ov13850 driver supporting Autofocus Control ?

why you think, that this camera support autofocus?

OV 13850 Sensor doesn't, and looks like it's no optical system at all on top of the sensor(manual or automatic).

PS: if you really interesting about another "driver" - you can read my investigation about RkISP/CSI cams - a brief summary - another driver not work on FriendlyElec boards :(
Hi Ayaromenok

As written in this page https://www.friendlyarm.com/index.php?r ... uct_id=228, camera has automatic image control functions : AFC, AWB and AEC.
AFC as Auto focus conrol, AWB as Auto white balancing and AEC for Automatic exposure control. Do i make a mistake ?

Previously, i work with the OV5640 and it has really an autofocus function (AFC, AWB and AEC too)
The OV5640 has an AF mechanism like this : http://en.miui.com/thread-319653-1-1.html
Franck.mh wrote:
As written in this page https://www.friendlyarm.com/index.php?r ... uct_id=228, camera has automatic image control functions : AFC, AWB and AEC.
AFC as Auto focus conrol, AWB as Auto white balancing and AEC for Automatic exposure control. Do i make a mistake ?

I read this too. But I am not a PR-person to believe in such "product description".

I believe, that a i2c kernel driver from rockchip/ov13850 doesn't support autofocus(and support AWB & AEC). Generally speaking, non of drivers for Rockchip ISP have anything related to autofocus.

btw: from OV5640 datasheet:
support for auto focus control (AFC) with embedded AF VCM driver
,while OV13850 don't have this feature (and other cameras on this sensor, like LI-USB30-OV13850, support manual focus only ;) ). So, theoretically it's possible to implement camera on ov13850 with autofocus functionality, but you need a number of additional electronic, mechanical and optical hardware, but practically it too expensive.

in case, if you will interesting: cam400(ov4689 16^9 wide angel sensor) support manual focus only (and camera don't support high-speed videocapture, while sensor itself make it great).

upd: I can find focus related section in ov5640 driver in kernel. For me it's looks like a good idea to check FC\AFC section in driver and sensor manual before trust PR statements of any company, which produce a camera ;)
Ayaromenok, escobarrr thanks for your reply.
I'll check for a new camera.
Franck.mh wrote:
I'll check for a new camera.

it's only two cameras, which works with T4\M4\Neo4 - one it's this 13MP without focus at all, second - cam400 - with manual focus, but it's 4MP wide-lens and with 16:9 sensor (very cool by itself, but camera don't support it high-speed modes :( )

or you need to used USB cams(it's a USB3 hub on boards and not a direct SoC lines, so you need to calculate carefully bandwidth, if you decide to use more than one camera or usb-flash\hdd\other high-speed devices)
Franck.mh wrote:
Hi everybody,
I want to use the ov13850 board on NanoPC-T4 board with the latest friendlyDesktop Image. Unfortunately the driver does not support the AFC. :evil:

Is there anyone who found an ov13850 driver supporting Autofocus Control ?


Thank you


The autofocus feature in general works like this:
The camera module (not sensor) has a VCM (voice coil motor) - which is essentially a DAC connected to a magnet that is pulling on a spring-loaded lens. The higher value is sent to DAC, the stronger is magnetic field, and the father away the lens is pulled from it's idle position, thus changing the focus. Note that OV13850 is a sensor. The T4 camera is a module that contains this sensor *and* a VCM. The VCM DAC is an I2C device on the same bus as the sensor itself, but of course with a different address. Typically, it has a single register - a 12 bit DAC value. Writing to the DAC you can manually control focus.

Autofocus is more complex. In order to determine how out-of-focus the camera image is, it is being fed to a block called edge filter. The edge filter outputs a value that has a minimum when the picture is in focus.
The edge filter is typically implemented in either ISP (image signal processor) or the camera sensor itself.
The AF module will read the edge filter value and keep changing the focus length in coarse increments, thus finding the rough interval that contains the desired minimum value. Then it will switch to the fine increments and go through this interval finding the optimum. The reality is a bit more complex, because if you do this very fast (and people want fast focusing), you are risking to encounter resonant frequency of the voice coil when moving the lens, thus overshooting or undershooting the bracket step.

Unfortunately, OV13850 does not contain the edge detector block. So your choices are to do this on ISP or by running CPU-based analysis of received frames. The latter is a bit impractical. As for the ISP - I don't know if RK3399 ISP has edge detector accelerator. If it does then this whole thing is doable.
Today I did some testing on my NanoPi M4 and two of the FriendlyElek CAM1320 (OV13850) modules on FriendlyDesktop and Android 8.1. While there is no AutoFocus out of the box on Linux there is one on Android. Using the Android Camera App the CAM1320 module changes focus. It's focusing speed on Android is slow.The focus is breathing. But it works. So I assume edge filtering is done on the main CPU the way you described below. So the question is : Is anybody out there who did some investigation on controlling the VCM of the CAM1320 module on Linux?

alexf wrote:
Franck.mh wrote:
Hi everybody,
I want to use the ov13850 board on NanoPC-T4 board with the latest friendlyDesktop Image. Unfortunately the driver does not support the AFC. :evil:

Is there anyone who found an ov13850 driver supporting Autofocus Control ?


Thank you


The autofocus feature in general works like this:
The camera module (not sensor) has a VCM (voice coil motor) - which is essentially a DAC connected to a magnet that is pulling on a spring-loaded lens. The higher value is sent to DAC, the stronger is magnetic field, and the father away the lens is pulled from it's idle position, thus changing the focus. Note that OV13850 is a sensor. The T4 camera is a module that contains this sensor *and* a VCM. The VCM DAC is an I2C device on the same bus as the sensor itself, but of course with a different address. Typically, it has a single register - a 12 bit DAC value. Writing to the DAC you can manually control focus.

Autofocus is more complex. In order to determine how out-of-focus the camera image is, it is being fed to a block called edge filter. The edge filter outputs a value that has a minimum when the picture is in focus.
The edge filter is typically implemented in either ISP (image signal processor) or the camera sensor itself.
The AF module will read the edge filter value and keep changing the focus length in coarse increments, thus finding the rough interval that contains the desired minimum value. Then it will switch to the fine increments and go through this interval finding the optimum. The reality is a bit more complex, because if you do this very fast (and people want fast focusing), you are risking to encounter resonant frequency of the voice coil when moving the lens, thus overshooting or undershooting the bracket step.

Unfortunately, OV13850 does not contain the edge detector block. So your choices are to do this on ISP or by running CPU-based analysis of received frames. The latter is a bit impractical. As for the ISP - I don't know if RK3399 ISP has edge detector accelerator. If it does then this whole thing is doable.
Hi Gubua,

Unfortunately no, but on the other hand I am very interested.

Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 6 guests