Skip to main content

ESP-Image-Effects Release | Lightweight, Powerful, and Made for a Colorful World

·6 mins·
Multimedia Image Effects Image Scale Image Rotate Image Crop Image Color Space Image Processing
Author
Hou haiyan
Embedded Software Engineer at Espressif
Table of Contents
Espressif’s ESP_IMAGE_EFFECTS component is a powerful image processing library that can do common image processing operations such as scaling, rotation, cropping, and color space conversion. This article introduces the library, shows how to use it in processing images, and provides usage examples.

We are excited to announce the official release of ESP_IMAGE_EFFECTS) v1.0.0! ESP_IMAGE_EFFECTS is a high-performance image processing library tailored for embedded devices. It provides a unified API for various image effect modules, enabling efficient and flexible integration. With SIMD instruction set optimization and zero-copy memory design, ESP_IMAGE_EFFECTS delivers fast and lightweight image processing, making it ideal for real-time applications in smart homes, industrial vision, edge AI, and more.


Overview
#

What is ESP_IMAGE_EFFECTS?
#

ESP_IMAGE_EFFECTS (esp_imgfx) is a comprehensive image processing library that brings desktop-class image manipulation capabilities to embedded systems. By leveraging hardware acceleration and memory-efficient algorithms, it enables real-time image processing on resource-constrained devices without compromising performance or quality.

Key Advantages
#

  • πŸš€ High Performance: SIMD instruction set optimization for maximum throughput
  • πŸ’Ύ Memory Efficient: Zero-copy memory design minimizes RAM usage
  • πŸ”§ Flexible APIs: Modular design supports various processing pipelines
  • πŸ“± Embedded Optimized: Designed specifically for microcontroller environments
  • 🎯 Real-time Ready: Millisecond-level response for time-critical applications

Core Features
#

Image Rotation
#

ESP_IMAGE_EFFECTS offers a high-performance image rotation solution that supports 1Β° precision for any angle rotation. It employs a memory block swapping algorithm for standard angles (90Β°, 180Β°, 270Β°) to achieve zero overhead processing. The use of SIMD instructions further enhances processing efficiency, making it suitable for applications like smart cameras, industrial inspection, mobile devices, and more that require real-time image rotation.

// Rotate image by any angle 
esp_imgfx_rotate_cfg_t cfg = {
    .in_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB888,
    .in_res = {.width = 1920, .height = 1080},
    .degree = 45  // Any angle from 0-360Β°
};

Color Space Conversion
#

ESP_IMAGE_EFFECTS offers a comprehensive color space conversion solution, supporting over 100+ RGB/YUV formats, fully compatible with BT601/BT709/BT2020 and other mainstream color space standards. With SIMD hardware acceleration technology, it achieves high-speed color space conversion processing, meeting the strict requirements of professional image processing applications for format compatibility and processing efficiency.

// Convert image to RGB565 format
esp_imgfx_convert_cfg_t cfg = {
    .in_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB888,
    .out_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB565,
    .in_res = {.width = 1920, .height = 1080},
};

Image Scaling
#

ESP_IMAGE_EFFECTS provides a high-performance image scaling solution, supporting real-time image scaling with high quality. It supports various scaling algorithms, including down-resampleing and bilinear, and can achieve high-quality image scaling with high performance. The solution is widely used in various scenarios, such as smart cameras, industrial inspection, mobile devices, and more that require real-time image scaling.

// Scale image to 50% of original size
esp_imgfx_scale_cfg_t cfg = {
    .in_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB565,
    .in_res = {.width = 1920, .height = 1080},
    .scale_res = {.width = 960, .height = 540},
    .filter = ESP_IMGFX_SCALE_FILTER_TYPE_DOWN_RESAMPLE,
};

Image Cropping
#

ESP_IMAGE_EFFECTS provides a high-performance image cropping solution, which can extract a rectangular area from an image with high precision and high performance. The solution supports any cropping start positions and rectangular area sizes, and can achieve high-quality image cropping with high performance. The solution is widely used in various scenarios, such as smart cameras, industrial inspection, mobile devices, and more that require real-time image cropping.

