V4L2 + V4l-utils, Capture for multi-planar #2

      Comments Off on V4L2 + V4l-utils, Capture for multi-planar #2

This article continued from “V4L2 + V4l-utils, Capture for multi-planar #1

Querying external controls

Getting external conrol should be an optional job, but it may needed to control birghtness and gain for good to get excellent balanced image. Little bit difficult to understand in first time but can be understand soon.

Query all user controls should be used as like this,

It shows all user controls as below result.

Some user controls doesn’t have name, so it should filtered out for only named control by checking string length with strlen().

Some tweaks for exposure and gain

In search of looping by v4l_query_ext_ctrl(), it should be export some external control for future, and here some code for getting exposure and gain control.

Then, exposure should be adjusted as below:

Now, it’s turn to capture

To getting secured image from MIPI CSI-2 camera types with Multiplanar, it should be recommend using memory type for MMAP for quickly approaching to driver side memroy access. And need to following sequence to prepare buffers to be get image data from memory in directly.

REQ_BUFF_SZ is a predefinition set for 4. and v4l_queu_reqbufs() count at least or bigger than 4. Now you can make stream on for grab continuously buffers.

Make it streamed on

Before it captures any image from camera, it must be started streaming to “on” as below:

If it fails or, doesn’t do this, it will impossible get real captured image – just blacked ( NULL ) image may received.

Wait for a sync.

Every camera, monitors has V-Sync signal for complete draw and capture. V4L just simply can make it sens with select() as below code:

if it return to failure, just skip for capturing image.

Getting an image now

When it succeed to wat a V-Sync, now time to get image as below:

It’s done for get an image from camera with v4l_queue_g_mmapping().

Conclusion

Controlling V4L2 with only native API is very hard to understand, controlling and handling all. But v4l-utils helps to make it easier than before but still hard to understand all because there’s not much good examples not existed. So I will continue to writing some articles for understanding multiplanar typed camera accessing methods.

Any question should be let written on guest book.