OpenMV Upscales a 54 x 42 Lidar Depth Map 4x on the STM32N6 NPU at 29 Frames per Second

User Avatar Aswinth Raj
Author
Share
OpenMV Lidar Camera Module Mounted On Board

Small time-of-flight sensors give real distances but very few pixels. OpenMV has shown how to get much sharper depth out of one without cheating. Its new LiDAR Camera Module pairs ST's VL53L9CX direct time-of-flight sensor with a color camera, and a tiny neural network running on the STM32N6's Neural-ART NPU upscales the 54 x 42 depth map 4x to 216 x 168 at about 29 frames per second, which OpenMV says matches the sensor's full frame rate in this setup.

The hardware

The module carries the VL53L9CX dToF sensor and a PAG7936 1 MP, 120 fps global shutter color sensor, with the color sensor's exposure trigger shared with the depth sensor's timestamp input so the two images stay in sync. It works only with the OpenMV N6 camera. According to OpenMV, the VL53L9CX ranges from under 5 cm to 9 m and streams processed data at up to 100 Hz. The module is listed at $325.

Why not just stretch the image

Bilinear upscaling looks smooth but lies at edges. In OpenMV's example, a person 1.2 m away in front of a wall at 3.4 m gets a ramp of 1.5 m, 2 m and 2.8 m between them, surfaces that do not exist. A person detector or obstacle check reading that depth sees a slope where there is a cliff.

So the network never outputs depth. For each output pixel it outputs nine weights, one for each of the 3 x 3 measured zones around it, and the pixel becomes a weighted average of real measurements. This is called convex upsampling. Because the weights are positive and sum to one, the result cannot invent a distance no nearby zone measured, flat areas get less noisy, and edges snap to one side.

Built in a few steps

  • The team recorded the real sensor on an OpenMV camera to learn its noise (about 3 to 7 mm on a flat surface) and outliers, then built a simulator and trained on Apple's Hypersim rendered indoor scenes.
  • The network has eight 3 x 3 convolutions and 287,120 parameters, and trained in about seven minutes on a Mac with an M4 Max.
  • It was compiled as an int8 TFLite model for the Neural-ART accelerator with ST's stedgeai tool. The NPU runs the network, and a new C function in OpenMV's open-source firmware does the 3 x 3 blend on the CPU.

On held-out test scenes, flat-area error dropped from 24.0 mm with bilinear to 8.5 mm, and edge pixels more than 10% off fell from 31.8% to 17.5%.

Our take

This is a good example of edge AI that improves a sensor instead of replacing it. Robots, drones and smart cameras that need clean depth edges for obstacle checks can get them without a GPU, and the "pick, don't paint" idea is worth borrowing for any low-resolution sensor upscaling.

Image credit: OpenMV, resized.

About the author: Aswinth Raj is an electronics engineer and the editor of CircuitDigest, where he has published more than 150 hands-on projects and tutorials across Arduino, PIC, ESP32, Raspberry Pi and EV battery systems. He selects the stories on this page for what engineers and makers can actually learn or build from. Connect on LinkedIn

Have any question related to this Article?

Add a comment

No account needed. Your comment appears once a moderator has reviewed it.

Never shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.