// Crop image to a 960x540 region starting at (320, 180)
esp_imgfx_crop_cfg_t cfg = {
    .in_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB888,
    .in_res = {.width = 1920, .height = 1080},
    .cropped_res = {.width = 960, .height = 540},
    .x_pos = 320,
    .y_pos = 180,
};

API Reference
#

A unified API for various image effect modules, designed to simplify development by providing a consistent and intuitive interface. It allows developers to apply and manage multiple image effects with minimal code changes, significantly reducing the learning curve.

Core Functions
#

Function PatternDescriptionExample
esp_imgfx_*_openCreate processing handleesp_imgfx_rotate_open(&cfg, &handle)
esp_imgfx_*_get_cfgGet current configurationesp_imgfx_rotate_get_cfg(handle, &cfg)
esp_imgfx_*_set_cfgUpdate configurationesp_imgfx_rotate_set_cfg(handle, &new_cfg)
esp_imgfx_*_processExecute image processingesp_imgfx_rotate_process(handle, &in, &out)
esp_imgfx_*_closeRelease handle resourcesesp_imgfx_rotate_close(handle)
esp_imgfx_rotate_get_rotated_resolutionGet rotated resolution, only for rotationesp_imgfx_rotate_get_rotated_resolution(handle, &res)

Utility Functions
#

FunctionDescriptionUse Case
esp_imgfx_get_bits_per_pixelCalculate BPP for formatMemory allocation
esp_imgfx_get_image_sizeCalculate image sizeBuffer management

Getting Started
#

Basic Usage Example
#

#include "esp_imgfx_rotate.h"

// Configure rotation parameters
esp_imgfx_rotate_cfg_t cfg = {
    .in_pixel_fmt = ESP_IMGFX_PIXEL_FMT_RGB888,
    .in_res = {.width = 1920, .height = 1080},
    .degree = 90
};

// Create handle
esp_imgfx_rotate_handle_t handle;
esp_imgfx_err_t ret = esp_imgfx_rotate_open(&cfg, &handle);
assert(ESP_IMGFX_ERR_OK == ret);

// Prepare image data
esp_imgfx_data_t in_image = {.data_len = 1920 * 1080 * 3};
esp_imgfx_data_t out_image = {.data_len = 1920 * 1080 * 3};

// Allocate aligned memory for optimal performance
assert(0 == posix_memalign((void **)&in_image.data, 128, in_image.data_len));
assert(0 == posix_memalign((void **)&out_image.data, 128, out_image.data_len));

// Process image
ret = esp_imgfx_rotate_process(handle, &in_image, &out_image);
assert(ESP_IMGFX_ERR_OK == ret);

// Cleanup
free(in_image.data);
free(out_image.data);
esp_imgfx_rotate_close(handle);

Real-World Applications
#

Smart Access Control System
#

Pipeline: Camera Capture β†’ Rotation Correction β†’ Face Cropping β†’ AI Inference

// Complete preprocessing pipeline for face recognition
// Step 1: Convert YUV420 to RGB565
esp_imgfx_color_convert_process(cc_handle, &yuv420_image, &rgb565_image);

// Step 2: Correct image orientation
esp_imgfx_rotate_process(rotate_handle, &rgb565_image, &rgb565_rotated);

// Step 3: Extract face region
esp_imgfx_crop_set_cfg(crop_handle, &face_crop_cfg);
esp_imgfx_crop_process(crop_handle, &rgb565_rotated, &face_roi);

// Step 4: Ready for AI inference

Medical Image Enhancement
#

Use Case: Endoscope image detail enhancement for diagnostic assistance

// Enhance specific regions for medical diagnosis
// Original: 640x480 β†’ ROI: 200x200 β†’ Enhanced: 800x800

