Last Updated on : 2024-06-25 03:46:15download
Image tuning is the process of adjusting various image parameters to achieve the intended image effect.
Subjective tuning: Adjust image parameters to achieve the desired result. This can include increasing saturation for more intense colors, increasing sharpness for clearer images, or increasing brightness for an overall brighter appearance.
Objective tuning: Fix IQ issues in specific scenes, for example, flicker, color shift, and noises.
In the root directory of tuyaos-ipc-$CHIPNAME
, run the command make app_menuconfig
to customize the image style. After saving your modifications, run make app_config
to compile the modifications and generate a configuration file.
This method enables you to tune the following parameters:
This method works with Anyka’s AK39EV330L and Fullhan’s FH8636/FH8652 currently, with more compatible platforms on the way. For more information, consult your account manager.
This method enables you to tune the following parameters:
This method works with all chips, but the tuning process may differ depending on the platform. See the tuning guide specific to your platform.
Acronyms
How image parameters work and how to implement them:
How it works: When the IPC is running, isp.bin
is the most important image file. isp.bin
is reloaded when the IPC is powered on or switches between day and night mode to apply the appropriate image effects.
The format of the isp.bin
file varies by chip platform. For example, isp.conf
for Anyka, isp.hex
for Fullhan, and tag.bin
for Ingenic.
Implementation: Modify isp.bin
to achieve the desired result.
Tuya’s open APIs unify the tuning functions of different chip platforms.
To tune with Tuya’s APIs, modify and compile the configuration file and then check the tuning results.
Tune the underlying ISP parameters. Changes are applied to the IPC immediately. This method is used to fine-tune the image quality but requires coding knowledge.
software/TuyaOS/apps/tuyaos-ipc-ak3918ev330-xxxxx/resource/isp
with the new one isp.conf
, while retaining the original name of the .conf
file.software/TuyaOS/vendor/anyka3918ev300s/tuyaos/components/linux-anyka3918ev300s/drivers/modules
.The image component is the entry point for image configuration, which is named in the format tkl_media_CHIPNAME
and usually located at /vendor/CHIPNAME/tuyaos/tuyaos_adapter/src/tkl_media_CHIPNAME
.
Image component includes APIs for common ISP features, including ISP parameter initialization, converting color images to black and white, flipping, anti-flicker, calculating illuminance for day/night mode switching, and image customization.
When the IPC is running, the image component takes care of two things.
isp_init
and loads image parameters.You can simply call the API as needed, without modifying the image component.
/***********************************************************
* Function: tkl_vi_isp_init
* Description: ISP initialization
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN TKL_ISP_PARAM_INFO_T *pisp_info The struct of configurable ISP parameters, including ADN, WDR, AWB, and denoise.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_init(TKL_VI_CHN_E chn, TKL_ISP_PARAM_INFO_T *pisp_info)
/***********************************************************
* Function: tkl_vi_isp_load_isp_file
* Description: Load the image parameters, typically a .bin or .ini file.
* Parameter: IN TKL_ISP_DN_MODE_E irmode, The current day/night mode. 0: Auto mode. 1: Day mode. 2: Night mode. Specifying it to auto will force the day mode. Auto is not supported.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_load_isp_file(TKL_ISP_DN_MODE_E irmode)
/***********************************************************
* Function: tkl_vi_isp_load_user_isp_param
* Description: Load user-defined image settings, such as style, white balance, WDR, and noise reduction.
The image configurations configured by this function are all static, without real-time calculation.
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN TKL_ISP_PARAM_INFO_T *pisp_info, The index structure of all the required configurable ISP parameters during initialization.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_load_user_isp_param(TKL_VI_CHN_E chn, INT32_T irmode)
tkl_vi_isp_load_isp_file
calls tkl_vi_isp_load_user_isp_param
automatically, without additional API request./***********************************************************
* Function: tkl_vi_isp_get_mirror_flip
* Description: Get the current flipping status.
* Parameter: IN TKL_VI_CHN_E chn The channel ID of the camera.
OUT TKL_VI_MIRROR_FLIP_E *direction, 0: Default status. 1: Mirror. 2: Flip. 3: Mirror and flip.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_get_mirror_flip(TKL_VI_CHN_E chn, TKL_VI_MIRROR_FLIP_E *direction)
/***********************************************************
* Function: tkl_vi_isp_set_mirror_flip
* Description: Set image flipping.
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN TKL_VI_MIRROR_FLIP_E direction, 0: Default status. 1: Mirror. 2: Flip. 3: Mirror and flip.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_set_mirror_flip(TKL_VI_CHN_E chn, TKL_VI_MIRROR_FLIP_E direction)
/***********************************************************
* Function: tkl_vi_isp_get_antiflicker
* Description: Get the current anti-flicker status.
* Parameter: IN TKL_VI_CHN_E chn The device ID
OUT TKL_ISP_FLICKER_TYPE_E *eAntiFlicker, 0: Disabled. 1: 50 Hz. 2: 60 Hz. 3: Auto.
*
* Return value: <0: Failure. =0/1/2: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_get_antiflicker(TKL_VI_CHN_E chn, TKL_ISP_FLICKER_TYPE_E *eAntiFlicker)
/***********************************************************
* Function: tkl_vi_isp_set_antiflicker
* Description: Set anti-flicker.
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN TKL_ISP_FLICKER_TYPE_E eAntiFlicker, 0: Disabled. 1: 50 Hz. 2: 60 Hz. 3: Auto.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_set_antiflicker(TKL_VI_CHN_E chn, TKL_ISP_FLICKER_TYPE_E eAntiFlicker)
/***********************************************************
* Function: tkl_vi_isp_set_color_to_gray
* Description: Convert color images to black and white, and vice versa.
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN int grey_flag, The current mode. 0: Full color in day mode. 1: Black and white in night mode. Other values are not supported.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_set_color_to_gray(TKL_VI_CHN_E chn, int grey_flag)
/***********************************************************
* Function: tkl_vi_dnswitch_get_illumin
* Description: Get the calculated illuminance value for day/night switching.
* Parameter: IN TKL_VI_CHN_E chn The device ID
IN TKL_ISP_DN_MODE_E irmode, The current day/night mode. 0: Auto mode.1: Day mode. 2: Night mode. Specifying it to auto will force the day mode. Auto is not supported.
OUT INT32_T *illumin_result The calculation result of the day/night switching algorithm is by default an integer. When there is a strong reflection in night vision, 1 is returned with a serial prompt.
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_dnswitch_get_illumin(TKL_VI_CHN_E chn, TKL_ISP_DN_MODE_E irmode, INT32_T *illumin_result)
/***********************************************************
* Function: tkl_vi_isp_show_fw_version
* Description: Display the ISP version number, which is output through the serial port every time the camera is powered on.
* Parameter: ISP_FW_VERSION, Macro definition, the ISP version number of the current camera.
ISP_SENSOR_NAME, Macro definition, the name of the current camera's sensor.
*
* Return value: <0: Failure. =0: Success.
***********************************************************/
OPERATE_RET tkl_vi_isp_show_fw_version(PCHAR_T version, PCHAR_T name)
/******************************************************************************
* Function: tkl_vi_isp_get_param
* Description: Get the parameters of various modules in ISP pipeline with the chip platform API for image analysis. Currently, only AE and AWB are supported.
* Parameter: IN TKL_VI_CHN_E chn The device ID
OUT TKL_ISP_LOG_INFO_T *pstISPParam isp Parameters to be displayed after logging is enabled.
* Return value: <0: Failure. =0: Success.
******************************************************************************/
OPERATE_RET tkl_vi_isp_get_param(TKL_VI_CHN_E chn, TKL_ISP_LOG_INFO_T *pstISPParam)
After you complete image tuning and compilation, be sure to check the result in different scenes.
You should comprehensively evaluate the tuning result because image parameters that fit a scene might not work well in a different one.
Troubleshooting steps:
Check if the I2C interface works fine.
If I2C communication is normal, the IPC will print xxxxx Probed success,subdev:xxxxxx
when power on. The sensor ID is returned by the function sensor_probe_id_func
. If the sensor ID is not returned correctly, perform the steps below.
Check if you have written the correct sensor I2C address into the driver file according to the sensor datasheet.
Measure the I2C signal.
Check if the power-on sequence in the driver file matches the one specified on the sensor datasheet.
Check if the sensor ID in the ISP parameter configuration file is correct.
For the Anyka platform, the parameters for day and night mode are saved in the configuration file isp.conf
. The SubFileId
displayed in the tuning tool is:
0
: Day mode.1
: Night mode.For Fullhan and Novatek platforms, the day mode and night mode each have their own separate configuration file.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback