3.3. sample_isp 使用说明
3.3.1. get_isp_data
3.3.1.1. 功能概述
get_isp_data 完成 Camera Sensor 、 MIPI CSI 、 SIF 和 ISP 模块
用户
软件架构说明
get_isp_data 代码
get_isp_data 软件架构

get_isp_data.c中的 main函数是 程序 的 入口,它 调用 create_and_run_vflow函数来 创建 和 运行 视频流,以及 调用 handle_user_command函数来 处理 用户 命令。 create_and_run_vflow函数负责 创建 视频流 中 的 各个 节点,包括 相机 节点、视频 输入 节点 和 图像 信号处理 节点,以及 创建 和 启动 视频流。 create_camera_node函数用于 创建 相机 节点,该 节点 与 硬件 中 的 相机 传感器 和 MIPI 主机 相关联,通过 libcam.so中的 camera_node实现。create_vin_node函数用于 创建 视频 输入 节点,该 节点 与 硬件 中 的 视频 输入 引擎 相关联,通过 libvpf.so中的 vin_node实现。create_isp_node函数用于 创建 图像 信号处理 节点,该 节点 与 硬件 中 的 图像 信号处理 引擎 相关联,通过 libvpf.so中的 isp_node实现。handle_user_command函数根据 用户 输入 的 命令 调用 相应 的 函数 来 处理,其中 isp_dump_func函数用于 获取 图像 信号处理 节点 的 帧 数据 并 将 其 写入 文件系统 中 的 文件。 vflow节点表示 视频流,它 将 视频 输入 节点 和 图像 信号处理 节点 连接起来,通过 libvpf.so中的 相关 函数 实现。 硬件
节点 包括 相机 传感器、 MIPI 主机、视频 输入 引擎 和 图像 信号处理 引擎,它们 分别 与 相应 的 软件 节点 相关联,共同完成 图像 数据 的 采集、传输 和 处理。
代码位置及目录结构
get_isp_data 相关app/samples/platform_samples/sample_isp/get_isp_data,代码
── get_isp_data
├── get_isp_data.c
└── Makefile
Makefile:用于
编译程序 的 Makefile 文件。 get_isp_data.c:程序
的 主要 源代码 文件。
工具位置及目录结构
工具/app/platform_samples/sample_isp/get_isp_data 目录
root@buildroot:/app/platform_samples/sample_isp/get_isp_data# ls
get_isp_data
get_isp_data 即
API 流程说明
get_isp_data 的