// Step 1: Extract region of interest
esp_imgfx_crop_cfg_t roi_cfg;
esp_imgfx_crop_get_cfg(crop_handle, &roi_cfg);
roi_cfg.cropped_res.width = 200;
roi_cfg.cropped_res.height = 200;
roi_cfg.x_pos = 220;
roi_cfg.y_pos = 140;
esp_imgfx_crop_set_cfg(crop_handle, &roi_cfg);
esp_imgfx_crop_process(crop_handle, &endoscope_image, &roi_image);

// Step 2: Enhance detail with 4x scaling
esp_imgfx_scale_cfg_t scale_cfg;
esp_imgfx_scale_get_cfg(scale_handle, &scale_cfg);
scale_cfg.scale_res.width = 800;
scale_cfg.scale_res.height = 800;
esp_imgfx_scale_set_cfg(scale_handle, &scale_cfg);
esp_imgfx_scale_process(scale_handle, &roi_image, &enhanced_image);

Multi-Display Adaptation
#

Challenge: Support various embedded display sizes (0.96" OLED to 7" industrial screens)

// Dynamic scaling for different display targets
typedef struct {
    int width, height;
    const char* name;
} display_config_t;

display_config_t displays[] = {
    {128, 64, "0.96\" OLED"},
    {320, 240, "2.4\" TFT"},
    {800, 480, "7\" Industrial"}
};

// Adaptive scaling function
void adapt_to_display(esp_imgfx_data_t* src, int display_index) {
    esp_imgfx_scale_cfg_t scale_cfg;
    esp_imgfx_scale_get_cfg(scale_handle, &scale_cfg);
    scale_cfg.scale_res.width = displays[display_index].width;
    scale_cfg.scale_res.height = displays[display_index].height;
    esp_imgfx_scale_set_cfg(scale_handle, &scale_cfg);
    esp_imgfx_scale_process(scale_handle, src, &display_buffer);
}

Performance Benchmarks
#

refer to the performance benchmarks for detailed results on processing times and resource usage.

Resources and Support
#

πŸ“š Development Resources
#

πŸ› οΈ Technical Support
#

πŸš€ Getting Started
#

  1. Install Component: idf.py add-dependency "espressif/esp_image_effects"
  2. Run Examples: Check test_apps/ directory for working examples
  3. Join Community: Share your projects and get help from developers worldwide

Conclusion
#

Designed for intelligent vision, making every frame efficient!

ESP_IMAGE_EFFECTS v1.0.0 represents a significant milestone in embedded image processing. By combining high performance with ease of use, we’re empowering developers to create sophisticated vision applications on resource-constrained devices.

Whether you’re building smart security systems, medical devices, industrial automation, or consumer electronics, ESP_IMAGE_EFFECTS provides the tools you need to process images efficiently and effectively.

Ready to transform your vision applications?

ESP_IMAGE_EFFECTS looks forward to exploring the infinite possibilities of image processing with developers worldwide. Join us in shaping the future of embedded computer vision!

Related

ESP H.264 Practical Usage Guide
·7 mins
Multimedia H.264 Performance Tuning ESP32-P4 ESP32-S3
This article introduces Espressif’s esp_h264 component, a lightweight H.264 codec optimized for embedded devices. It shows how to leverage hardware acceleration, implement efficient video processing, and optimize performance for various applications.
Introduction to ESP FOURCC
·5 mins
Multimedia ESP-GMF
This article explores ESP FOURCC standard based on FOURCC (Four Character Code), a standardized 32-bit identifier used in multimedia for format consistency, reducing conversion overhead and debugging complexity. It highlights Espressif implementation in ESP-GMF, where esp_fourcc.h defines FOURCC values for video, audio, container, image, and pixel formats, optimizing efficiency in embedded systems.
NuttX for Motor Control and Sensing: MCPWM and DC Motor Control
·12 mins
NuttX Apache ESP32 ESP32-C6 Motor IMU
This article demonstrates how to implement motor control and speed sensing on an ESP32-C6 using NuttX RTOS. It covers setting up MCPWM for motor control, ADC for potentiometer reading, and quadrature encoder for speed measurement. The implementation showcases NuttX’s real-time capabilities through a practical example using common peripherals and sensors.