DVP & MIPI-CSI Camera Solution Introduction
Note
This document is automatically translated using AI. Please excuse any detailed errors. The official English version is still in progress.
Common Application Scenarios
Existing video demos
ESP32-S3 Blazing Milliseconds [High Frame Rate 125 fps]: ESP32-S3 with global shutter camera, achieving high frame rate of 125 FPS. It can capture the motion trajectory of moving objects, such as high frame rate image capture for writing pens and other scenarios. Combined with ESP32-S3’s network capabilities, it’s the first choice for IoT smart camera solutions.
ESP32-S3 Watching Cute Cats Eating [High Resolution]: ESP32-S3-EYE AI development board with a 2MP camera. High-resolution real-time viewing of cats eating, first choice for pet monitoring.
Product barcode scanning, train ticket scanning, tax invoice scanning, resource scanning and downloading, etc.
Auto focus + Internet
Photos taken are immediately refreshed on webpages or displayed on LCD
Scanner, smart car auxiliary navigation
Face recognition
Technology or system for identity confirmation or identity search through facial recognition
Video surveillance, light-sensitive ambient lighting
AI applications
Gesture recognition
Number recognition
Food recognition
Posture detection
Reference Materials
Software references
Related modules/development boards purchase
Module/development board materials and selection reference
Extended Camera Solutions
Night Vision Camera Solution
Night vision camera solutions are mainly divided into solutions with fill light and solutions without fill light.
Among the solutions with fill light, there are infrared fill-light night vision and white-light fill-light night vision, depending on the type of fill light. The differences are as follows:
Item |
Infrared fill-light night vision |
White-light fill-light night vision |
|---|---|---|
Hardware |
Camera sensor, infrared fill light, IR-CUT switch (used to switch the IR filter), ambient light sensor, and other modules |
Camera sensor, white-light fill light, and other modules |
Fill-light concealment |
Better. It is harder to notice and is intended to stay discreet |
Worse. It is easier to notice |
Final image |
Grayscale. Contrast is good and detail is richer. Infrared light penetrates fog, rain, and other harsh weather better, which helps keep the surveillance image continuous and stable |
Color. Contrast is limited. White light at night tends to attract insects in front of the lens and can cause false alarms |
Recommended scenarios |
Night security surveillance, wildlife observation, license-plate recognition, warehouse management, industrial visual inspection, and similar uses |
Doorbell monitoring, smart home, and similar uses |
Cost |
Higher (an infrared fill light, IR-CUT switch, ambient light sensor, and so on are required) |
Lower (mainly a white-light fill light is required) |
Power consumption |
Lower at the same shooting distance (an infrared fill light consumes less power) |
Higher at the same shooting distance (a white-light fill light consumes more power) |
esp-video already supports the infrared night vision camera solution with an ambient light sensor, and the white-light fill-light solution.
For the implementation, see the night vision camera solution in ESP-Video-Components.
Main Hardware of the Infrared Fill-Light Night Vision Solution
Photos of the hardware modules:
IR-CUT filter characteristics:
Hardware breakdown:
Effect of different filters on the image:
Data Flow of the White-Light Fill-Light Night Vision Solution
IP-KVM Camera Solution
IP-KVM (or KVM over IP) is a hardware remote-management device that lets a user control the keyboard, video, and mouse of a remote computer or server directly over a network, using the Internet Protocol (IP). esp-video can test the HDMI-to-MIPI-CSI bridge sensors used in this solution, such as TC358743 or LT6911D.
IP-KVM and a regular remote desktop can both operate a remote computer locally, but their underlying logic, operating layer, and reliability differ.
Aspect |
IP-KVM (hardware / out-of-band) |
Remote desktop (software / inside the operating system) |
|---|---|---|
Implementation |
A standalone hardware device (ESP32-P4 with TC358743 or LT6911D is recommended) |
Software or a service running on the operating system (such as RDP, VNC, Sunlogin, or TeamViewer) |
Control layer |
BIOS level: the power-on self-test screen is visible, and the user can enter the BIOS, change RAID-card settings, and reinstall the operating system |
Operating-system level: a connection is possible only after the operating system has started normally and the remote service is running |
System crash or blue screen |
Unaffected: the device can still be operated and forced to restart when the system hangs, shows a blue screen, or is not installed |
Cannot connect: the remote desktop stops working when the system crashes, hangs, or its network service stalls |
System resource use |
Does not use the controlled host’s CPU or memory; an independent device does the work |
Uses the controlled host’s resources for screen capture, encoding, and transmission |
Dependence on the operating system |
None: Windows, Linux, ESXi, or bare metal can be managed |
Present: a specific operating system and remote protocol are required |
Out-of-band access |
Available (out-of-band): it does not depend on the host’s service network and usually has an independent management port |
Not available (in-band): it depends on the host being online and running a TCP/IP stack |
Touchscreen-Linked Autofocus Solution
esp-video already supports an autofocus solution linked to a touchscreen. After the camera is opened, tapping the screen selects the tapped area as the primary ROI (Region of Interest). For the implementation, see ESP-Video-Components.
ToF Camera Solution
A ToF (Time of Flight) sensor combines a low-cost pixel photosensitive array with actively modulated illumination. It can provide both two-dimensional brightness information and depth information.
Sensors of this type usually have a DVP or MIPI data interface. esp-video can support sensors with these interfaces, unpack the data, and render the image in color.
The general operating principle of a ToF sensor is shown below:
The output image of a ToF sensor is shown below:
Millimeter-Wave Radar, LiDAR, and Other Point-Cloud Sensors
A millimeter-wave radar (mmWave radar) transmits millimeter-wave signals, captures the signals reflected by obstacles along the path, and processes them to obtain the target’s speed, distance, azimuth, and height. The AK5816 sensor is currently supported.
LiDAR emits a laser beam and measures distance by time of flight, then generates a high-resolution 3D point-cloud map of the environment. The ADS6551 is currently supported.
The three types of sensors are compared below:
Item |
ToF sensor |
Millimeter-wave radar |
LiDAR |
|---|---|---|---|
Operating principle |
An actively modulated light source illuminates the scene, and a pixel photosensitive array measures the light’s time of flight |
Millimeter waves are transmitted and the echoes reflected by obstacles are processed. The AK5816 is a 57–64 GHz FMCW radar with 4 transmitters and 4 receivers |
A laser beam is emitted and distance is measured actively by time of flight |
Main output |
A two-dimensional brightness image and per-pixel depth |
Target speed, distance, azimuth, and height. The AK5816 can output a range FFT or point cloud after on-chip processing, or output raw ADC data over MIPI CSI-2 |
A high-resolution 3D point cloud of the environment |
Speed information |
Must be derived from consecutive depth frames |
Radial speed can be obtained directly from the echo Doppler shift |
A single time-of-flight range measurement does not give speed directly; multi-frame tracking is required |
Environmental adaptability |
Does not depend on visible ambient light. Strong ambient light interferes with ranging |
Does not depend on visible light. It penetrates rain, fog, and dust relatively well and is suitable for non-imaging monitoring |
Does not depend on visible ambient light. Rain, fog, and dust scatter the laser and reduce point-cloud completeness |
Privacy |
Also outputs a brightness image |
Does not output a visible-light image |
Outputs a geometric point cloud without appearance texture |
Interface and processing |
Commonly DVP and MIPI. esp-video can unpack the data and render it in color |
The AK5816 supports MIPI CSI-2 and SPI. SPI can output processed targets or a point cloud, which makes clustering easier for a low-compute host |
Point-cloud data volume is large, so mapping and clustering cost more. The ADS6551 is a LiDAR receiver chip and supports a flexible number of lines and multi-chip expansion |
Typical scenarios |
Short-range depth, volume measurement, and camera-assisted focus |
Multi-person positioning, respiration monitoring, and intrusion detection (the AK5816 targets smart home, health, and security) |
Mapping, obstacle avoidance, and spatial surveying. The ADS6551 targets automotive front radar and can also be used for robots, drones, and handheld surveying |
Currently supported |
ToF cameras with a DVP or MIPI interface, such as the OPT9221, unpacked and rendered by esp-video |
AK5816 |
ADS6551 |
Typical application scenarios of these sensors are shown below:
Visible-Light and Thermal Camera Fusion
A fusion solution for visible-light and thermal (infrared) cameras combines the texture and edge detail of a visible-light image with the temperature field and thermal differences of a thermal image, so the environment can be perceived more completely and accurately.
Chips with a PPA peripheral and a camera interface are recommended, such as the ESP32-P4 and ESP32-S31. Recommended fusion approaches:
Overlay the two images by the alpha channel with the PPA peripheral.
Multispectral fusion: mix pixels of the two images in the frequency domain by weight or with a deep-learning model. For example, use the thermal image for low frequencies to represent temperature, and the visible-light image for high frequencies to represent detail. This can be done with the fast Fourier transform (FFT) using the DSP capability of the ESP32-P4.
Edge overlay: extract contours and edge detail from the high-resolution visible-light image, then overlay them on the thermal image in real time.
Performance Test Data Appendix
Camera solutions primarily focus on the following performance indicators:
Sensor initialization time (especially for projects that need to capture immediately after startup)
Supported resolutions and data formats
Frame rate under specified resolution and data format
Transmission rate when used with Wi-Fi
Supported image processing functions (currently mainly JPEG encoding/decoding performed through software)
Related test code can be found in the test examples.
Sensor Initialization Time
Sensor |
Init time (ms) |
|---|---|
OV3660, JPEG |
604 |
OV3660, RGB565 |
1301 |
OV2640, JPEG |
200 |
OV5640, JPEG |
240 |
Note
When conducting the above tests, please note:
A picture needs to be captured at the end of the test to verify correctness
You can refer to More optimization methods to optimize the system configuration as much as possible.
Supported Resolutions and Data Formats
The supported resolution size depends entirely on the camera’s maximum performance, but the capabilities of DVP itself and CPU DMA are limited, and excessive resolution will put pressure on data transmission:
If the DVP camera sensor can output JPEG type images, the recommended maximum resolution should not exceed 5MP
If the DVP camera sensor cannot output JPEG type images (when the image type is YUV422/RGB565, etc.), the recommended maximum resolution should not exceed 1MP
Data formats mainly depend on the output formats supported by the camera. These primarily include:
RGB
YUV
JPEG
RAW Data
BMP
Only Y/Grayscale
When the camera itself does not support JPEG data output, ESP32 can perform JPEG compression to output JPEG data.
Note
Specifically, when requiring resolutions exceeding 1024*720, it’s best to consider cameras that support JPEG encoding. It should be noted that JPEG encoding/decoding performed by ESP32 will put pressure on CPU and memory.
For the ESP32P4’s MIPI CSI interface, it supports data in RGB, YUV, and RAW Data formats.
Frame Rate Under Specified Resolution and Data Format
Output format |
Chip model |
Sensor model |
Resolution |
Frame rate |
|---|---|---|---|---|
YUV422RGB565 |
ESP32-S3 |
SC030IOT(DVP) |
640*480 |
30 fps |
JPEG |
ESP32S3 |
OV5640(DVP) |
1600*1200 |
25 fps |
Only Y/MONO |
ESP32-S3/ESP32-S2 |
SC031GS(DVP) |
240*240 |
125 fps |
YUV422 |
ESP32-S31 |
SC101IOT(DVP) |
1280x720 |
30 fps |
YUV422 |
ESP32-S31 |
BF3925(DVP) |
1600x1200 |
6~7 fps |
JPEG |
ESP32-S31 |
OV3640(DVP) |
1920x1080 |
30 fps |
RGB RAW |
ESP32-P4 |
SC2336(MIPI) |
1920*1080 |
30 fps |
RGB565 |
ESP32-P4 |
OV5645(MIPI) |
2592*1944 |
15 fps |
YUV422 |
ESP32-P4 |
SC101IOT(DVP) |
1280*720 |
24 fps |
YUV422 |
ESP32-P4 |
SC035HGS(MIPI) |
640*480 |
100 fps |
YUV422 |
ESP32-P4 |
BF3901(SPI 1-Bit) |
240*320 |
10 fps |
The rates of different cameras vary greatly. When testing JPEG rates, you should specify the JPEG compression parameters and try to shoot colorful pictures. Shooting monochrome objects will contain more low-frequency information, resulting in smaller data volume after JPEG compression, and the generated data will not be representative.
For esp32-camera, the frame rate of the same camera varies greatly when settings for data format, resolution, main clock XCLK size, and idle interval time parameters differ. To ensure frame rate, fb_count should not be less than 2 when initializing the camera. Currently, driver parameters for most cameras are not optimal, and configuration methods for different cameras are not standardized, so there is significant room for optimization of the above performance data. ESP32-S3 has an independent CAM DVP interface with a peripheral interface rate 2-3 times higher than ESP32.
Transmission Rate When Used With Wi-Fi
Usually, once the user’s required data format, resolution, frame rate and other parameters are determined, the feasibility of the solution can be initially estimated based on Wi-Fi test data.
Taking JPEG@480*320@20fps as an example, a single JPEG@480*320 image is typically 30KB-50KB. With a required frame rate of 20fps, the required Wi-Fi speed should be 600KB/s-1000KB/s. By checking the ESP32-S3 Wi-Fi throughput, it can be seen that ESP32-S3 meets these requirements.
Current testing of the esp-rtsp example running on ESP32-S3 shows that 720p + MJPEG video stream can achieve a frame rate of around 20fps.
ESP32-S3 Encoding/Decoding Performance
ESP32-S3 does not have hardware encoding/decoding capabilities; its driver code includes the TinyJPEG software encoding component.
Common Q&A
Querying resolution and output format descriptions in esp-video.
esp-video provides detailed descriptions of camera sensor output formats. Taking OV5645 as an example, users can refer to this description to understand its supported output formats and select the desired output format in menuconfig. If you’re using ESP32-P4 and encounter unsupported resolutions, you can use the PPA module to scale or crop the original output image.
Modifying ESP32-P4 ISP parameters.
For sensors outputting RAW format data, the ISP module is needed to optimize image brightness and color. The ISP system consists of three parts: ISP calibration tools, ISP control algorithms, and ISP hardware pipelines. The ISP calibration tools require specialized laboratories and professional personnel to use. Some parameters of the ISP control algorithms and ISP module can be configured through JSON files. Taking OV2710 as an example, its JSON file is located here. Users can copy this default JSON file to create custom JSON files and specify the path to this file through the configuration menu.
How to determine if a sensor requires enabling the ISP Pipelines Controller?
This requires checking the sensor’s datasheet. Based on output characteristics, sensors can be divided into three types:
JPEG sensor: Sensors that can directly output JPEG data. The internal structure of these sensors can be simplified as: RAW sensor + Internal ISP + JPEG encoder. The Internal ISP encodes RAW data into YUV or RGB format data; the JPEG encoder encodes RGB or YUV format data into JPEG. It actually has three modules working.
YUV sensor: Sensors that can directly output YUV422 or RGB565 data. The internal structure of these sensors can be simplified as: RAW sensor + Internal ISP. It actually has two modules working. When JPEG data is needed, the SOC needs to perform JPEG encoding. For ESP32-S3, the esp_new_jpeg component can be used for software encoding. For ESP32-P4, it has a HW_JPEG_Encoder.
RAW sensor: Sensors that can only output RAW8 or RAW10 data. The internal structure of these sensors only has a RAW sensor. Therefore, when projects need RGB, YUV, or JPEG format data, the SOC needs to deploy ISP and JPEG encoder. For projects with low efficiency requirements, software-implemented ISP can be used; otherwise, it’s necessary to enable the ISP Pipelines Controller on the SOC.
For RAW sensors, how to quickly obtain JPEG images or H.264 data?
First, enable the ISP Pipelines Controller on the SOC to obtain YUV or RGB format data in the ISP output queue. Then use the M2M (MemoryToMemory) middleware provided by esp-video to transfer data from the ISP output queue to the encoder input queue. Finally, retrieve the encoded data from the encoder output queue. Examples using the M2M mechanism include: image_storage and uvc.
What to do if the image frame rate is slow?
The image data users care about is often processed and transmitted through multiple modules. Therefore, it’s necessary to guide customers to test the rate at each stage step by step.
First, confirm the actual output frame rate of the camera sensor. For users using esp32-camera, use the test_framerate example; for users using esp-video, use the capture_stream example. Then gradually enable ISP and encoder, and test the rate after enabling these encoding modules respectively. Finally, test the data transmission rate (network, peripheral interface).
How to test the functionality of the HDMI to MIPI-CSI bridge sensor?
The data flow of the HDMI to MIPI-CSI bridge can be described as HDMI output device -> HDMI to MIPI-CSI bridge -> ESP32 MIPI RX. This solution mainly provides a method to seamlessly integrate the HDMI video stream into various applications. Users first connect the various modules, then compile and burn the examples in esp-video/examples. Finally, configure the output format of the HDMI output device to be the same as the format selected in the example, and you can execute the test program.
What is the dynamic range of the image output by the ISP (Image Processor) of the ESP32-P4?
The ISP of ESP32-P4 only supports linear mode, therefore the maximum dynamic range of ISP output is 42dB. If high dynamic range is required, you can choose a camera sensor with built-in ISP, such as SC121AT.
How to solve the problem of decreased frame rate of image data, or even errors in image data, after enabling Flash encryption?
After enabling Flash encryption, the access speed of Flash and PSRAM will be affected. It is recommended to reduce the frame rate of the camera output image data, and turn off unused peripheral modules to avoid running simultaneously with the OTA function.