mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
feat(isp_awb): support isp auto white balance
This commit is contained in:

committed by
Kevin (Lao Kaiyao)

parent
4b08ddb0f3
commit
8c225c0200
@@ -56,3 +56,51 @@ TEST_CASE("ISP AF controller exhausted allocation", "[isp]")
|
||||
}
|
||||
TEST_ESP_OK(esp_isp_del_processor(isp_proc));
|
||||
}
|
||||
|
||||
TEST_CASE("ISP AWB driver basic function", "[isp]")
|
||||
{
|
||||
esp_isp_processor_cfg_t isp_config = {
|
||||
.clk_hz = 80 * 1000 * 1000,
|
||||
.input_data_source = ISP_INPUT_DATA_SOURCE_CSI,
|
||||
.input_data_color_type = ISP_COLOR_RAW8,
|
||||
.output_data_color_type = ISP_COLOR_RGB565,
|
||||
};
|
||||
isp_proc_handle_t isp_proc = NULL;
|
||||
TEST_ESP_OK(esp_isp_new_processor(&isp_config, &isp_proc));
|
||||
TEST_ESP_OK(esp_isp_enable(isp_proc));
|
||||
|
||||
isp_awb_ctlr_t awb_ctlr = NULL;
|
||||
uint32_t image_width = 800;
|
||||
uint32_t image_height = 600;
|
||||
/* Default parameters from helper macro */
|
||||
esp_isp_awb_config_t awb_config = {
|
||||
.sample_point = ISP_AWB_SAMPLE_POINT_AFTER_CCM,
|
||||
.window = {
|
||||
.top_left = {.x = image_width * 0.2, .y = image_height * 0.2},
|
||||
.btm_right = {.x = image_width * 0.8, .y = image_height * 0.8},
|
||||
},
|
||||
.white_patch = {
|
||||
.luminance = {.min = 0, .max = 220 * 3},
|
||||
.red_green_ratio = {.min = 0.0f, .max = 3.999f},
|
||||
.blue_green_ratio = {.min = 0.0f, .max = 3.999f},
|
||||
},
|
||||
};
|
||||
isp_awb_stat_result_t stat_res = {};
|
||||
/* Create the awb controller */
|
||||
TEST_ESP_OK(esp_isp_new_awb_controller(isp_proc, &awb_config, &awb_ctlr));
|
||||
/* Enabled the awb controller */
|
||||
TEST_ESP_OK(esp_isp_awb_controller_enable(awb_ctlr));
|
||||
/* Start continuous AWB statistics */
|
||||
TEST_ESP_OK(esp_isp_awb_controller_start_continuous_statistics(awb_ctlr));
|
||||
TEST_ESP_ERR(ESP_ERR_INVALID_STATE, esp_isp_awb_controller_get_oneshot_statistics(awb_ctlr, 0, &stat_res));
|
||||
/* Stop continuous AWB statistics */
|
||||
TEST_ESP_OK(esp_isp_awb_controller_stop_continuous_statistics(awb_ctlr));
|
||||
TEST_ESP_ERR(ESP_ERR_TIMEOUT, esp_isp_awb_controller_get_oneshot_statistics(awb_ctlr, 1, &stat_res));
|
||||
/* Disable the awb controller */
|
||||
TEST_ESP_OK(esp_isp_awb_controller_disable(awb_ctlr));
|
||||
/* Delete the awb controller and free the resources */
|
||||
TEST_ESP_OK(esp_isp_del_awb_controller(awb_ctlr));
|
||||
|
||||
TEST_ESP_OK(esp_isp_disable(isp_proc));
|
||||
TEST_ESP_OK(esp_isp_del_processor(isp_proc));
|
||||
}
|
||||
|
Reference in New Issue
Block a user