feat(cam): support format conversion function

This commit is contained in:
gaoxu
2025-08-26 17:16:56 +08:00
committed by BOT
parent f7ddaefdc5
commit de3e6d22e3
14 changed files with 256 additions and 3 deletions
@@ -114,6 +114,16 @@
在调用 :cpp:func:`esp_cam_new_dvp_ctlr` 之后,需要分配符合对齐约束的摄像头缓冲区,或调用 :cpp:func:`esp_cam_ctlr_alloc_buffer` 来自动分配。
可以调用 :cpp:func:`esp_cam_ctlr_format_conversion` 来配置格式转换。驱动程序支持以下转换类型:
* YUV 到 RGB 转换
* RGB 到 YUV 转换
* YUV 到 YUV 转换
色彩空间范围支持:
* 全色彩空间:RGB 和 YUV 的取值范围为 0-255
* 有限色彩空间:RGB 取值范围为 16-240YUV Y 分量取值范围为 16-240U-V 分量取值范围为 16-235
.. code:: c
esp_cam_ctlr_handle_t cam_handle = NULL;
@@ -148,6 +158,16 @@
ESP_ERROR_CHECK(esp_cam_new_dvp_ctlr(&dvp_config, &cam_handle));
const cam_ctlr_format_conv_config_t conv_cfg = {
.src_format = CAM_CTLR_COLOR_YUV422, // 源格式:YUV422
.dst_format = CAM_CTLR_COLOR_RGB565, // 目标格式:RGB565
.conv_std = COLOR_CONV_STD_RGB_YUV_BT601,
.data_width = 8,
.input_range = COLOR_RANGE_LIMIT,
.output_range = COLOR_RANGE_LIMIT,
};
ESP_ERROR_CHECK(esp_cam_ctlr_format_conversion(cam_handle, &conv_cfg));
卸载摄像头控制器驱动程序
~~~~~~~~~~~~~~~~~~~~~~~~