At present, due to the image sensor now has no built-in ISP, how to get the ideal image quality is the problem we have to overcome. Arducam now release a serial of mipi cameras, due to not have the raspberrypi official local hardware ISP support, Arducam technical team release some software ways to fine tune the image quality. The target of this topic is to tell user to how to use Arducam mipi api to tune the image quality.
Now Arducam mipi camera’s API supports adjust the exposure time and gain compensation manually. The related API is int arducam_set_control(CAMERA_INSTANCE camera_instance, int ctrl_id, int value)
@param camera_instance Type CAMERA_INSTANCE, Obtained from arducam_init_camera function.
@param ctrl_id Control id.
@param value Control value.
@return error code , 0 success, !0 error.
arducam_set_control(camera_instance, V4L2_CID_EXPOSURE, 3000);
About the control ID, user can run ./list_format to check all the ID your sensor support.
In this topic, I use the imx298 as an example.
For example, If I set the exposure time to 0x00FF
If I set the exposure time to 0x0F00
User can enabe and disable the auto white balance using the int arducam_software_auto_white_balance(CAMERA_INSTANCE camera_instance, int enable) API.
If set arducam_software_auto_white_balance(camera_instance, 0), the image will be green
If set arducam_software_auto_white_balance(camera_instance, 1), the image will be better
Sometimes, after we enable the auto white balance, we can’t get the better image quality we need, we can use void arducam_manual_set_awb_compensation(uint32_t r_gain, uint32_t b_gain) API to compensation the red channel gain and blue channel gain.
User can use arducamstill command to test.
run ./arducamstill -? to get the help
For example if I set rgain to 100 and bgain to 150
[email protected]:~/MIPI_Camera/RPI $ ./arducamstill -t 0 -rgain 100 -bgain 150
For example if I set rgain to 150 and bgain to 50
[email protected]:~/MIPI_Camera/RPI $ ./arducamstill -t 0 -rgain 150 -bgain 50
What’s more , for some lens support motor focus, about the focus control, user can use arducam_set_control(camera_instance, V4L2_CID_FOCUS_ABSOLUTE, value) API.
For example, if I set the value to 10
arducam_set_control(camera_instance, V4L2_CID_FOCUS_ABSOLUTE, 10)
The image will be blurring
If set the value to 190
arducam_set_control(camera_instance, V4L2_CID_FOCUS_ABSOLUTE, 190)
The image will be better.
Now, we release opencvGui demo and Video presentation. Visiting https://www.arducam.com/downloads/video/Arducam_Fine_Tune_Method_for_MIPI_Cameras.mp4