kopia lustrzana https://github.com/espressif/esp-idf
doc(isp): isp sharpen programming guide
rodzic
0d79e41ebc
commit
212aef3b63
|
@ -29,9 +29,11 @@ INPUT += \
|
|||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_types.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_af.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_ae.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_awb.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_ccm.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_bf.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_sharpen.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_core.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_isp/include/driver/isp_gamma.h \
|
||||
$(PROJECT_PATH)/components/esp_driver_jpeg/include/driver/jpeg_decode.h \
|
||||
|
|
|
@ -4,7 +4,7 @@ Image Signal Processor
|
|||
Introduction
|
||||
------------
|
||||
|
||||
{IDF_TARGET_NAME} includes an Image Signal Processor (ISP), which is a feature pipeline that consists of many image processing algorithms. ISP receives image data from the DVP camera or MIPI-CSI camera, or system memory, and writes the processed image data to the system memory through DMA. ISP shall work with other modules to read and write data, it can not work alone.
|
||||
{IDF_TARGET_NAME} includes an Image Signal Processor (ISP), which is a feature pipeline that consists of many image processing algorithms. ISP receives image data from the DVP camera or MIPI-CSI camera, or system memory, and writes the processed image data to the system memory through DMA. The ISP is designed to work with other camera controller modules and cannot operate independently.
|
||||
|
||||
Terminology
|
||||
-----------
|
||||
|
@ -40,7 +40,7 @@ ISP Pipeline
|
|||
isp_chs [label = "Contrast &\n Hue & Saturation", width = 150, height = 70];
|
||||
isp_yuv [label = "YUV Limit\nYUB2RGB", width = 120, height = 70];
|
||||
|
||||
isp_header -> BF -> Demosaic -> CCM -> Gamma -> RGB2YUV -> isp_chs -> isp_yuv -> isp_tail;
|
||||
isp_header -> BF -> Demosaic -> CCM -> Gamma -> RGB2YUV -> SHARP -> isp_chs -> isp_yuv -> isp_tail;
|
||||
|
||||
BF -> HIST
|
||||
Demosaic -> AWB
|
||||
|
@ -49,7 +49,7 @@ ISP Pipeline
|
|||
CCM -> AWB
|
||||
Gamma -> AE
|
||||
RGB2YUV -> HIST
|
||||
RGB2YUV -> AF
|
||||
SHARP -> AF
|
||||
}
|
||||
|
||||
Functional Overview
|
||||
|
@ -60,10 +60,12 @@ The ISP driver offers following services:
|
|||
- `Resource Allocation <#isp-resource-allocation>`__ - covers how to allocate ISP resources with properly set of configurations. It also covers how to recycle the resources when they finished working.
|
||||
- `Enable and disable ISP processor <#isp-enable-disable>`__ - covers how to enable and disable an ISP processor.
|
||||
- `Get AF statistics in one shot or continuous way <#isp-af-statistics>`__ - covers how to get AF statistics one-shot or continuously.
|
||||
- `Get AE statistics in one shot or continuous way <#isp-ae-statistics>`__ - covers how to get AE statistics one-shot or continuously.
|
||||
- `Get AWB statistics in one shot or continuous way <#isp-awb-statistics>`__ - covers how to get AWB white patches statistics one-shot or continuously.
|
||||
- `Enable BF function <#isp_bf>`__ - covers how to enable and configure BF function.
|
||||
- `Configure CCM <#isp-ccm-config>`__ - covers how to configure the Color Correction Matrix.
|
||||
- `Enable BF function <#isp-bf>`__ - covers how to enable and configure BF function.
|
||||
- `Configure CCM <#isp-ccm-config>`__ - covers how to config the Color Correction Matrix.
|
||||
- `Enable Gamma Correction <#isp-gamma-correction>`__ - covers how to enable and configure gamma correction.
|
||||
- `Configure Sharpen <#isp-sharpen>`__ - covers how to config the Sharpen function.
|
||||
- `Register callback <#isp-callback>`__ - covers how to hook user specific code to ISP driver event callback function.
|
||||
- `Thread Safety <#isp-thread-safety>`__ - lists which APIs are guaranteed to be thread safe by the driver.
|
||||
- `Kconfig Options <#isp-kconfig-options>`__ - lists the supported Kconfig options that can bring different effects to the driver.
|
||||
|
@ -392,7 +394,7 @@ Note that if you want to use the continuous statistics, you need to register the
|
|||
/* Delete the awb controller and free the resources */
|
||||
ESP_ERROR_CHECK(esp_isp_del_awb_controller(awb_ctlr));
|
||||
|
||||
.. _isp_bf:
|
||||
.. _isp-bf:
|
||||
|
||||
ISP BF Processor
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
@ -405,6 +407,11 @@ Calling :cpp:func:`esp_isp_bf_configure` to configure BF function, you can take
|
|||
|
||||
esp_isp_bf_config_t bf_config = {
|
||||
.denoising_level = 5,
|
||||
.bf_template = {
|
||||
{1, 2, 1},
|
||||
{2, 4, 2},
|
||||
{1, 2, 1},
|
||||
},
|
||||
...
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_isp_bf_configure(isp_proc, &bf_config));
|
||||
|
@ -492,18 +499,65 @@ A typical code example is:
|
|||
// Disable gamma if no longer needed
|
||||
ESP_ERROR_CHECK(esp_isp_gamma_disable(isp_proc));
|
||||
|
||||
.. _isp-sharpen:
|
||||
|
||||
ISP Sharpen Processor
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This pipeline is used for doing image input sharpening under YUV mode.
|
||||
|
||||
Calling :cpp:func:`esp_isp_sharpen_configure` to configure BF function, you can take following code as reference.
|
||||
|
||||
.. code:: c
|
||||
|
||||
esp_isp_sharpen_config_t sharpen_config = {
|
||||
.h_thresh = 255,
|
||||
.sharpen_template = {
|
||||
{1, 2, 1},
|
||||
{2, 4, 2},
|
||||
{1, 2, 1},
|
||||
},
|
||||
...
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_isp_sharpen_configure(isp_proc, &sharpen_config));
|
||||
ESP_ERROR_CHECK(esp_isp_sharpen_enable(isp_proc));
|
||||
|
||||
:cpp:member:`esp_isp_sharpen_config_t::sharpen_template` is used for sharpening. You can set the :cpp:member:`esp_isp_sharpen_config_t::sharpen_template` with a Gaussian filter template or an average filter template.
|
||||
|
||||
After calling :cpp:func:`esp_isp_sharpen_configure`, you need to enable the ISP Sharpen processor, by calling :cpp:func:`esp_isp_sharpen_enable`. This function:
|
||||
|
||||
* Switches the driver state from **init** to **enable**.
|
||||
|
||||
Calling :cpp:func:`esp_isp_sharpen_disable` does the opposite, that is, put the driver back to the **init** state.
|
||||
|
||||
:cpp:func:`esp_isp_sharpen_configure` is allowed to be called even if the driver is in **init** state, but the sharpen configurations will only be taken into effect when in **enable** state.
|
||||
|
||||
|
||||
.. _isp-callback:
|
||||
|
||||
Register Event Callbacks
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. note::
|
||||
|
||||
The below mentioned callback functions are called within an ISR context, you must ensure that the functions do not attempt to block (e.g., by making sure that only FreeRTOS APIs with ``ISR`` suffix are called from within the function).
|
||||
|
||||
Register ISP Processor Event Callbacks
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
After the ISP processor is enabled, it can generate multiple events of multiple ISP submodules dynamically. You can hook your functions to the interrupt service routine by calling :cpp:func:`esp_isp_register_event_callbacks`. All supported event callbacks are listed in :cpp:type:`esp_isp_evt_cbs_t`:
|
||||
|
||||
- :cpp:member:`esp_isp_evt_cbs_t::on_sharpen_frame_done`. sets a callback function for sharpen frame done. It will be called after the ISP sharpen submodule finishes its operation for one frame. The function prototype is declared in :cpp:type:`esp_isp_sharpen_callback_t`.
|
||||
|
||||
You can save your own context to :cpp:func:`esp_isp_register_event_callbacks` as well, via the parameter ``user_data``. The user data will be directly passed to the callback function.
|
||||
|
||||
Register ISP AF Environment Detector Event Callbacks
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
After the ISP AF environment detector starts up, it can generate a specific event dynamically. If you have some functions that should be called when the event happens, please hook your function to the interrupt service routine by calling :cpp:func:`esp_isp_af_env_detector_register_event_callbacks`. All supported event callbacks are listed in :cpp:type:`esp_isp_af_env_detector_evt_cbs_t`:
|
||||
|
||||
- :cpp:member:`esp_isp_af_env_detector_evt_cbs_t::on_env_statistics_done` sets a callback function for environment statistics done. As this function is called within the ISR context, you must ensure that the function does not attempt to block (e.g., by making sure that only FreeRTOS APIs with ``ISR`` suffix are called from within the function). The function prototype is declared in :cpp:type:`esp_isp_af_env_detector_callback_t`.
|
||||
- :cpp:member:`esp_isp_af_env_detector_evt_cbs_t::on_env_change` sets a callback function for environment change. As this function is called within the ISR context, you must ensure that the function does not attempt to block (e.g., by making sure that only FreeRTOS APIs with ``ISR`` suffix are called from within the function). The function prototype is declared in :cpp:type:`esp_isp_af_env_detector_callback_t`.
|
||||
- :cpp:member:`esp_isp_af_env_detector_evt_cbs_t::on_env_statistics_done` sets a callback function for environment statistics done. The function prototype is declared in :cpp:type:`esp_isp_af_env_detector_callback_t`.
|
||||
- :cpp:member:`esp_isp_af_env_detector_evt_cbs_t::on_env_change` sets a callback function for environment change. The function prototype is declared in :cpp:type:`esp_isp_af_env_detector_callback_t`.
|
||||
|
||||
You can save your own context to :cpp:func:`esp_isp_af_env_detector_register_event_callbacks` as well, via the parameter ``user_data``. The user data will be directly passed to the callback function.
|
||||
|
||||
|
@ -512,7 +566,7 @@ Register ISP AWB Statistics Done Event Callbacks
|
|||
|
||||
After the ISP AWB controller finished statistics of white patches, it can generate a specific event dynamically. If you want to be informed when the statistics done event takes place, please hook your function to the interrupt service routine by calling :cpp:func:`esp_isp_awb_register_event_callbacks`. All supported event callbacks are listed in :cpp:type:`esp_isp_awb_cbs_t`:
|
||||
|
||||
- :cpp:member:`esp_isp_awb_cbs_t::on_statistics_done` sets a callback function when finished statistics of the white patches. As this function is called within the ISR context, you must ensure that the function does not attempt to block (e.g., by making sure that only FreeRTOS APIs with ``ISR`` suffix are called from within the function). The function prototype is declared in :cpp:type:`esp_isp_awb_callback_t`.
|
||||
- :cpp:member:`esp_isp_awb_cbs_t::on_statistics_done` sets a callback function when finished statistics of the white patches. The function prototype is declared in :cpp:type:`esp_isp_awb_callback_t`.
|
||||
|
||||
You can save your own context via the parameter ``user_data`` of :cpp:func:`esp_isp_awb_register_event_callbacks`. The user data will be directly passed to the callback function.
|
||||
|
||||
|
@ -537,13 +591,23 @@ IRAM Safe
|
|||
|
||||
By default, the ISP interrupt will be deferred when the cache is disabled because of writing or erasing the flash.
|
||||
|
||||
There is a Kconfig option :ref:`CONFIG_ISP_ISR_IRAM_SAFE` that:
|
||||
Kconfig option :ref:`CONFIG_ISP_ISR_IRAM_SAFE` will:
|
||||
|
||||
- Enables the interrupt being serviced even when the cache is disabled
|
||||
- Places all functions that used by the ISR into IRAM
|
||||
- Places driver object into DRAM (in case it is mapped to PSRAM by accident)
|
||||
- Enable the interrupt being serviced even when the cache is disabled
|
||||
- Place all functions that used by the ISR into IRAM
|
||||
- Place driver object into DRAM (in case it is mapped to PSRAM by accident)
|
||||
|
||||
This allows the interrupt to run while the cache is disabled, but comes at the cost of increased IRAM consumption.
|
||||
This allows the interrupt to run while the cache is disabled, but comes at the cost of increased IRAM consumption. With this option enabled, the ISR callbacks will be running when cache is disabled. Therefore you should make sure the callbacks and its involved context are IRAM-safe as well.
|
||||
|
||||
Kconfig option :ref:`CONFIG_ISP_CTRL_FUNC_IN_IRAM` will:
|
||||
|
||||
- Place some of ISP control functions into IRAM, function list:
|
||||
- :cpp:func:`esp_isp_sharpen_configure`
|
||||
|
||||
Application Examples
|
||||
--------------------
|
||||
|
||||
* :example:`peripherals/isp/multi_pipelines` demonstrates how to use the ISP pipelines to process the image signals from camera sensors and display the video on LCD screen via DSI peripheral.
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
@ -551,4 +615,9 @@ API Reference
|
|||
.. include-build-file:: inc/isp.inc
|
||||
.. include-build-file:: inc/isp_types.inc
|
||||
.. include-build-file:: inc/isp_af.inc
|
||||
.. include-build-file:: inc/isp_ae.inc
|
||||
.. include-build-file:: inc/isp_awb.inc
|
||||
.. include-build-file:: inc/isp_bf.inc
|
||||
.. include-build-file:: inc/isp_ccm.inc
|
||||
.. include-build-file:: inc/isp_sharpen.inc
|
||||
.. include-build-file:: inc/isp_gamma.inc
|
||||
|
|
Ładowanie…
Reference in New Issue