Skip to main content

src/ImageProcessing/include/ImageProcessing/ProcessingOptions.hpp

src/ImageProcessing/include/ImageProcessing/ProcessingOptions.hpp

Classes

Name
struct ContrastOptions
Options structure for linear contrast/brightness transformation.
struct GammaOptions
Options structure for gamma correction.
struct SharpenOptions
Options structure for image sharpening.
struct ClaheOptions
Options structure for CLAHE (Contrast Limited Adaptive Histogram Equalization).
struct BilateralOptions
Options structure for bilateral filtering.
struct MedianOptions
Options structure for median filtering.
struct MaskDilationOptions
Options for mask dilation/erosion operations.
struct MagicEraserParams
UI-editable parameters for the magic eraser tool.
struct MagicEraserState
Runtime state for the magic eraser tool.
struct MagicEraserOptions
Combined magic eraser options for use by ImageProcessing functions.
struct ColormapOptions
Options for colormap application to grayscale images.

Types

Name
enum class ColormapType { None, Jet, Hot, Cool, Spring, Summer, Autumn, Winter, Rainbow, Ocean, Pink, HSV, Parula, Viridis, Plasma, Inferno, Magma, Turbo, Red, Green, Blue, Cyan, Magenta, Yellow}
Available colormap types for grayscale images.

Types Documentation

enum ColormapType

Enumerator Value Description
None No colormap (grayscale).
Jet Blue to red colormap.
Hot Black-red-yellow-white colormap.
Cool Cyan-magenta colormap.
Spring Magenta-yellow colormap.
Summer Green-yellow colormap.
Autumn Red-yellow colormap.
Winter Blue-cyan colormap.
Rainbow Rainbow colormap.
Ocean Dark blue to cyan colormap.
Pink Pink colormap.
HSV HSV colormap.
Parula Blue-cyan-yellow colormap.
Viridis Purple-blue-green-yellow colormap.
Plasma Purple-pink-yellow colormap.
Inferno Black-purple-yellow colormap.
Magma Black-purple-pink-yellow colormap.
Turbo Blue-cyan-green-yellow-red colormap.
Red Black to red single-channel colormap.
Green Black to green single-channel colormap.
Blue Black to blue single-channel colormap.
Cyan Black to cyan single-channel colormap.
Magenta Black to magenta single-channel colormap.
Yellow Black to yellow single-channel colormap.

Available colormap types for grayscale images.

Source code

#ifndef IMAGE_PROCESSING_OPTIONS_HPP
#define IMAGE_PROCESSING_OPTIONS_HPP

#include "CoreGeometry/ImageSize.hpp"

#include <cstdint>
#include <vector>

struct ContrastOptions {
    double alpha{1.0}; 
    int beta{0};       

    // New min/max display range parameters
    double display_min{0.0};  
    double display_max{255.0};

    void calculateAlphaBetaFromMinMax() {
        if (display_max <= display_min) {
            alpha = 1.0;
            beta = 0;
            return;
        }

        alpha = 255.0 / (display_max - display_min);
        beta = static_cast<int>(-alpha * display_min);
    }

    void calculateMinMaxFromAlphaBeta() {
        if (alpha == 0.0) {
            display_min = 0.0;
            display_max = 255.0;
            return;
        }

        display_min = -static_cast<double>(beta) / alpha;
        display_max = (255.0 - static_cast<double>(beta)) / alpha;
    }
};

struct GammaOptions {
    double gamma{1.0}; 
};

struct SharpenOptions {
    double sigma{3.0}; 
};

struct ClaheOptions {
    int grid_size{8};      
    double clip_limit{2.0};
};

struct BilateralOptions {
    int diameter{5};           
    double sigma_color{20.0};  
    double sigma_spatial{20.0};
};

struct MedianOptions {
    int kernel_size{5};
};

struct MaskDilationOptions {
    bool active{false};     
    bool preview{false};    
    int grow_size{1};       
    int shrink_size{1};     
    bool is_grow_mode{true};
};

struct MagicEraserParams {
    int brush_size{10};        
    int median_filter_size{25};
};

struct MagicEraserState {
    bool drawing_mode{false};  
    std::vector<uint8_t> mask; 
    ImageSize image_size;      
};

struct MagicEraserOptions {
    int brush_size{10};        
    int median_filter_size{25};
    bool drawing_mode{false};  
    std::vector<uint8_t> mask; 
    ImageSize image_size;      

    static MagicEraserOptions fromParamsAndState(MagicEraserParams const & params, MagicEraserState const & state) {
        return MagicEraserOptions{
                .brush_size = params.brush_size,
                .median_filter_size = params.median_filter_size,
                .drawing_mode = state.drawing_mode,
                .mask = state.mask,
                .image_size = state.image_size};
    }
};

enum class ColormapType {
    None,   
    Jet,    
    Hot,    
    Cool,   
    Spring, 
    Summer, 
    Autumn, 
    Winter, 
    Rainbow,
    Ocean,  
    Pink,   
    HSV,    
    Parula, 
    Viridis,
    Plasma, 
    Inferno,
    Magma,  
    Turbo,  
    // Single-color channel mappings
    Red,    
    Green,  
    Blue,   
    Cyan,   
    Magenta,
    Yellow  
};

struct ColormapOptions {
    ColormapType colormap{ColormapType::None};
    double alpha{1.0};                        
    bool normalize{true};                     
};

#endif// IMAGE_PROCESSING_OPTIONS_HPP

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