class P1::ImageSdk::GainMaskGenerator#

Overview#

Represents a generator for gain masks based on a reference image. More…

#include <P1ImageGainMaskGenerator.hpp>

class GainMaskGenerator
{
public:
    // methods

    void SetMaskType(MaskingType type);
    MaskingType GetMaskingType();
    void SetMaskScaleFactor(float scale);
    float GetMaskScaleFactor();
    void SetEnableDustFix(bool enable);
    bool GetEnableDustFix();
    void ComputeGainMask(RawImage& image, std::string gainMaskPath);
};

Detailed Documentation#

Represents a generator for gain masks based on a reference image.

The resulting gain mask can be used to correct uneven lighting and remove dust artifacts from other images captured with the same camera under similar conditions.

Methods#

void SetMaskType(MaskingType type)

Sets which image channels to use for gain mask generation.

Parameters:

type

The masking type to use: MaskingType::Luma for luma (grayscale), or MaskingType::Separate_RGB to process each RGB channel individually.

MaskingType GetMaskingType()

Gets the current masking type used for gain mask generation.

Returns:

The current MaskingType in use: MaskingType::Luma or MaskingType::Separate_RGB.

void SetMaskScaleFactor(float scale)

Sets the scale factor used to resize the reference image during gain mask generation.

A larger scale produces a larger mask, resulting in stronger correction, but it may also increase sensitivity to noise or image artifacts.

Parameters:

scale

A scale factor between 0 and 1. A typical recommended value is 0.02.

float GetMaskScaleFactor()

Gets the current scale factor used for resizing the reference image during gain mask generation.

Returns:

The scale factor, which is a value between 0 and 1.

void SetEnableDustFix(bool enable)

Enables or disables the dust correction feature during gain mask generation.

This option is disabled by default.

Parameters:

enable

  • true to enable dust correction.

  • false to disable dust correction.

bool GetEnableDustFix()

Gets whether the dust correction feature is currently enabled.

Returns:

  • true if dust correction is enabled.

  • false if dust correction is disabled.

void ComputeGainMask(RawImage& image, std::string gainMaskPath)

Generates a gain mask based on the provided reference image and saves it to the specified file path.

Parameters:

image

The reference IIQ image (grayscale) used for gain mask generation.

gainMaskPath

The file system path where the generated gain mask will be saved.