Skip to main content

<alp/camera.h> — Image Capture

Camera capture from MIPI CSI-2 (V2N, AEN, i.MX 93) or parallel CPI (fallback).

#include <alp/camera.h>

Capture a frame

alp_camera_t *cam = alp_camera_open(&(alp_camera_config_t){
.sensor = ALP_CAMERA_SENSOR_OV5640,
.resolution = ALP_CAMERA_RES_VGA,
.pixel_format = ALP_CAMERA_FMT_RGB565,
});

alp_camera_frame_t frame;
alp_camera_capture(cam, &frame);

// frame.data / frame.width / frame.height / frame.pitch
process_frame(&frame);

alp_camera_release_frame(cam, &frame);
alp_camera_close(cam);

Backend status

Four camera backends are registered:

BackendPrioritySilicon matchStatus
zephyr_video50"*"The portable path over Zephyr's video API.
v2n_n44_isp100renesas:rzv2n:n44The N44 sensor-pipeline port has not landed yet.
alif_isp_pico100alif:ensemble:e8Opt-in via CONFIG_ALP_SDK_CAMERA_ALIF_ISP (default n). Does not compile today.
zephyr_stub0Last-resort stub so the surface stays linkable.

:::danger alif_isp_pico does not build Enabling CONFIG_ALP_SDK_CAMERA_ALIF_ISP will fail the build. The vendored hal_alif libisp wrapper is older than the driver needs. This is why the option defaults to n — do not turn it on expecting a working camera on E8. :::

ISP toggles (v0.5)

alp_camera_configure_isp exposes the Mali-C55 ISP toggles on the AEN family (auto-exposure, auto-white-balance, gamma, sharpening).

Camera mux (E1M EVK)

The E1M EVK carries an on-board OV5640 and a cam_mux chip to multiplex between it and an external MIPI CSI input; the E1M-X EVK instead exposes dedicated MIPI CSI-2 connectors (CAM0/CAM1) with no on-board sensor or mux. On a board that populates the mux, select the input with the board-side chip driver before opening the camera:

cam_mux_t mux;
cam_mux_init(&mux, brd_i2c, 0x35);
cam_mux_select(&mux, CAM_MUX_INPUT_EXTERNAL);

Default-initialiser macro

alp_camera_config_t cfg = ALP_CAMERA_CONFIG_DEFAULT(ALP_E1M_CAM0);
cfg.width = 640;
cfg.height = 480;

ALP_CAMERA_CONFIG_DEFAULT(id) (v0.10) sets camera_id from id plus: width = 0 and height = 0 (i.e. the sensor's native geometry), fps = 30, format = ALP_PIXFMT_RGB565.

See the shared macro contract for the C++ compound-literal caveat that applies to every ALP_*_CONFIG_DEFAULT.

See also

Questions about this page? Discuss in Community Forum