Skip to main content

ImageProcessing::ImageProcessor

ImageProcessing::ImageProcessor

Base interface for image processing chains. More…

#include <ImageProcessor.hpp>

Inherited by ImageProcessing::OpenCVImageProcessor

Public Functions

Name
virtual ~ImageProcessor() =default
virtual ImageDataImageData processImage(ImageDataImageData const & input_data, ImageSize const & image_size) =0
Process image data through the configured processing chain.
virtual void addProcessingStep(std::string const & key, std::function< void(void *)> processor) =0
Add a processing step to the chain.
virtual void removeProcessingStep(std::string const & key) =0
Remove a processing step from the chain.
virtual void clearProcessingSteps() =0
Clear all processing steps.
virtual bool hasProcessingStep(std::string const & key) const =0
Check if a processing step exists.
virtual size_t getProcessingStepCount() const =0
Get the number of processing steps in the chain.

Protected Functions

Name
virtual void * convertFromRaw(ImageDataImageData const & data, ImageSize const & size) =0
Convert from ImageData variant to internal format Called once at the beginning of the processing chain.
virtual ImageDataImageData convertToRaw(void * internal_data, ImageSize const & size, size_t output_type) =0
Convert from internal format back to ImageData variant Called once at the end of the processing chain.

Detailed Description

class ImageProcessing::ImageProcessor;

Base interface for image processing chains.

This abstract base class provides a framework for implementing different image processing backends while maintaining type safety and avoiding unnecessary conversions within processing chains.

The design allows for backend-specific implementations (e.g., OpenCV, SIMD, etc.) while providing a unified interface for MediaData to use.

Uses variant approach to handle both 8-bit (uint8_t) and 32-bit (float) image data.

Public Functions Documentation

function ~ImageProcessor

virtual ~ImageProcessor() =default

function processImage

virtual ImageDataImageData processImage(
    ImageDataImageData const & input_data,
    ImageSize const & image_size
) =0

Process image data through the configured processing chain.

Parameters:

  • input_data Raw image data as ImageData variant
  • image_size Dimensions of the image

Return: Processed image data as ImageData variant (same type as input)

Reimplemented by: ImageProcessing::OpenCVImageProcessor::processImage

function addProcessingStep

virtual void addProcessingStep(
    std::string const & key,
    std::function< void(void *)> processor
) =0

Add a processing step to the chain.

Parameters:

  • key Unique identifier for the processing step
  • processor Function that processes the internal image format

Reimplemented by: ImageProcessing::OpenCVImageProcessor::addProcessingStep

function removeProcessingStep

virtual void removeProcessingStep(
    std::string const & key
) =0

Remove a processing step from the chain.

Parameters:

  • key Identifier of the processing step to remove

Reimplemented by: ImageProcessing::OpenCVImageProcessor::removeProcessingStep

function clearProcessingSteps

virtual void clearProcessingSteps() =0

Clear all processing steps.

Reimplemented by: ImageProcessing::OpenCVImageProcessor::clearProcessingSteps

function hasProcessingStep

virtual bool hasProcessingStep(
    std::string const & key
) const =0

Check if a processing step exists.

Parameters:

  • key Identifier to check

Return: true if the step exists, false otherwise

Reimplemented by: ImageProcessing::OpenCVImageProcessor::hasProcessingStep

function getProcessingStepCount

virtual size_t getProcessingStepCount() const =0

Get the number of processing steps in the chain.

Return: Number of steps

Reimplemented by: ImageProcessing::OpenCVImageProcessor::getProcessingStepCount

Protected Functions Documentation

function convertFromRaw

virtual void * convertFromRaw(
    ImageDataImageData const & data,
    ImageSize const & size
) =0

Convert from ImageData variant to internal format Called once at the beginning of the processing chain.

Reimplemented by: ImageProcessing::OpenCVImageProcessor::convertFromRaw

function convertToRaw

virtual ImageDataImageData convertToRaw(
    void * internal_data,
    ImageSize const & size,
    size_t output_type
) =0

Convert from internal format back to ImageData variant Called once at the end of the processing chain.

Parameters:

  • internal_data The internal representation of the image
  • size Image dimensions
  • output_type Index indicating which variant type to output (0 for uint8_t, 1 for float)

Reimplemented by: ImageProcessing::OpenCVImageProcessor::convertToRaw


Updated on 2026-11-13 at 20:25:42 +0000