说明:
解析
命令行 :使用参数 getopt_long函数解析 命令行 参数。 打印
帮助 :调用信息 print_help函数显示 帮助 信息。 获取
传感器 :从配置 vp_sensor_config_list中获取 配置。 初始化 MIPI 主机:调用
vp_sensor_fixed_mipi_host函数进行 初始化。 打开
内存模块 :调用hb_mem_module_open函数初始化 内存 管理 模块。 创建
和 :调用运行 数据流 create_and_run_vflow函数为 每个 传感器 创建 并 启动 数据流。 处理
用户 :调用命令 handle_user_command函数进入 用户 交互 模式。 停止
数据流 :调用hbn_vflow_stop函数停止 数据流。 关闭
节点 :调用和 摄像头 hbn_vnode_close和hbn_camera_destroy函数释放 资源。 关闭
内存模块 :调用hb_mem_module_close函数关闭 内存 管理 模块。
3.3.1.2. 编译部署
编译
在make 命令
cd app/samples/platform_samples/sample_isp/get_isp_data
make
详细
硬件环境搭建
开发板Camera Sensor 的
程序部署
编译app/samples/platform_samples/sample_isp/get_isp_data 目录
├── Makefile
├── get_isp_data
├── get_isp_data.c
└── get_isp_data.o
本 sample 的/app/platform_samples/sample_isp/get_isp_data 目录,每次get_isp_data 上chmod +x get_isp_data 命令
3.3.1.3. 运行
程序运行方法
板端/app/platform_samples/sample_isp/get_isp_data 目录,然后
./get_isp_data <Option> <Sensor_index>
示例:
root@buildroot:~# cd /app/platform_samples/sample_isp/get_isp_data/
root@buildroot:/app/platform_samples/sample_isp/get_isp_data# ./get_isp_data -s 7
注意:
如果
root@buildroot:~# cd /app/platform_samples/sample_isp/get_isp_data/
root@buildroot:/app/platform_samples/sample_isp/get_isp_data# ./get_isp_data -s 4 -c vo
重要
提醒 :当接入 HDR Sensor 时,VIN 和 ISP 的 连接 方式 只能 选择 online,由于 online 模式 独占 ISP 资源,所以 仅 支持 1 路。
程序参数选项说明
执行命令 ./get_isp_data -h 可以
root@buildroot:/app/platform_samples/sample_isp/get_isp_data# ./get_isp_data -h
Usage: get_isp_data [OPTIONS]
Options:
-s <sensor_index> Specify sensor index
-m <sensor_mode> Specify sensor mode of camera_config_t, support 'm' and 's'
m: Master
s: Slave
The default value is determined by the configuration in vp_sensor.
-c <channel_type> Specify channel type: vo and vf
1. vo: vin online isp
2. vf: vin offline isp
3. default is vf
-h Show this help message
index: 0 sensor_name: sc1330t config_file:linear_1280x960_raw10_30fps_1lane.c
index: 1 sensor_name: irs2875-tof config_file:linear_208x1413_raw12_15fps_2lane.c
index: 2 sensor_name: sc230ai-10fps config_file:linear_1920x1080_raw10_10fps_1lane.c
index: 3 sensor_name: sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 4 sensor_name: sc230ai-dol2-30fps config_file:dol2_1920x1080_raw10_30fps_2lane.c
index: 5 sensor_name: sc132gs-1280p config_file:linear_1088x1280_raw10_60fps_1lane.c
index: 6 sensor_name: sc132gs-hdr-2lane config_file:hdr_1088x1280_raw10_30fps_2lane.c
index: 7 sensor_name: sc035hgs config_file:linear_640x480_raw10_30fps_1lane.c
index: 8 sensor_name: sc035hgs_mono config_file:linear_mono_640x480_raw10_30fps_1lane.c
index: 9 sensor_name: ov5640 config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 10 sensor_name: f37 config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 11 sensor_name: imx415-30fps-2lane config_file:linear_3840x2160_raw10_30fps_2lane.c
index: 12 sensor_name: imx415-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 13 sensor_name: sc202cs-1600x1200 config_file:linear_1600x1200_raw10_30fps_1lane.c
index: 14 sensor_name: irs2381c-tof config_file:linear_224x1903_raw12_5fps_2lane.c
index: 15 sensor_name: sc035hgs-vc0 config_file:linear_640x480_raw10_30fps_2lane_vc0.c
index: 16 sensor_name: sc035hgs-vc1 config_file:linear_640x480_raw10_30fps_2lane_vc1.c
index: 17 sensor_name: sc231ai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 18 sensor_name: imx586-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 19 sensor_name: os08c10-30fps-2lane config_file:linear_3840x2160_raw12_30fps_2lane.c
index: 20 sensor_name: ar0233-30fps config_file:linear_1920x1080_raw12_30fps_2lane.c
index: 21 sensor_name: ar0820std-30fps config_file:linear_3840x2160_yuv422_30fps_4lane.c
index: 22 sensor_name: sc1336 config_file:linear_1280x720_raw10_15fps_2lane.c
index: 23 sensor_name: dummy config_file:dummy_sensor.c
index: 24 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c
index: 25 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c
index: 26 sensor_name: ov9782-200fps-2lane config_file:linear_640x360_raw10_200fps_2lane.c
index: 27 sensor_name: ov9782-120fps-2lane config_file:linear_1280x720_raw10_120fps_2lane.c
index: 28 sensor_name: imx219-640x480-30fps config_file:linear_640x480_raw10_30fps_2lane.c
index: 29 sensor_name: imx219-1632x1232-30fps config_file:linear_1632x1232_raw10_30fps_2lane.c
index: 30 sensor_name: imx219-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 31 sensor_name: imx219-3264x2464-15fps config_file:linear_3264x2464_raw10_15fps_2lane.c
index: 32 sensor_name: imx219-3264x2464-21fps config_file:linear_3264x2464_raw10_21fps_2lane.c
index: 33 sensor_name: ov5647-640x480-60fps config_file:linear_640x480_raw10_60fps_2lane.c
index: 34 sensor_name: ov5647-1280x960-30fps config_file:linear_1280x960_raw10_30fps_2lane.c
index: 35 sensor_name: ov5647-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 36 sensor_name: ov5647-2592x1944-15fps config_file:linear_2592x1944_raw10_15fps_2lane.c
index: 37 sensor_name: imx678-30fps-4lane config_file:linear_3840x2160_raw12_30fps_4lane.c
index: 38 sensor_name: imx678-30fps-4lane-dol2 config_file:dol2_3840x2160_raw12_30fps_4lane.c
index: 39 sensor_name: imx477-1280x960-120fps config_file:linear_1280x960_raw10_120fps_2lane.c
index: 40 sensor_name: imx477-1920x1080-50fps config_file:linear_1920x1080_raw12_50fps_2lane.c
index: 41 sensor_name: imx477-2016x1520-21fps config_file:linear_2016x1520_raw12_21fps_2lane.c
index: 42 sensor_name: imx477-4000x3000-10fps config_file:linear_4000x3000_raw12_10fps_2lane.c
index: 43 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw10_30fps_4lane.c
index: 44 sensor_name: ox05b1s config_file:linear_2592x1944_raw10_30fps_4lane.c
index: 45 sensor_name: ox05b1s_2lane config_file:linear_2592x1944_raw10_10fps_2lane.c
index: 46 sensor_name: imx415-60fps-4lane config_file:linear_3840x2160_raw10_60fps_4lane.c
index: 47 sensor_name: sc850sl-30fps config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 48 sensor_name: shw3g-30fps config_file:linear_2064x1552_raw12_30fps_4lane.c
index: 49 sensor_name: shw3g-30fps_vc1 config_file:linear_2064x1552_raw12_30fps_4lane_vc1.c
index: 50 sensor_name: sc235hai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 51 sensor_name: cv4006-60fps-2lane config_file:linear_1280x720_raw10_60fps_2lane.c
index: 52 sensor_name: ov50h40-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 53 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw14_30fps_4lane.c
index: 54 sensor_name: sc132gs-slave-right config_file:linear_1088x1280_raw10_30fps_slave_1lane_right.c
index: 55 sensor_name: sc132gs-slave-left config_file:linear_1088x1280_raw10_30fps_slave_1lane_left.c
index: 56 sensor_name: sc132gsstd_vc0 config_file:linear_1088x1280_raw10_10fps_1lane_vc0.c
index: 57 sensor_name: sc132gsstd_vc1 config_file:linear_1088x1280_raw10_10fps_1lane_vc1.c
index: 58 sensor_name: sc132gsstd_vc2 config_file:linear_1088x1280_raw10_10fps_1lane_vc2.c
index: 59 sensor_name: sc132gsstd_vc3 config_file:linear_1088x1280_raw10_10fps_1lane_vc3.c
index: 60 sensor_name: imx415-30fps-4lane-dol2 config_file:dol2_3840x2160_raw10_30fps_4lane.c
index: 61 sensor_name: isx031-30fps-vc0 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc0.c
index: 62 sensor_name: isx031-30fps-vc1 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc1.c
index: 63 sensor_name: isx031-30fps-vc2 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc2.c
index: 64 sensor_name: isx031-30fps-vc3 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc3.c
命令
s <sensor_index>: 该
选项 用于 指定 要 使用 的 传感器 索引。用户 需要 提供 一个 有效 的 索引 值。 m <sensor_mode>: 该
选项 用于 指定 相机 配置 中 的 传感器 模式。 c <channel_type>: 该
选项 用于 指定 使用 的 通道 类型,vo 代表 VIN online ISP,vf 代表 VIN offline ISP ,不 加 该 参数,默认 使用 VIN offline ISP 。 h: 显示
帮助 信息。
当前
| Index | Sensor Name | Configuration File |
|---|---|---|
| 0 | sc1330t | linear_1280x960_raw10_30fps_1lane.c |
| 1 | irs2875-tof | linear_208x1413_raw12_15fps_2lane.c |
| 2 | sc230ai-10fps | linear_1920x1080_raw10_10fps_1lane.c |
| 3 | sc230ai-30fps | linear_1920x1080_raw10_30fps_1lane.c |
| 4 | sc230ai-dol2-30fps | dol2_1920x1080_raw10_30fps_2lane.c |
| 5 | sc132gs-1280p | linear_1088x1280_raw10_30fps_1lane.c |
| 6 | sc132gs-hdr-2lane | hdr_1088x1280_raw10_30fps_2lane.c |
| 7 | sc035hgs | linear_640x480_raw10_30fps_1lane.c |
| 8 | sc035hgs_mono | linear_mono_640x480_raw10_30fps_1lane.c |
| 9 | ov5640 | linear_1920x1080_raw10_30fps_2lane.c |
| 10 | f37 | linear_1920x1080_raw10_30fps_1lane.c |
| 11 | imx415-30fps-2lane | linear_3840x2160_raw10_30fps_2lane.c |
| 12 | imx415-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 13 | sc202cs-1600x1200 | linear_1600x1200_raw10_30fps_1lane.c |
| 14 | irs2381c-tof | linear_224x1903_raw12_5fps_2lane.c |
| 15 | sc035hgs-vc0 | linear_640x480_raw10_30fps_2lane_vc0.c |
| 16 | sc035hgs-vc1 | linear_640x480_raw10_30fps_2lane_vc1.c |
| 17 | sc231ai-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 18 | imx586-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 19 | os08c10-30fps-2lane | linear_3840x2160_raw12_30fps_2lane.c |
| 20 | ar0233-30fps | linear_1920x1080_raw12_30fps_2lane.c |
| 21 | ar0820std-30fps | linear_3840x2160_yuv422_30fps_4lane.c |
| 22 | sc1336 | linear_1280x720_raw10_15fps_2lane.c |
| 23 | dummy | dummy_sensor.c |
| 24 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c |
| 25 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c |
| 26 | ov9782-200fps-2lane | linear_640x360_raw10_200fps_2lane.c |
| 27 | ov9782-120fps-2lane | linear_1280x720_raw10_120fps_2lane.c |
| 28 | imx219-640x480-30fps | linear_640x480_raw10_30fps_2lane.c |
| 29 | imx219-1632x1232-30fps | linear_1632x1232_raw10_30fps_2lane.c |
| 30 | imx219-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 31 | imx219-3264x2464-15fps | linear_3264x2464_raw10_15fps_2lane.c |
| 32 | imx219-3264x2464-21fps | linear_3264x2464_raw10_21fps_2lane.c |
| 33 | ov5647-640x480-60fps | linear_640x480_raw10_60fps_2lane.c |
| 34 | ov5647-1280x960-30fps | linear_1280x960_raw10_30fps_2lane.c |
| 35 | ov5647-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 36 | ov5647-2592x1944-15fps | linear_2592x1944_raw10_15fps_2lane.c |
| 37 | imx678-30fps-4lane | linear_3840x2160_raw12_30fps_4lane.c |
| 38 | imx678-30fps-4lane-dol2 | dol2_3840x2160_raw12_30fps_4lane.c |
| 39 | imx477-1280x960-120fps | linear_1280x960_raw10_120fps_2lane.c |
| 40 | imx477-1920x1080-50fps | linear_1920x1080_raw12_50fps_2lane.c |
| 41 | imx477-2016x1520-40fps | linear_2016x1520_raw12_40fps_2lane.c |
| 42 | imx477-4000x3000-10fps | linear_4000x3000_raw12_10fps_2lane.c |
| 43 | ov50h40-30fps-4lane | linear_4096x3072_raw10_30fps_4lane.c |
| 44 | ox05b1s | linear_2592x1944_raw10_30fps_4lane.c |
| 45 | ox05b1s_2lane | linear_2592x1944_raw10_10fps_2lane.c |
| 46 | imx415-60fps-4lane | linear_3840x2160_raw10_60fps_4lane.c |
| 47 | sc850sl-30fps | linear_3840x2160_raw10_30fps_4lane.c |
| 48 | shw3g-30fps | linear_2064x1552_raw12_30fps_4lane.c |
| 49 | shw3g-30fps_vc1 | linear_2064x1552_raw12_30fps_4lane_vc1.c |
| 50 | sc235hai-30fps | linear_1920x1080_raw10_30fps_2lane.c |
配置文件说明
当前app/samples/platform_samples/vp_sensors 目录
下面linear_1920x1080_raw10_30fps_1lane.c 为例,对
// app/samples/platform_samples/vp_sensors/f37/linear_1920x1080_raw10_30fps_1lane.c
#include "vp_sensors.h"
#define SENSOR_WIDTH 1920
#define SENSOR_HEIGHT 1080
#define SENSOE_FPS 30
#define RAW10 0x2B
static mipi_config_t mipi_config = {
.rx_enable = 1,
.rx_attr = {
.phy = 0,
.lane = 1,
.datatype = RAW10,
.fps = SENSOE_FPS,
.mclk = 24,
.mipiclk = 864,
.width = SENSOR_WIDTH,
.height = SENSOR_HEIGHT,
.linelenth = 2560,
.framelenth = 1125,
.settle = 20,
.channel_num = 1,
.channel_sel = {0},
},
};
static camera_config_t camera_config = {
.name = "f37",
.addr = 0x40,
.sensor_mode = NORMAL_M,
.fps = SENSOE_FPS,
.format = RAW10,
.width = SENSOR_WIDTH,
.height = SENSOR_HEIGHT,
.mipi_cfg = &mipi_config,
.gpio_enable_bit = 0x01,
.gpio_level_bit = 0x00,
.calib_lname = "disable",
};
static vin_node_attr_t vin_node_attr = {
.cim_attr = {
.mipi_rx = 2,
.vc_index = 0,
.ipi_channel = 1,
.cim_isp_flyby = 1,
.func = {
.enable_frame_id = 1,
.set_init_frame_id = 0,
.hdr_mode = NOT_HDR,
.time_stamp_en = 0,
},
},
};
static vin_attr_ex_t vin_attr_ex = {
.vin_attr_ex_mask = 0x80,
.mclk_ex_attr = {
.mclk_freq = 24000000,
},
};
static vin_ichn_attr_t vin_ichn_attr = {
.width = SENSOR_WIDTH,
.height = SENSOR_HEIGHT,
.format = RAW10,
};
static vin_ochn_attr_t vin_ochn_attr = {
.ddr_en = 1,
.ochn_attr_type = VIN_BASIC_ATTR,
.vin_basic_attr = {
.format = RAW10,
// 硬件 stride 跟格式匹配,通过行像素根据 raw 数据 bit 位数计算得来
// 8bit: x1, 10bit: x2 12bit: x2 16bit: x2, 例 raw10 , 1920 x 2 = 3840
.wstride = (SENSOR_WIDTH) * 2,
},
};
static isp_attr_t isp_attr = {
.input_mode = 1, // PASSTHROUGH_MODE : online, MCM_MODE: 用于调试,DDR_MODE: offline
.sensor_mode= ISP_NORMAL_M,
.crop = {
.x = 0,
.y = 0,
.h = SENSOR_HEIGHT,
.w = SENSOR_WIDTH,
},
};
static isp_ichn_attr_t isp_ichn_attr = {
.width = SENSOR_WIDTH,
.height = SENSOR_HEIGHT,
.fmt = FRM_FMT_RAW,
.bit_width = 10,
};
static isp_ochn_attr_t isp_ochn_attr = {
.ddr_en = 1,
.fmt = FRM_FMT_NV12,
.bit_width = 8,
};
vp_sensor_config_t f37_linear_1920x1080_raw10_30fps_1lane = {
.chip_id_reg = 0x0a0b,
.chip_id = 0x0f37,
.sensor_name = "f37",
.config_file = "linear_1920x1080_raw10_30fps_1lane.c",
.camera_config = &camera_config,
.vin_ichn_attr = &vin_ichn_attr,
.vin_node_attr = &vin_node_attr,
.vin_attr_ex = &vin_attr_ex,
.vin_ochn_attr = &vin_ochn_attr,
.isp_attr = &isp_attr,
.isp_ichn_attr = &isp_ichn_attr,
.isp_ochn_attr = &isp_ochn_attr,
};
宏
定义 #define SENSOR_WIDTH 1920 #define SENSOR_HEIGHT 1080 #define SENSOE_FPS 30 #define RAW10 0x2B
SENSOR_WIDTH: 传感器
的 宽度 设置 为 1920 像素。 SENSOR_HEIGHT: 传感器
的 高度 设置 为 1080 像素。 SENSOE_FPS: 传感器
的 帧 率 设置 为 30 帧 每秒。 RAW10: 数据格式
定义 为 RAW10 ,使用 十六进制 值 0x2B 表示。
MIPI 配置
static mipi_config_t mipi_config = { .rx_enable = 1, .rx_attr = { .phy = 0, .lane = 1, .datatype = RAW10, .fps = SENSOE_FPS, .mclk = 24, .mipiclk = 864, .width = SENSOR_WIDTH, .height = SENSOR_HEIGHT, .linelenth = 2560, .framelenth = 1125, .settle = 20, .channel_num = 1, .channel_sel = {0}, }, };
rx_enable: 接收
使能,设置 为 1 表示 启用。 rx_attr: 包含 MIPI 接口
的 属性: phy: 物理
接口 设置 为 0 。 lane: 使用 1 条
数据通道。 datatype: 数据类型
为 RAW10 。 fps: 帧
率 为 30 。 mclk: 主
时钟 频率 为 24MHz。 mipiclk: MIPI 时钟
频率 为 864MHz,每 lane 速率 为 mipiclk/lane。 width: 图像
宽度 为 1920 。 height: 图像
高度 为 1080 。 linelenth: 行
长度 为 2560 。 framelenth: 帧
长度 为 1125 。 settle: 设定
时间 为 20 。 channel_num: 通道
数量 为 1 。 channel_sel: 选择
的 通道 为 0 。
相机
配置 static camera_config_t camera_config = { .name = "f37", .addr = 0x40, .sensor_mode = NORMAL_M, .fps = SENSOE_FPS, .format = RAW10, .width = SENSOR_WIDTH, .height = SENSOR_HEIGHT, .mipi_cfg = &mipi_config, .gpio_enable_bit = 0x01, .gpio_level_bit = 0x00, .calib_lname = "disable", };
name: 相机
名称 为 “f37”。 addr: I2C 地址
为 0x40 。 sensor_mode: 传感器
模式 设置 为 NORMAL_M ,当前 支持 下面 几种 模式: NORMAL_M = 1 ;
DOL2_M = 2 ;
DOL3_M = 3 ;
DOL4_M = 4 ;
PWL_M = 5 ;
SLAVE_M = 6 。
fps: 帧
率 为 30 帧 每秒。 format: 数据格式
为 RAW10 。 mipi_cfg: 指向 MIPI 配置
的 指针。 gpio_enable_bit: GPIO 使能
数量 为 1 。 gpio_level_bit: GPIO 电平
位为 0x00 。 calib_lname: sensor 效果
库 路径,默认 路径 为 /usr/hobot/lib/sensor, 支持自定义 路径,总长度 不 超过 100 字节,设置 为 “disable” 时,代码 会 默认 使用 <sensor_name>_tuning.json 文件 中 的 相关 属性。
VIN 节点
属性 static vin_node_attr_t vin_node_attr = { .cim_attr = { .mipi_rx = 2, .vc_index = 0, .ipi_channel = 1, .cim_isp_flyby = 1, .func = { .enable_frame_id = 1, .set_init_frame_id = 0, .hdr_mode = NOT_HDR, .time_stamp_en = 0, }, }, };
cim_attr: 包含 VIN 节点
的 属性: mipi_rx: MIPI 接收
通道 设置 为 2 。 vc_index: 虚拟
通道 索引 为 0 。 ipi_channel: IPI 通道
设置 为 1 。 cim_isp_flyby: 设置
为 1 表示 sif online 到 isp,数据 不 经过 DDR。 func: 包含
功能 设置: enable_frame_id: 启用
帧 ID。 set_init_frame_id: 初始化
帧 ID 设置 为 0 。 hdr_mode: HDR 模式
设置 为 NOT_HDR。 time_stamp_en: 时间
戳 使 能 设置 为 0 。
VIN 扩展
属性 static vin_attr_ex_t vin_attr_ex = { .vin_attr_ex_mask = 0x80, .mclk_ex_attr = { .mclk_freq = 24000000, }, };
vin_attr_ex_mask: 扩展
属性 掩码 设置 为 0x80 。 mclk_ex_attr: 包含
主 时钟 频率 的 设置,频率 为 24MHz。
输入
通道 属性 static vin_ichn_attr_t vin_ichn_attr = { .width = SENSOR_WIDTH, .height = SENSOR_HEIGHT, .format = RAW10, };
vin_ichn_attr: 输入
通道 属性,设置 宽度、高度 和 格式 为 RAW10 。
输出
通道 属性 static vin_ochn_attr_t vin_ochn_attr = { .ddr_en = 1, .ochn_attr_type = VIN_BASIC_ATTR, .vin_basic_attr = { .format = RAW10, .wstride = (SENSOR_WIDTH) * 2, }, };
vin_ochn_attr: 输出
通道 属性: ddr_en: DDR 使能
设置 为 1 。 ochn_attr_type: 输出
通道 属性 类型 为 VIN_BASIC_ATTR。 vin_basic_attr: 包含
基本 属性: format: 输出
格式 为 RAW10 。 wstride: 宽度
步长 计算 为 1920 * 2 = 3840 (因为 RAW10 格式 每个 像素 占用 2 个 字节)。
ISP 属性
static isp_attr_t isp_attr = { .input_mode = 1, // PASSTHROUGH_MODE : online, MCM_MODE: 用于调试,DDR_MODE: offline .sensor_mode= ISP_NORMAL_M, .crop = { .x = 0, .y = 0, .h = SENSOR_HEIGHT, .w = SENSOR_WIDTH, }, };
input_mode: sif 输入
到 isp 的 通路 模式, 0 :表示 sif 直连到 isp(只能
支持 1 路); 1 :表示 sif 直连到 isp, isp 内部
通过 MCM 调度 多路(最 多 支持 4 路,此 模式 );用于 调试,不 建议 在 正式 产品 中 使用 2 :表示 sif 通过 ddr 到 isp。
需要
注意 的 是: input_mode为 0 或者 1 时,cim_isp_flyby必须为 1 , sif 必须 把 输出 通道 1 绑定 到 isp 的 输入 通道。 input_mode为 2 时,cim_isp_flyby必须为 0 , sif 下 drr 的 功能 必须 打开, sif 必须 把 输出 通道 0 绑定 到 isp 的 输入 通道。
sensor_mode: ISP 模式
设置 为 ISP_NORMAL_M ,当前 支持 下面 几种 模式: ISP_NORMAL_M = 0 ;
ISP_DOL2_M = 1 ;
ISP_PWL_M = 2 。
crop: 对 isp 的
输入 图像 crop 的 参数。裁剪 区域 的 设置,裁剪 区域 从 (0,0) 开始,宽度 和 高度 与 传感器 相同。作为 ISP 的 输出 尺寸 使用,为 0 时 驱动 默认 使用 输入 尺寸 作为 输出 尺寸。原本 的 输出 尺寸 暂时 无用。
ISP 输入
和 输出 通道 属性 static isp_ichn_attr_t isp_ichn_attr = { .width = SENSOR_WIDTH, .height = SENSOR_HEIGHT, .fmt = FRM_FMT_RAW, .bit_width = 10, }; static isp_ochn_attr_t isp_ochn_attr = { .ddr_en = 1, .fmt = FRM_FMT_NV12, .bit_width = 8, };
isp_ichn_attr: ISP 输入
通道 属性,设置 宽度、高度、格式 为 RAW,位 宽 为 10 。 isp_ochn_attr: ISP 输出
通道 属性, DDR 使能 设置 为 1 ,输出 格式 为 NV12 ,位 宽 为 8 。
传感器
配置 结构 vp_sensor_config_t f37_linear_1920x1080_raw10_30fps_1lane = { .chip_id_reg = 0x0a0b, .chip_id = 0x0f37, .sensor_name = "f37", .config_file = "linear_1920x1080_raw10_30fps_1lane.c", .camera_config = &camera_config, .vin_ichn_attr = &vin_ichn_attr, .vin_node_attr = &vin_node_attr, .vin_attr_ex = &vin_attr_ex, .vin_ochn_attr = &vin_ochn_attr, .isp_attr = &isp_attr, .isp_ichn_attr = &isp_ichn_attr, .isp_ochn_attr = &isp_ochn_attr, };
vp_sensor_config_t: 定义
传感器 配置 结构,包含 传感器 的 各种 属性 和 配置文件 信息: chip_id_reg: 芯片 ID 寄存器
地址 为 0x0A0B。 chip_id: 芯片 ID 为 0x0F37 。
sensor_name: 传感器
名称 为 “f37”。 config_file: 配置文件
名为 “linear_1920x1080_raw10_30fps_1lane.c”。 其他
属性 指向 之前 定义 的 配置 结构。
运行效果
接下来
./get_isp_data -s 10
Using index:10 sensor_name:f37 config_file:linear_1920x1080_raw10_30fps_1lane.c
Searching camera sensor on device: /proc/device-tree/soc/cam/vcon@0 i2c bus: 4 mipi rx phy: 0
Searching camera sensor on device: /proc/device-tree/soc/cam/vcon@2 i2c bus: 2 mipi rx phy: 2
INFO: Found sensor_name:f37 on mipi rx csi 2, i2c addr 0x40, config_file:linear_1920x1080_raw10_30fps_1lane.c
Not config sensor mode, so usr default mode.
create_and_run_vflow() src_out_channel : 0 , dst_input_channel : 0
use offline mode
create_vin_node() cim_isp_flyby = 0 , vin_ochn_ddr_en = 1
create_isp_node() isp_attr input_mode : 2
*************** Command Lists ***************
g -- get single frame
l -- get a set frames
q -- quit
h -- print help message
Command:
g: 获取
一帧 图像,支持 输入 多个 g 来 连续 获取 图像,例如 输入 gggg
Command: g
isp dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 0, timestamp: 197145649052
l: 连续
获取 12 帧 图像,相当于 输入 12 个 g
Command: l
isp dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 1, timestamp: 197178981635
isp dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 355, timestamp: 208978985224
... ( 省略,总共 Dump 12 帧 ) ...
isp dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 394, timestamp: 210278982766
isp dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 395, timestamp: 210312316183
q: 退出
程序
Command: q
quit
执行程序isp_chn0_1280x960_stride_1280_sframeid_1.yuv 命名
可以
浏览 YUV 图
按照

3.3.1.4. 常见问题
硬件
接触不良、接口 松动 导致 测试 异常 检查 硬件 连接 状态,确保 硬件 连接 稳定。
3.3.2. multi_isp_vflow
3.3.2.1. 功能概述
multi_isp_vflow 完成 Camera Sensor 、 MIPI CSI 、 SIF 和 ISP 模块
用户
程序
开发板Camera Sensor 的
软件架构说明
multi_isp_vflow 通过libcam.so 和 libvpf.so 中libcam.so 负责libvpf.so 提供
multi_isp_vflow 软件架构

libcam.so 作为multi_isp_vflow 通过libcam.so 的 API,实现
hbn_camera_create:用于创建 相机 节点,初始化 相机 设备,使 其 能够 进行 图像 采集。 hbn_camera_attach_to_vin:将相机 节点 绑定 到 视频 输入 节点,建立 相机 与 视频 输入 之间 接,确保 相机 采集 的 图像 数据 能够 传输 到 视频 输入 节点 进行 后续 处理。 hbn_camera_destroy:用于销毁 相机 节点,释放 相机 设备 资源,结束 相机 的 图像 采集 功能。
而 libvpf.so 作为multi_isp_vflow 通过libvpf.so 的 API,实现
hbn_vnode_open:用于打开 视频 输入 节点 或 ISP 节点,初始化 节点 设备,使 其 能够 进行 数据处理。 hbn_vnode_set_attr、hbn_vnode_set_ichn_attr、hbn_vnode_set_ochn_attr:用于设置 节点 的 属性、输入 通道 属性 和 输出 通道 属性,配置 节点 的 工作 参数,如 分辨率、帧 率、色彩 格式 等,以 满足 不同 的 处理 需求。 hbn_vnode_getframe、hbn_vnode_releaseframe:用于从 节点 获取 帧 数据 和 释放 帧 数据,实现 数据 的 读取 和 管理。 hbn_vflow_create、hbn_vflow_add_vnode、hbn_vflow_bind_vnode、hbn_vflow_start、hbn_vflow_stop、hbn_vflow_destroy:用于创建、管理、绑定、启动、停止 和 销毁 数据流( vflow),实现 数据 在 不同 节点 之间 的 传输 和 处理 流程 的 控制。 hbn_isp_get_awb_attr、hbn_isp_set_awb_attr、hbn_isp_get_exposure_attr、hbn_isp_set_exposure_attr:用于获取 和 设置 ISP 的 自动 白平衡( AWB)和 曝光( AE)属性,实现 图像 质量 的 调节 和 控制。
代码位置及目录结构
multi_isp_vflow 相关/app/samples/platform_samples/sample_isp,代码
└── multi_isp_vflow
├── Makefile
└── multi_isp_vflow.c
Makefile:用于
编译程序 的 Makefile 文件。 multi_isp_vflow.c:程序
的 主要 源代码 文件。
工具位置及目录结构
工具/app/platform_samples/sample_isp/multi_isp_vflow 目录
root@buildroot:/app/platform_samples/sample_isp/multi_isp_vflow# ls
multi_isp_vflow
multi_isp_vflow 即
API 流程说明
get_isp_data 的

说明:
解析
命令行 :使用参数 getopt_long()函数解析 命令行 输入。 获取
传感器 :通过配置 vp_sensor_config_list[index]获取指定 索引 的 传感器 配置。 初始化 MIPI 主机:调用
vp_sensor_fixed_mipi_host()函数来 初始化 MIPI 主机。 创建
并 :使用运行 VIN-ISP 流 create_and_run_vin_isp_vflow(&vin_isp_contex)和create_and_run_isp_vflow(&isp_contex)创建并 运行 数据流。 设置
虚拟 :通过传感器 参数 fixed_dummy_sensor_config(&vin_isp_contex, &dummy_sensor_config)设置虚拟 传感器 的 相关 参数。 处理
用户 :通过命令 handle_user_command(vin_isp_contex, isp_contex)处理用户 输入 的 命令。 停止 VIN 流:调用
hbn_vnode_releaseframe()释放帧 数据。 关闭 VIN 和 ISP 节点:使用
hbn_vnode_close()关闭节点。 销毁
相机 :调用vp_sensor_destroy()释放相机 资源。 打印
帮助 :如果信息 传感器 索引 无效,调用 print_help()打印帮助 信息。
3.3.2.2. 编译部署
编译
在make 命令
cd app/samples/platform_samples/sample_isp/multi_isp_vflow
make
详细
硬件环境搭建
开发板Camera Sensor 的
程序部署
编译app/samples/platform_samples/sample_isp/multi_isp_vflow 目录
├── Makefile
├── multi_isp_vflow
├── multi_isp_vflow.c
└── multi_isp_vflow.o
本 sample 的/app/platform_samples/sample_isp/multi_isp_vflow 目录,每次multi_isp_vflow 上chmod +x multi_isp_vflow 命令
3.3.2.3. 运行
程序运行方法
板端/app/platform_samples/sample_isp/multi_isp_vflow 目录,然后
./multi_isp_vflow <Option> <Sensor_index>
示例:
root@buildroot:~# cd /app/platform_samples/sample_isp/multi_isp_vflow/
root@buildroot:/app/platform_samples/sample_isp/multi_isp_vflow# ./multi_isp_vflow -s 7
程序参数选项说明
执行命令 ./multi_isp_vflow -h 可以
root@buildroot:/app/platform_samples/sample_isp/multi_isp_vflow# ./multi_isp_vflow -h
Usage: multi_isp_vflow [OPTIONS]
Options:
-s <sensor_index> Specify sensor index
-h Show this help message
index: 0 sensor_name: sc1330t config_file:linear_1280x960_raw10_30fps_1lane.c
index: 1 sensor_name: irs2875-tof config_file:linear_208x1413_raw12_15fps_2lane.c
index: 2 sensor_name: sc230ai-10fps config_file:linear_1920x1080_raw10_10fps_1lane.c
index: 3 sensor_name: sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 4 sensor_name: sc230ai-dol2-30fps config_file:dol2_1920x1080_raw10_30fps_2lane.c
index: 5 sensor_name: sc132gs-1280p config_file:linear_1088x1280_raw10_60fps_1lane.c
index: 6 sensor_name: sc132gs-hdr-2lane config_file:hdr_1088x1280_raw10_30fps_2lane.c
index: 7 sensor_name: sc035hgs config_file:linear_640x480_raw10_30fps_1lane.c
index: 8 sensor_name: sc035hgs_mono config_file:linear_mono_640x480_raw10_30fps_1lane.c
index: 9 sensor_name: ov5640 config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 10 sensor_name: f37 config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 11 sensor_name: imx415-30fps-2lane config_file:linear_3840x2160_raw10_30fps_2lane.c
index: 12 sensor_name: imx415-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 13 sensor_name: sc202cs-1600x1200 config_file:linear_1600x1200_raw10_30fps_1lane.c
index: 14 sensor_name: irs2381c-tof config_file:linear_224x1903_raw12_5fps_2lane.c
index: 15 sensor_name: sc035hgs-vc0 config_file:linear_640x480_raw10_30fps_2lane_vc0.c
index: 16 sensor_name: sc035hgs-vc1 config_file:linear_640x480_raw10_30fps_2lane_vc1.c
index: 17 sensor_name: sc231ai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 18 sensor_name: imx586-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 19 sensor_name: os08c10-30fps-2lane config_file:linear_3840x2160_raw12_30fps_2lane.c
index: 20 sensor_name: ar0233-30fps config_file:linear_1920x1080_raw12_30fps_2lane.c
index: 21 sensor_name: ar0820std-30fps config_file:linear_3840x2160_yuv422_30fps_4lane.c
index: 22 sensor_name: sc1336 config_file:linear_1280x720_raw10_15fps_2lane.c
index: 23 sensor_name: dummy config_file:dummy_sensor.c
index: 24 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c
index: 25 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c
index: 26 sensor_name: ov9782-200fps-2lane config_file:linear_640x360_raw10_200fps_2lane.c
index: 27 sensor_name: ov9782-120fps-2lane config_file:linear_1280x720_raw10_120fps_2lane.c
index: 28 sensor_name: imx219-640x480-30fps config_file:linear_640x480_raw10_30fps_2lane.c
index: 29 sensor_name: imx219-1632x1232-30fps config_file:linear_1632x1232_raw10_30fps_2lane.c
index: 30 sensor_name: imx219-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 31 sensor_name: imx219-3264x2464-15fps config_file:linear_3264x2464_raw10_15fps_2lane.c
index: 32 sensor_name: imx219-3264x2464-21fps config_file:linear_3264x2464_raw10_21fps_2lane.c
index: 33 sensor_name: ov5647-640x480-60fps config_file:linear_640x480_raw10_60fps_2lane.c
index: 34 sensor_name: ov5647-1280x960-30fps config_file:linear_1280x960_raw10_30fps_2lane.c
index: 35 sensor_name: ov5647-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 36 sensor_name: ov5647-2592x1944-15fps config_file:linear_2592x1944_raw10_15fps_2lane.c
index: 37 sensor_name: imx678-30fps-4lane config_file:linear_3840x2160_raw12_30fps_4lane.c
index: 38 sensor_name: imx678-30fps-4lane-dol2 config_file:dol2_3840x2160_raw12_30fps_4lane.c
index: 39 sensor_name: imx477-1280x960-120fps config_file:linear_1280x960_raw10_120fps_2lane.c
index: 40 sensor_name: imx477-1920x1080-50fps config_file:linear_1920x1080_raw12_50fps_2lane.c
index: 41 sensor_name: imx477-2016x1520-21fps config_file:linear_2016x1520_raw12_21fps_2lane.c
index: 42 sensor_name: imx477-4000x3000-10fps config_file:linear_4000x3000_raw12_10fps_2lane.c
index: 43 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw10_30fps_4lane.c
index: 44 sensor_name: ox05b1s config_file:linear_2592x1944_raw10_30fps_4lane.c
index: 45 sensor_name: ox05b1s_2lane config_file:linear_2592x1944_raw10_10fps_2lane.c
index: 46 sensor_name: imx415-60fps-4lane config_file:linear_3840x2160_raw10_60fps_4lane.c
index: 47 sensor_name: sc850sl-30fps config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 48 sensor_name: shw3g-30fps config_file:linear_2064x1552_raw12_30fps_4lane.c
index: 49 sensor_name: shw3g-30fps_vc1 config_file:linear_2064x1552_raw12_30fps_4lane_vc1.c
index: 50 sensor_name: sc235hai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 51 sensor_name: cv4006-60fps-2lane config_file:linear_1280x720_raw10_60fps_2lane.c
index: 52 sensor_name: ov50h40-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 53 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw14_30fps_4lane.c
index: 54 sensor_name: sc132gs-slave-right config_file:linear_1088x1280_raw10_30fps_slave_1lane_right.c
index: 55 sensor_name: sc132gs-slave-left config_file:linear_1088x1280_raw10_30fps_slave_1lane_left.c
index: 56 sensor_name: sc132gsstd_vc0 config_file:linear_1088x1280_raw10_10fps_1lane_vc0.c
index: 57 sensor_name: sc132gsstd_vc1 config_file:linear_1088x1280_raw10_10fps_1lane_vc1.c
index: 58 sensor_name: sc132gsstd_vc2 config_file:linear_1088x1280_raw10_10fps_1lane_vc2.c
index: 59 sensor_name: sc132gsstd_vc3 config_file:linear_1088x1280_raw10_10fps_1lane_vc3.c
index: 60 sensor_name: imx415-30fps-4lane-dol2 config_file:dol2_3840x2160_raw10_30fps_4lane.c
index: 61 sensor_name: isx031-30fps-vc0 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc0.c
index: 62 sensor_name: isx031-30fps-vc1 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc1.c
index: 63 sensor_name: isx031-30fps-vc2 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc2.c
index: 64 sensor_name: isx031-30fps-vc3 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc3.c
命令
s <sensor_index>: 该
选项 用于 指定 要 使用 的 传感器 索引。用户 需要 提供 一个 有效 的 索引 值。 h: 显示
帮助 信息。
当前
| Index | Sensor Name | Configuration File |
|---|---|---|
| 0 | sc1330t | linear_1280x960_raw10_30fps_1lane.c |
| 1 | irs2875-tof | linear_208x1413_raw12_15fps_2lane.c |
| 2 | sc230ai-10fps | linear_1920x1080_raw10_10fps_1lane.c |
| 3 | sc230ai-30fps | linear_1920x1080_raw10_30fps_1lane.c |
| 4 | sc230ai-dol2-30fps | dol2_1920x1080_raw10_30fps_2lane.c |
| 5 | sc132gs-1280p | linear_1088x1280_raw10_30fps_1lane.c |
| 6 | sc132gs-hdr-2lane | hdr_1088x1280_raw10_30fps_2lane.c |
| 7 | sc035hgs | linear_640x480_raw10_30fps_1lane.c |
| 8 | sc035hgs_mono | linear_mono_640x480_raw10_30fps_1lane.c |
| 9 | ov5640 | linear_1920x1080_raw10_30fps_2lane.c |
| 10 | f37 | linear_1920x1080_raw10_30fps_1lane.c |
| 11 | imx415-30fps-2lane | linear_3840x2160_raw10_30fps_2lane.c |
| 12 | imx415-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 13 | sc202cs-1600x1200 | linear_1600x1200_raw10_30fps_1lane.c |
| 14 | irs2381c-tof | linear_224x1903_raw12_5fps_2lane.c |
| 15 | sc035hgs-vc0 | linear_640x480_raw10_30fps_2lane_vc0.c |
| 16 | sc035hgs-vc1 | linear_640x480_raw10_30fps_2lane_vc1.c |
| 17 | sc231ai-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 18 | imx586-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 19 | os08c10-30fps-2lane | linear_3840x2160_raw12_30fps_2lane.c |
| 20 | ar0233-30fps | linear_1920x1080_raw12_30fps_2lane.c |
| 21 | ar0820std-30fps | linear_3840x2160_yuv422_30fps_4lane.c |
| 22 | sc1336 | linear_1280x720_raw10_15fps_2lane.c |
| 23 | dummy | dummy_sensor.c |
| 24 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c |
| 25 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c |
| 26 | ov9782-200fps-2lane | linear_640x360_raw10_200fps_2lane.c |
| 27 | ov9782-120fps-2lane | linear_1280x720_raw10_120fps_2lane.c |
| 28 | imx219-640x480-30fps | linear_640x480_raw10_30fps_2lane.c |
| 29 | imx219-1632x1232-30fps | linear_1632x1232_raw10_30fps_2lane.c |
| 30 | imx219-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 31 | imx219-3264x2464-15fps | linear_3264x2464_raw10_15fps_2lane.c |
| 32 | imx219-3264x2464-21fps | linear_3264x2464_raw10_21fps_2lane.c |
| 33 | ov5647-640x480-60fps | linear_640x480_raw10_60fps_2lane.c |
| 34 | ov5647-1280x960-30fps | linear_1280x960_raw10_30fps_2lane.c |
| 35 | ov5647-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 36 | ov5647-2592x1944-15fps | linear_2592x1944_raw10_15fps_2lane.c |
| 37 | imx477-1280x960-120fps | linear_1280x960_raw10_120fps_2lane.c |
| 38 | imx477-1920x1080-50fps | linear_1920x1080_raw12_50fps_2lane.c |
| 39 | imx477-2016x1520-40fps | linear_2016x1520_raw12_40fps_2lane.c |
| 40 | imx477-4000x3000-10fps | linear_4000x3000_raw12_10fps_2lane.c |
| 41 | ov50h40-30fps-4lane | linear_4096x3072_raw10_30fps_4lane.c |
| 42 | ox05b1s | linear_2592x1944_raw10_30fps_4lane.c |
| 43 | ox05b1s_2lane | linear_2592x1944_raw10_10fps_2lane.c |
| 44 | imx415-60fps-4lane | linear_3840x2160_raw10_60fps_4lane.c |
| 45 | sc850sl-30fps | linear_3840x2160_raw10_30fps_4lane.c |
| 46 | shw3g-30fps | linear_2064x1552_raw12_30fps_4lane.c |
配置文件说明
当前app/samples/platform_samples/vp_sensors 目录
相关
运行效果
接下来
./multi_isp_vflow -s 3
Using index:3 sensor_name:sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
... ( 省略无关日志 ) ...
Searching camera sensor on device: /proc/device-tree/soc/cam/vcon@3 i2c bus: 7 mipi rx phy: 3
INFO: Found sensor_name:sc230ai-30fps on mipi rx csi 3, i2c addr 0x30, config_file:linear_1920x1080_raw10_30fps_1lane.c
[INFO] Create isp node handle: 165733
[INFO] Create isp node handle: 296805
*************** Command Lists ***************
g -- get single frame
l -- get a set frames
e -- get a set frames and backfill ae, awb
q -- quit
h -- print help message
Command:
命令
g: 获取
一帧 图像( Raw),并 把 该 Raw 图 分别 送给 两个 ISP 实例 处理,并且 保存 处理 后 的 YUV 图像(保存 图像 不管 是 写 内存 还是 写 磁盘 都 会 很 影响 性能),最终 两个 ISP 会 分别 生成 一张 YUV 格式 的 图像文件。 支持
输入 多个 g 来 连续 获取 图像,例如 输入 gggg,这样 最终 两个 ISP 会 分别 生成 4 张 YUV 格式 的 图像文件。
Command: g
vin dump raw 1920x1080(stride:3840), buffer size: 4147200 frame id: 1, timestamp: 8831341125627
isp(165733) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 1, timestamp: 8831341125627
isp(296805) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 1, timestamp: 8831341125627
l: 连续
获取 12 帧 图像,相当于 输入 12 个 g,最终 两个 ISP 会 分别 生成 12 张 YUV 格式 的 图像文件。
Command: l
vin dump raw 1920x1080(stride:3840), buffer size: 4147200 frame id: 5326, timestamp: 9008841124337
isp(165733) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5326, timestamp: 9008841124337
isp(296805) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5326, timestamp: 9008841124337
vin dump raw 1920x1080(stride:3840), buffer size: 4147200 frame id: 5327, timestamp: 9008874457587
isp(165733) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5327, timestamp: 9008874457587
isp(296805) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5327, timestamp: 9008874457587
... ( 省略,总共 Dump 12 帧 ) ...
vin dump raw 1920x1080(stride:3840), buffer size: 4147200 frame id: 5426, timestamp: 9012174457588
isp(165733) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5426, timestamp: 9012174457588
isp(296805) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 5426, timestamp: 9012174457588
e: 连续 12 帧
获取 主 通路 ISP 的 2A(AE 和 AWB)回灌 给 从 通路,dump 主从 路 图像 和 2A 信息,最终 两个 ISP 会 分别 生成 12 张 YUV 格式 的 图像文件。
Command: e
(dump_awb_attr)handle 100197 awb: version 0 mode 0manual_attr: gain: rgain: 2.271484grgain: 1.067383gbgain: 1.067383bgain: 1.876953
(dump_exp_attr)handle 100197 exp: version 0 mode 0manual_attr: gain: exp_time: 2.271484again: 0.009985
dgain: 2.650473ispgain: 1.000000ae_exp: 1.000000cur_lux 1108738304
isp(100197) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 1, timestamp: 59184108316179
>>> awb backfill...
>>> ae backfill...
vin dump raw 1920x1080(stride:3840), buffer size: 4147200 frame id: 76, timestamp: 59186608321055
(dump_awb_attr)handle 231269 awb: version 0 mode 1manual_attr: gain: rgain: 2.271484grgain: 1.067383gbgain: 1.067383bgain: 1.876953
(dump_exp_attr)handle 231269 exp: version 0 mode 1manual_attr: gain: exp_time: 2.271484again: 0.009985
dgain: 2.650473ispgain: 1.000000ae_exp: 1.000000cur_lux 0
isp(231269) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 76, timestamp: 59186608321055
... ( 省略,总共 Dump 12 帧 ) ...
q: 退出
程序
Command: q
quit
注意: multi_isp_vflow 目前
程序运行
isp_handle_165733_chn0_1920x1080_stride_1920_frameid_1860_ts_8893307792615.yuv
字
isp_handle: ISP 实例
的 handle 号,用于 区分 不同 ISP 实例。 示例:
165733
chn: ISP 通道
号, ISP 的 值 都 是 0。1920x1080_stride_1920:图像
分辨率(宽度 x 高度)和 对齐 后 的 宽度。 示例:
1920x1080_stride_1920
frameid:帧 ID,表示
图像 帧 的 唯一 标识。 示例:
1860
ts:时间
戳,表示 捕捉 图像 的 时间,单位:纳秒。 示例:
8893307792615
注意: frameid 和 ts 需要
在 vp_sensors 目录
static vin_node_attr_t sc230ai_vin_node_attr = {
.cim_attr = {
... ...
.func = {
.enable_frame_id = 1, # 使能 frameid
.set_init_frame_id = 0,
.hdr_mode = NOT_HDR,
.time_stamp_en = 0, # 使能 ts, 如果 enable_frame_id 为 1 , ts 会自动使能
},
},
3.3.2.4. 常见问题
multi_isp_vflow 目前
只 支持 sc230ai 模组,其他 模组 需 修改 dummy sensor 库 适配。
3.3.3. isp_feedback
3.3.3.1. 功能概述
isp_feedback通过虚拟 Camera Sensor 初始化 MIPI CSI、SIF 和 ISP 模块,读取 RAW 图像 数据,并 回灌 至 ISP 进行 调校 后 生成 YUV 图像。 isp_feedback调校时,会 应用 指定 Camera Sensor 的 参数,并 使用 对应 的 ISP 效果 库。 程序
编译 方式 请 查阅 编译 方法 章节。
软件架构说明
isp_feedback 通过libcam.so 和 libvpf.so 中
libcam.so:负责虚拟 Camera Sensor 设备 的 驱动 和 控制。 libvpf.so:提供视频 输入 和 ISP 处理 的 核心 功能。

主要 API 说明
hbn_camera_create:创建虚拟 Camera Sensor 节点,初始化 Camera Sensor 设备。 hbn_camera_attach_to_vin:绑定虚拟 Camera Sensor 到 视频 输入 节点,实现 数据传输。 hbn_camera_destroy:销毁虚拟 Camera Sensor 节点,释放 设备 资源。 hbn_vnode_open:用于打开 视频 输入 节点 或 ISP 节点,初始化 节点 设备,使 其 能够 进行 数据处理。 hbn_vnode_set_attr、hbn_vnode_set_ichn_attr、hbn_vnode_set_ochn_attr:用于设置 节点 的 属性、输入 通道 属性 和 输出 通道 属性,配置 节点 的 工作 参数,如 分辨率、帧 率、色彩 格式 等,以 满足 不同 的 处理 需求。 hbn_vnode_getframe、hbn_vnode_releaseframe:用于从 节点 获取 帧 数据 和 释放 帧 数据,实现 数据 的 读取 和 管理。 hbn_vflow_create、hbn_vflow_add_vnode、hbn_vflow_start、hbn_vflow_stop、hbn_vflow_destroy:用于创建、管理、绑定、启动、停止 和 销毁 数据流( vflow),实现 数据 在 不同 节点 之间 的 传输 和 处理 流程 的 控制。 hbn_isp_get_awb_attr、hbn_isp_set_awb_attr、hbn_isp_get_exposure_attr、hbn_isp_set_exposure_attr:用于获取 和 设置 ISP 的 自动 白平衡( AWB)和 曝光( AE)属性,实现 图像 质量 的 调节 和 控制。
代码位置及目录结构
isp_feedback 相关/app/samples/platform_samples/sample_isp,代码
└── isp_feedback
├── Makefile
└── isp_feedback.c
Makefile:用于
编译程序 的 Makefile 文件。 isp_feedback.c:程序
的 主要 源代码 文件。
工具位置及目录结构
工具/app/platform_samples/sample_isp/isp_feedback 目录
root@buildroot:/app/platform_samples/sample_isp/isp_feedback# ls
isp_feedback
API 流程说明

说明:
解析
命令行 :使用参数 getopt_long()函数解析 命令行 输入。 获取
传感器 :通过配置 vp_sensor_config_list[index]获取指定 索引 的 传感器 配置。 创建
并 :使用运行 VIN-ISP 流 create_and_run_isp_vflow(&isp_contex)创建并 运行 数据流。 设置
虚拟 :通过传感器 参数 fixed_dummy_sensor_config(&vin_isp_contex, &dummy_sensor_config)设置虚拟 传感器 的 相关 参数。 停止 VIN 流:调用
hbn_vnode_releaseframe()释放帧 数据。 关闭 VIN 和 ISP 节点:使用
hbn_vnode_close()关闭节点。 销毁Camera Sensor:调用
vp_sensor_destroy()释放 Camera Sensor 资源。打印
帮助 :如果信息 传感器 索引 无效,调用 print_help()打印帮助 信息。
3.3.3.2. 编译部署
编译
进入 sample_isp/isp_feedback 目录,执行
make编译。输出
产物 是 sample_isp 源码 目录 下 的 isp_feedback。详细
程序 编译 方式 请 查阅 编译 方法 章节。 在源码 路径 下 执行 make命令即可 完成 编译:
硬件环境搭建
开发板Camera Sensor 的
程序部署
编译app/samples/platform_samples/sample_isp/isp_feedback 目录
├── Makefile
├── isp_feedback
├── isp_feedback.c
刷写/app/platform_samples/sample_isp/isp_feedback。
3.3.3.3. 运行
程序运行方法
直接
执行程序 ./isp_feedback -h可以获得 帮助 信息:
程序参数选项说明
root@buildroot:/app/platform_samples/sample_isp/isp_feedback# ./isp_feedback -h
Usage: isp_feedback [OPTIONS]
Options:
-s <sensor_index> Specify sensor index
-f <file> Specify Raw filename
-h Show this help message
index: 0 sensor_name: sc1330t config_file:linear_1280x960_raw10_30fps_1lane.c
index: 1 sensor_name: irs2875-tof config_file:linear_208x1413_raw12_15fps_2lane.c
index: 2 sensor_name: sc230ai-10fps config_file:linear_1920x1080_raw10_10fps_1lane.c
index: 3 sensor_name: sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 4 sensor_name: sc230ai-dol2-30fps config_file:dol2_1920x1080_raw10_30fps_2lane.c
index: 5 sensor_name: sc132gs-1280p config_file:linear_1088x1280_raw10_60fps_1lane.c
index: 6 sensor_name: sc132gs-hdr-2lane config_file:hdr_1088x1280_raw10_30fps_2lane.c
index: 7 sensor_name: sc035hgs config_file:linear_640x480_raw10_30fps_1lane.c
index: 8 sensor_name: sc035hgs_mono config_file:linear_mono_640x480_raw10_30fps_1lane.c
index: 9 sensor_name: ov5640 config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 10 sensor_name: f37 config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 11 sensor_name: imx415-30fps-2lane config_file:linear_3840x2160_raw10_30fps_2lane.c
index: 12 sensor_name: imx415-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 13 sensor_name: sc202cs-1600x1200 config_file:linear_1600x1200_raw10_30fps_1lane.c
index: 14 sensor_name: irs2381c-tof config_file:linear_224x1903_raw12_5fps_2lane.c
index: 15 sensor_name: sc035hgs-vc0 config_file:linear_640x480_raw10_30fps_2lane_vc0.c
index: 16 sensor_name: sc035hgs-vc1 config_file:linear_640x480_raw10_30fps_2lane_vc1.c
index: 17 sensor_name: sc231ai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 18 sensor_name: imx586-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 19 sensor_name: os08c10-30fps-2lane config_file:linear_3840x2160_raw12_30fps_2lane.c
index: 20 sensor_name: ar0233-30fps config_file:linear_1920x1080_raw12_30fps_2lane.c
index: 21 sensor_name: ar0820std-30fps config_file:linear_3840x2160_yuv422_30fps_4lane.c
index: 22 sensor_name: sc1336 config_file:linear_1280x720_raw10_15fps_2lane.c
index: 23 sensor_name: dummy config_file:dummy_sensor.c
index: 24 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c
index: 25 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c
index: 26 sensor_name: ov9782-200fps-2lane config_file:linear_640x360_raw10_200fps_2lane.c
index: 27 sensor_name: ov9782-120fps-2lane config_file:linear_1280x720_raw10_120fps_2lane.c
index: 28 sensor_name: imx219-640x480-30fps config_file:linear_640x480_raw10_30fps_2lane.c
index: 29 sensor_name: imx219-1632x1232-30fps config_file:linear_1632x1232_raw10_30fps_2lane.c
index: 30 sensor_name: imx219-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 31 sensor_name: imx219-3264x2464-15fps config_file:linear_3264x2464_raw10_15fps_2lane.c
index: 32 sensor_name: imx219-3264x2464-21fps config_file:linear_3264x2464_raw10_21fps_2lane.c
index: 33 sensor_name: ov5647-640x480-60fps config_file:linear_640x480_raw10_60fps_2lane.c
index: 34 sensor_name: ov5647-1280x960-30fps config_file:linear_1280x960_raw10_30fps_2lane.c
index: 35 sensor_name: ov5647-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 36 sensor_name: ov5647-2592x1944-15fps config_file:linear_2592x1944_raw10_15fps_2lane.c
index: 37 sensor_name: imx678-30fps-4lane config_file:linear_3840x2160_raw12_30fps_4lane.c
index: 38 sensor_name: imx678-30fps-4lane-dol2 config_file:dol2_3840x2160_raw12_30fps_4lane.c
index: 39 sensor_name: imx477-1280x960-120fps config_file:linear_1280x960_raw10_120fps_2lane.c
index: 40 sensor_name: imx477-1920x1080-50fps config_file:linear_1920x1080_raw12_50fps_2lane.c
index: 41 sensor_name: imx477-2016x1520-21fps config_file:linear_2016x1520_raw12_21fps_2lane.c
index: 42 sensor_name: imx477-4000x3000-10fps config_file:linear_4000x3000_raw12_10fps_2lane.c
index: 43 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw10_30fps_4lane.c
index: 44 sensor_name: ox05b1s config_file:linear_2592x1944_raw10_30fps_4lane.c
index: 45 sensor_name: ox05b1s_2lane config_file:linear_2592x1944_raw10_10fps_2lane.c
index: 46 sensor_name: imx415-60fps-4lane config_file:linear_3840x2160_raw10_60fps_4lane.c
index: 47 sensor_name: sc850sl-30fps config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 48 sensor_name: shw3g-30fps config_file:linear_2064x1552_raw12_30fps_4lane.c
index: 49 sensor_name: shw3g-30fps_vc1 config_file:linear_2064x1552_raw12_30fps_4lane_vc1.c
index: 50 sensor_name: sc235hai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 51 sensor_name: cv4006-60fps-2lane config_file:linear_1280x720_raw10_60fps_2lane.c
index: 52 sensor_name: ov50h40-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 53 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw14_30fps_4lane.c
index: 54 sensor_name: sc132gs-slave-right config_file:linear_1088x1280_raw10_30fps_slave_1lane_right.c
index: 55 sensor_name: sc132gs-slave-left config_file:linear_1088x1280_raw10_30fps_slave_1lane_left.c
index: 56 sensor_name: sc132gsstd_vc0 config_file:linear_1088x1280_raw10_10fps_1lane_vc0.c
index: 57 sensor_name: sc132gsstd_vc1 config_file:linear_1088x1280_raw10_10fps_1lane_vc1.c
index: 58 sensor_name: sc132gsstd_vc2 config_file:linear_1088x1280_raw10_10fps_1lane_vc2.c
index: 59 sensor_name: sc132gsstd_vc3 config_file:linear_1088x1280_raw10_10fps_1lane_vc3.c
index: 60 sensor_name: imx415-30fps-4lane-dol2 config_file:dol2_3840x2160_raw10_30fps_4lane.c
index: 61 sensor_name: isx031-30fps-vc0 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc0.c
index: 62 sensor_name: isx031-30fps-vc1 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc1.c
index: 63 sensor_name: isx031-30fps-vc2 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc2.c
index: 64 sensor_name: isx031-30fps-vc3 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc3.c
命令
s <sensor_index>: 该
选项 用于 指定 要 使用 的 Camera Sensor 对应 的 效果 库,使用 时 不 需要 接入 实际 的Camera。 f
: 该 选项 用于 指定 要 使用 Raw 图 的 文件名。 h: 显示
帮助 信息。
当前
| Index | Sensor Name | Configuration File |
|---|---|---|
| 0 | sc1330t | linear_1280x960_raw10_30fps_1lane.c |
| 1 | irs2875-tof | linear_208x1413_raw12_15fps_2lane.c |
| 2 | sc230ai-10fps | linear_1920x1080_raw10_10fps_1lane.c |
| 3 | sc230ai-30fps | linear_1920x1080_raw10_30fps_1lane.c |
| 4 | sc230ai-dol2-30fps | dol2_1920x1080_raw10_30fps_2lane.c |
| 5 | sc132gs-1280p | linear_1088x1280_raw10_30fps_1lane.c |
| 6 | sc132gs-hdr-2lane | hdr_1088x1280_raw10_30fps_2lane.c |
| 7 | sc035hgs | linear_640x480_raw10_30fps_1lane.c |
| 8 | sc035hgs_mono | linear_mono_640x480_raw10_30fps_1lane.c |
| 9 | ov5640 | linear_1920x1080_raw10_30fps_2lane.c |
| 10 | f37 | linear_1920x1080_raw10_30fps_1lane.c |
| 11 | imx415-30fps-2lane | linear_3840x2160_raw10_30fps_2lane.c |
| 12 | imx415-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 13 | sc202cs-1600x1200 | linear_1600x1200_raw10_30fps_1lane.c |
| 14 | irs2381c-tof | linear_224x1903_raw12_5fps_2lane.c |
| 15 | sc035hgs-vc0 | linear_640x480_raw10_30fps_2lane_vc0.c |
| 16 | sc035hgs-vc1 | linear_640x480_raw10_30fps_2lane_vc1.c |
| 17 | sc231ai-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 18 | imx586-30fps-4lane | linear_3840x2160_raw10_30fps_4lane.c |
| 19 | os08c10-30fps-2lane | linear_3840x2160_raw12_30fps_2lane.c |
| 20 | ar0233-30fps | linear_1920x1080_raw12_30fps_2lane.c |
| 21 | ar0820std-30fps | linear_3840x2160_yuv422_30fps_4lane.c |
| 22 | sc1336 | linear_1280x720_raw10_15fps_2lane.c |
| 23 | dummy | dummy_sensor.c |
| 24 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c |
| 25 | ar0233-30fps | ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c |
| 26 | ov9782-200fps-2lane | linear_640x360_raw10_200fps_2lane.c |
| 27 | ov9782-120fps-2lane | linear_1280x720_raw10_120fps_2lane.c |
| 28 | imx219-640x480-30fps | linear_640x480_raw10_30fps_2lane.c |
| 29 | imx219-1632x1232-30fps | linear_1632x1232_raw10_30fps_2lane.c |
| 30 | imx219-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 31 | imx219-3264x2464-15fps | linear_3264x2464_raw10_15fps_2lane.c |
| 32 | imx219-3264x2464-21fps | linear_3264x2464_raw10_21fps_2lane.c |
| 33 | ov5647-640x480-60fps | linear_640x480_raw10_60fps_2lane.c |
| 34 | ov5647-1280x960-30fps | linear_1280x960_raw10_30fps_2lane.c |
| 35 | ov5647-1920x1080-30fps | linear_1920x1080_raw10_30fps_2lane.c |
| 36 | ov5647-2592x1944-15fps | linear_2592x1944_raw10_15fps_2lane.c |
| 37 | imx477-1280x960-120fps | linear_1280x960_raw10_120fps_2lane.c |
| 38 | imx477-1920x1080-50fps | linear_1920x1080_raw12_50fps_2lane.c |
| 39 | imx477-2016x1520-40fps | linear_2016x1520_raw12_40fps_2lane.c |
| 40 | imx477-4000x3000-10fps | linear_4000x3000_raw12_10fps_2lane.c |
| 41 | ov50h40-30fps-4lane | linear_4096x3072_raw10_30fps_4lane.c |
| 42 | ox05b1s | linear_2592x1944_raw10_30fps_4lane.c |
| 43 | ox05b1s_2lane | linear_2592x1944_raw10_10fps_2lane.c |
| 44 | imx415-60fps-4lane | linear_3840x2160_raw10_60fps_4lane.c |
| 45 | sc850sl-30fps | linear_3840x2160_raw10_30fps_4lane.c |
| 46 | shw3g-30fps | linear_2064x1552_raw12_30fps_4lane.c |
配置文件说明
当前app/samples/platform_samples/vp_sensors 目录
相关
运行效果
先
使用 get_vin_data -s 3获取一张 sc230ai 的 raw 图, get_vin_data的使用 详细 参考 sample_vin。 接下来
我们 可以 根据 提示 选择 对应 的 Camera Sensor 和 准备 好 的 RAW 图,ISP 回灌 时会 使用 对应 的 Camera Sensor 的 ISP 效果 库 进行 调校。
选择
./isp_feedback -s 3 -f handle_34661_vin_chn0_1920x1080_stride_3840_frameid_0_ts_18369924580342.raw
root@buildroot:/userdata# ./isp_feedback -s 3 -f handle_34661_vin_chn0_1920x1080_stride_3840_frameid_0_ts_18369924580342.raw
Using index:3 sensor_name:sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
dummy use calib sc230ai_tuning.json
[INFO] Create isp node handle: 100197
(dump_awb_attr)handle 100197 awb: version 1 mode 0manual_attr: gain: rgain: 0.000000grgain: 0.004043gbgain: 0.000000bgain: 0.004043
(dump_exp_attr)handle 100197 exp: version 0 mode 0manual_attr: gain: exp_time: 0.007022again: 1.000000dgain: 1.000000ispgain: 1.000000ae_exp: 79.692368cur_lux 0
isp(100197) dump yuv 1920x1080(stride:1920), buffer size: 2073600 + 1036800 frame id: 0, timestamp: 0
程序运行
isp_handle_100197_chn0_1920x1080_stride_1920_frameid_0_ts_0.yuv
3.3.3.4. 常见问题
当
isp_feedback指定的 RAW 图 分辨率 和 格式 与 指定 的 Camera Sensor 的 分辨率 及 格式 完全一致 时,可以 正常 进行 回灌。 如果
指定 的 Camera Sensor 分辨率 或 格式 与 回灌 图像 不 匹配,可能 会 导致 图像 异常。 如果
回灌 发现 对应 颜色 不 对 时,需要 根据 -s 指定 的 snesor 的 实际 的 bayer_start 和 bayer_pattern 去 修改 dummy_sensor 的 sensor_param 属性。 实际
的 bayer_start 和 bayer_pattern 可以 查看 对应 sensor 的 spec。
3.3.4. get_isp_rgb_ir
3.3.4.1. 功能概述
get_isp_rgb_ir 是get_isp_data 的
RGB/IR 分离:通过 ISP 实现
传感器 原始数据 的 物理 分离(移除 IR 污染 + 插值 重建)。 双通道
输出 :isp_schn 0→ RGB 图像( YUV 格式,只有 UV 分量,可见光分量) isp_schn 2→ IR 图像( YUV 格式,只有 Y 分量,红外分量)。
软件架构说明
get_isp_rgb_ir 的get_isp_data 软件架构

上get_isp_data 的
ISP 节点
配置 扩展 在
create_isp_node中新增 双通道 输出 :配置 Channel 0:输出 RGB 可见光
分量。 Channel 2:输出 IR 红外
分量。
数据
捕获 与 保存 逻辑 修改 dump_data中分 两个 步骤: RGB 通道:调用
hbn_vnode_getframe(0)获取 RGB 帧数据。 IR 通道:调用
hbn_vnode_getframe(2)获取 IR 帧数据。
代码位置及目录结构
get_isp_rgb_ir 相关app/samples/platform_samples/sample_isp/get_isp_rgb_ir,代码
.
├── Makefile
└── get_isp_rgb_ir.c
Makefile:用于
编译程序 的 Makefile 文件。 get_isp_rgb_ir.c:程序
的 主要 源代码 文件。
工具位置及目录结构
工具/app/platform_samples/sample_isp/get_isp_rgb_ir 目录
root@buildroot:/app/platform_samples/sample_isp/get_isp_rgb_ir# ls
get_isp_rgb_ir
get_isp_rgb_ir 即
API 流程说明
get_isp_rgb_ir 的

上get_isp_data 的
选项
调整 :新增
-v详细日志 标志模式 移除
原图 的 -t(settle值) 和-m(传感器模式) 选项
ISP 通道
修改 :新增 双通道
配置 :create_isp_node中创建 RGB和IR两个 ISP 通道和 缓存 区。
数据
采集 :流程 变更 dump_data()执行 双通道顺序 :采集 hbn_vnode_getframe(isp_node, 0, ...); // RGB hbn_vnode_getframe(isp_node, 2, ...); // IR
3.3.4.2. 编译部署
编译
在make 命令
cd app/samples/platform_samples/sample_isp/get_isp_rgb_ir
make
详细
硬件环境搭建
开发板Camera Sensor 的
程序部署
编译app/samples/platform_samples/sample_isp/get_isp_rgb_ir 目录
├── Makefile
├── get_isp_rgb_ir
├── get_isp_rgb_ir.c
└── get_isp_rgb_ir.o
本 sample 的/app/platform_samples/sample_isp/get_isp_rgb_ir 目录,每次get_isp_rgb_ir 上/userdata 目录chmod +x get_isp_rgb_ir 命令
3.3.4.3. 运行
程序运行方法
板端/app/platform_samples/sample_isp/get_isp_rgb_ir 目录,然后
./get_isp_rgb_ir <Option> <Sensor_index>
示例:
root@buildroot:~# cd /app/platform_samples/sample_isp/get_isp_rgb_ir/
root@buildroot:/app/platform_samples/sample_isp/get_isp_rgb_ir# ./get_isp_rgb_ir -s 45
注意: get_isp_rgb_ir 仅
程序参数选项说明
执行命令 ./get_isp_rgb_ir -h 可以
root@buildroot:/app/platform_samples/sample_isp/get_isp_rgb_ir# ./get_isp_rgb_ir -h
get_isp_rgb_ir -s/--sensor sensor_index
Options:
-s <sensor_index> Specify sensor index
-c <channel_type> Specify channel type: vo and vf
1. vo: vin online isp
2. vf: vin offline isp
3. default is vf
-v, --verbose Enable detailed log information
Note: Default Offline Mode
index: 0 sensor_name: sc1330t config_file:linear_1280x960_raw10_30fps_1lane.c
index: 1 sensor_name: irs2875-tof config_file:linear_208x1413_raw12_15fps_2lane.c
index: 2 sensor_name: sc230ai-10fps config_file:linear_1920x1080_raw10_10fps_1lane.c
index: 3 sensor_name: sc230ai-30fps config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 4 sensor_name: sc230ai-dol2-30fps config_file:dol2_1920x1080_raw10_30fps_2lane.c
index: 5 sensor_name: sc132gs-1280p config_file:linear_1088x1280_raw10_60fps_1lane.c
index: 6 sensor_name: sc132gs-hdr-2lane config_file:hdr_1088x1280_raw10_30fps_2lane.c
index: 7 sensor_name: sc035hgs config_file:linear_640x480_raw10_30fps_1lane.c
index: 8 sensor_name: sc035hgs_mono config_file:linear_mono_640x480_raw10_30fps_1lane.c
index: 9 sensor_name: ov5640 config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 10 sensor_name: f37 config_file:linear_1920x1080_raw10_30fps_1lane.c
index: 11 sensor_name: imx415-30fps-2lane config_file:linear_3840x2160_raw10_30fps_2lane.c
index: 12 sensor_name: imx415-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 13 sensor_name: sc202cs-1600x1200 config_file:linear_1600x1200_raw10_30fps_1lane.c
index: 14 sensor_name: irs2381c-tof config_file:linear_224x1903_raw12_5fps_2lane.c
index: 15 sensor_name: sc035hgs-vc0 config_file:linear_640x480_raw10_30fps_2lane_vc0.c
index: 16 sensor_name: sc035hgs-vc1 config_file:linear_640x480_raw10_30fps_2lane_vc1.c
index: 17 sensor_name: sc231ai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 18 sensor_name: imx586-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 19 sensor_name: os08c10-30fps-2lane config_file:linear_3840x2160_raw12_30fps_2lane.c
index: 20 sensor_name: ar0233-30fps config_file:linear_1920x1080_raw12_30fps_2lane.c
index: 21 sensor_name: ar0820std-30fps config_file:linear_3840x2160_yuv422_30fps_4lane.c
index: 22 sensor_name: sc1336 config_file:linear_1280x720_raw10_15fps_2lane.c
index: 23 sensor_name: dummy config_file:dummy_sensor.c
index: 24 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc0.c
index: 25 sensor_name: ar0233-30fps config_file:ar0233_linear_1920x1080_raw12_30fps_2lane_vc1.c
index: 26 sensor_name: ov9782-200fps-2lane config_file:linear_640x360_raw10_200fps_2lane.c
index: 27 sensor_name: ov9782-120fps-2lane config_file:linear_1280x720_raw10_120fps_2lane.c
index: 28 sensor_name: imx219-640x480-30fps config_file:linear_640x480_raw10_30fps_2lane.c
index: 29 sensor_name: imx219-1632x1232-30fps config_file:linear_1632x1232_raw10_30fps_2lane.c
index: 30 sensor_name: imx219-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 31 sensor_name: imx219-3264x2464-15fps config_file:linear_3264x2464_raw10_15fps_2lane.c
index: 32 sensor_name: imx219-3264x2464-21fps config_file:linear_3264x2464_raw10_21fps_2lane.c
index: 33 sensor_name: ov5647-640x480-60fps config_file:linear_640x480_raw10_60fps_2lane.c
index: 34 sensor_name: ov5647-1280x960-30fps config_file:linear_1280x960_raw10_30fps_2lane.c
index: 35 sensor_name: ov5647-1920x1080-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 36 sensor_name: ov5647-2592x1944-15fps config_file:linear_2592x1944_raw10_15fps_2lane.c
index: 37 sensor_name: imx678-30fps-4lane config_file:linear_3840x2160_raw12_30fps_4lane.c
index: 38 sensor_name: imx678-30fps-4lane-dol2 config_file:dol2_3840x2160_raw12_30fps_4lane.c
index: 39 sensor_name: imx477-1280x960-120fps config_file:linear_1280x960_raw10_120fps_2lane.c
index: 40 sensor_name: imx477-1920x1080-50fps config_file:linear_1920x1080_raw12_50fps_2lane.c
index: 41 sensor_name: imx477-2016x1520-21fps config_file:linear_2016x1520_raw12_21fps_2lane.c
index: 42 sensor_name: imx477-4000x3000-10fps config_file:linear_4000x3000_raw12_10fps_2lane.c
index: 43 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw10_30fps_4lane.c
index: 44 sensor_name: ox05b1s config_file:linear_2592x1944_raw10_30fps_4lane.c
index: 45 sensor_name: ox05b1s_2lane config_file:linear_2592x1944_raw10_10fps_2lane.c
index: 46 sensor_name: imx415-60fps-4lane config_file:linear_3840x2160_raw10_60fps_4lane.c
index: 47 sensor_name: sc850sl-30fps config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 48 sensor_name: shw3g-30fps config_file:linear_2064x1552_raw12_30fps_4lane.c
index: 49 sensor_name: shw3g-30fps_vc1 config_file:linear_2064x1552_raw12_30fps_4lane_vc1.c
index: 50 sensor_name: sc235hai-30fps config_file:linear_1920x1080_raw10_30fps_2lane.c
index: 51 sensor_name: cv4006-60fps-2lane config_file:linear_1280x720_raw10_60fps_2lane.c
index: 52 sensor_name: ov50h40-30fps-4lane config_file:linear_3840x2160_raw10_30fps_4lane.c
index: 53 sensor_name: ov50h40-30fps-4lane config_file:linear_4096x3072_raw14_30fps_4lane.c
index: 54 sensor_name: sc132gs-slave-right config_file:linear_1088x1280_raw10_30fps_slave_1lane_right.c
index: 55 sensor_name: sc132gs-slave-left config_file:linear_1088x1280_raw10_30fps_slave_1lane_left.c
index: 56 sensor_name: sc132gsstd_vc0 config_file:linear_1088x1280_raw10_10fps_1lane_vc0.c
index: 57 sensor_name: sc132gsstd_vc1 config_file:linear_1088x1280_raw10_10fps_1lane_vc1.c
index: 58 sensor_name: sc132gsstd_vc2 config_file:linear_1088x1280_raw10_10fps_1lane_vc2.c
index: 59 sensor_name: sc132gsstd_vc3 config_file:linear_1088x1280_raw10_10fps_1lane_vc3.c
index: 60 sensor_name: imx415-30fps-4lane-dol2 config_file:dol2_3840x2160_raw10_30fps_4lane.c
index: 61 sensor_name: isx031-30fps-vc0 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc0.c
index: 62 sensor_name: isx031-30fps-vc1 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc1.c
index: 63 sensor_name: isx031-30fps-vc2 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc2.c
index: 64 sensor_name: isx031-30fps-vc3 config_file:isx031_linear_1920x1536_yuv422_30fps_4lane_vc3.c
注意:上面index: 44 sensor_name: ox05b1s 是 ox05b1s 的 4lane 配置,需要
参数
s <sensor_index>: 该
选项 用于 指定 要 使用 的 传感器 索引。用户 需要 提供 一个 有效 的 索引 值。 c <channel_type>: 该
选项 用于 指定 使用 的 通道 类型,vo 代表 VIN online ISP ,vf 代表 VIN offline ISP ,不 加 该 参数,默认 使用 VIN offline ISP。 h: 显示
帮助 信息。
配置文件说明
当前app/samples/platform_samples/vp_sensors 目录
相关
注意: 当前 get_isp_rgb_ir 默认offline mode,所以 sensor config 中offline mode,主要cim_isp_flyby 和 input_mode 属性,具体
static vin_node_attr_t vin_node_attr = {
.cim_attr = {
.mipi_rx = 0, // vcon 0
.vc_index = 0,
.ipi_channel = 1,
.cim_isp_flyby = 0, // 0: offline ; 1: online
......
}
static isp_attr_t isp_attr = {
.input_mode = 2, // 0: online, 2: offline
......
}
运行效果
get_isp_rgb_ir 的get_isp_data 相似,具体get_isp_rgb_ir 时,会
root@buildroot:/app/platform_samples/sample_isp/get_isp_rgb_ir# ./get_isp_rgb_ir -s 45
Using index:45 sensor_name:ox05b1s_2lane config_file:linear_2592x1944_raw10_30fps_2lane.c
mipi mclk is configed.
Searching camera sensor on device: /proc/device-tree/soc/cam/vcon@0 i2c bus: 4 mipi rx phy: 0
INFO: Found sensor_name:ox05b1s_2lane on mipi rx csi 0, i2c addr 0x36, config_file:linear_2592x1944_raw10_30fps_2lane.c
*************** Command Lists ***************
g -- get single frame
l -- get a set frames
q -- quit
h -- print help message
Command: g
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_0_ts_1026275109155.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_0_ts_1026275109155.yuv
Command: l
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_1_ts_1026408535614.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_1_ts_1026408535614.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_2_ts_1026508510822.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_2_ts_1026508510822.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_3_ts_1026608501822.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_3_ts_1026608501822.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_4_ts_1026708507781.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_4_ts_1026708507781.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_7_ts_1027008512614.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_7_ts_1027008512614.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_29_ts_1029208508573.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_30_ts_1029308514907.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_30_ts_1029308514907.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_31_ts_1029408504532.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_31_ts_1029408504532.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_32_ts_1029508510074.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_32_ts_1029508510074.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_33_ts_1029608516740.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_33_ts_1029608516740.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_34_ts_1029708507240.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_34_ts_1029708507240.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_35_ts_1029808515365.yuv
Dumping rgb frame to file: handle_100197_ox05b1s_2lane_rgb_frameid_35_ts_1029808515365.yuv
Dumping ir frame to file: handle_100197_ox05b1s_2lane_ir_frameid_36_ts_1029908519865.yuv
Command: q
quit
可以get_isp_rgb_ir 后,将
常见问题
sensor config 没有
配置 为 offline 模式,导致 执行 失败。 测试
用 的 sensor 硬件 不 支持 RGBIR pattern,导致 执行 失败。