ConvertConfig Class

Definition

Namespace: P1.ImageSdk

Defines a set of RAW convertion- and filter-flags, that can be applied to a raw-image More…

public class ConvertConfig

Remarks

Defines a set of RAW convertion- and filter-flags, that can be applied to a raw-image

This class let you raw convert an IIQ raw-image. Use it to setup decoding and convertion options, before actual triggering the convertion with ApplyTo.

You can also apply different filters to the image, including scaling and cropping. You should note that the order the filters are applied is fixed. You cannot define any ordering on your own.

Any applied cropping or resizing dimensions might not be followed 100% by resampling algorithm. The resulting image might differ with a few pixels. Always check the output dimensions, and do not assume your image has the crop you requested.

Simple one-liner raw convertion and scaling var bitmap = new ConvertConfig().SetScale(0.25).AppleTo(new RawImage (“some-file.iiq”));

See also:

RawImage.Convert

Constructors

ConvertConfig()

Creates a new raw convertion config object

Members

outputImage

Trigger processing of the applied options on the raw-buffer and return a new image as an RGB bitmap

ExposureRange

The value range of the Exposure property.

ContrastRange

The value range of the Contrast property.

BrightnessRange

The value range of the Brightness property.

SaturationRange

The value range of the Saturation property.

ShadowRecoveryRange

The value range of the ShadowRecovery property.

HighlightRecoveryRange

The value range of the HighlightRecovery property.

BlackLevelRange

The value range of the BlackLevel property.

WhiteLevelRange

The value range of the WhiteLevel property.

MidtoneLevelRange

The value range of the MidtoneLevel property.

CurveInOutRange

The value range of the X and Y field of each element of the curve type properties.

ClarityMethodRange

The value range of the Method field of the Clarity property.

ClarityFactorRange

The value range of the Factor field of the Clarity property.

SharpeningAmountRange

The value range of the amount of sharpening gain.

SharpeningRadiusRange

The value range of radius of sharpening algorithm.

SharpeningThresholdRange

The value range of the threshold for noise reduction.

HaloSuppressionAmountRange

The value range of the amount of halo suppresion in sharpening

LuminanceNoiseReductionAmountRange

The value range of the LuminanceNoiseReductionAmount property.

ColorNoiseReductionAmountRange

The value range of the ColorNoiseReductionAmount property.

WhiteBalanceGainRange

The value range of the RGB channels of the White Balance Gain property.

GeometricCorrectionFocalLengthRange

The value range of the FocalLength field of the GeometricCorrection property.

GeometricCorrectionPixelPitchRange

The value range of the PixelSize field of the GeometricCorrection property.

GeometricCorrectionShiftRange

The value range of the xp, yp fields of the GeometricCorrection property.

GeometricCorrectionPolinomRange

The value range of the k1, k2, k3, p1, p2 fields of the GeometricCorrection property.

GeometricCorrectionAffinityRange

The value range of the b1, b2 fields of the GeometricCorrection property.

Properties

Exposure

Adjust the exposure of the image

Contrast

Adjust the contrast of the image.

Brightness

Adjust the brightness of the image

Saturation

Adjust the saturation of the image

HighlightRecovery

Used to extract details only in the highlights of the image by reducing the brightness of highlight pixels.

ShadowRecovery

Used to extract details only in the shadows of the image by making them brighter.

BlackLevel

Set the level used for black. This is a color that black color is mapped into (as in a level tool)

BlackLevelTarget

Set the target level used for black. This is a color that black color is mapped into (as in a level tool)

MidtoneLevel

Set the midtone level. This is a color that is used as 50% level of the color values

WhiteLevel

Set the level used for white. This is a color that white color is mapped into (as in a level tool)

WhiteLevelTarget

Set the level used for white target. This is a color that white color is mapped into (as in a level tool)

RedCurve

Set the curve for red values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

GreenCurve

Set the curve for green values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

Gain

Set image gain. TODO TNT

BlueCurve

Set the curve for blue values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

LumaCurve

Set the curve for luma values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

RGBCurve

Set the curve for rgb values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

WhiteBalanceGain

The White Balance as gain for each channels (RGB). The valid range of each individual channel is between 0.0f and 10.0f.

WhiteBalanceMode

Clarity

Setup the clarity tool. Its used as a tool to help control the local contrast in the image.

LuminanceNoiseReductionAmount

The strength of the luminocity noise reduction. The value is between 0.0 and 1.0. Default is 0.0

NoiseReductionSinglePixel

Remove spike noise which may occure in high ISO captures

ColorNoiseReductionAmount

The strength of the color noise reduction. The value is between 0.0 and 1.0. Default is 0.0

SharpeningAmount

Adjust the amount of sharpening of the image. SharpeningAmount is a value between 0.0 and 10.0. Default is 0.0

SharpeningRadius

Patch size for detecting detail, value between 0 and 3. Default is 1.0

SharpeningThreshold

Defines noise level or weak detail, which will be ignored. Value between 0 and 10. Default is 1.0.

HaloSuppressionAmount

Amount of halo suppression, value between 0 and 1. Default is 0.0

GeometricCorrectionEnabled

A Boolean value indicating if the conversion will include Geometric Aberration correction

GeometricCorrectionCompensationEnabled

A Boolean value indicating if the conversion will include Compensation of Geometric Aberration correction

GeometricCompensationPressure

User can inject pressure value to be used for environmental compensetation

GeometricCorrection

Custom Geometric Aberration correction parameter set. If geometricCorrection is set to an invalid value, the the conversion will try to load the geometric correction data embedded in the source IIQ file

LightFalloffCorrectionEnabled

A Boolean value indicating if the conversion will include Lens Light falloff correction for recognized lenses

DualExposureOutput

Setting that defines how to handle dual exposure

EnableLinearPath

Set EnableLinearPath setting. This setting is used to disable most of the processing steps to make sure that the debayering of the image into rgb domain is done only using a simple linear mapping enabling only the minimum needed processing.

PolynomialTransform

Set Polynomial transformation on bayer data. Six parametters are: ax, bx, cx, ay, by, cy. Range of x and y is [0, Width] and [0, height]

PolynomialTransformNormalized

Set Polynomial transformation on bayer data. Six parametters are: ax, bx, cx, ay, by, cy. Range of x and y is [0, 1]

Orientation

ChromaticAberrationCorrectionEnabled

A Boolean value indicating if the conversion will include Chromatic Aberration (CA) correction

ExposureWarningMaskEnabled

Control generation of exposure mask in the mask image. True means enable. Default is disabled. When doing the actual convertion of an image - a mask buffer must be provided. If enabled the ExposureWarningThresholdOver and ExposureWarningThresholdUnder must be set in advance

ExposureWarningThresholdOver

Set the value of the overexposed warning settings used when exposure mask generation is enabled. ExposeWarningThresholdOver is a value between 0.0 and 1.0 so it is independend oof the bitdepth of the image

ExposureWarningThresholdUnder

Set the value of the underexposed warning settings used when exposure mask generation is enabled. ExposeWarningThresholdUnder is a value between 0.0 and 1.0 so it is independend oof the bitdepth of the image

ClipWarningMaskEnabled

enable the clip warning mask. For this setting to be used the mask image must be enabled and provided when processing the image

ClipWarningCount

Set the minimum required count of neighbour pixels that must be outside the threshold limits to be set in the clip warning mask. For this to take effect the mask image must be enabled . ClipWarningCount is a value between 1 and 8.

CanvasClip

Configures the Canvas Clipping for the conversion

Crop

The cropping configuration of the outpu

OutputScaleFactor

The scaling factor of the output image if set.

OutputWidth

The width of the output image if set.

OutputHeight

The height of the output image if set.

Methods

Clone()

Creates a clone of the current ConvertConfig, which can be modified independently of the current object

GetDiscretizedRedCurve(int numDiscretizedPoints)

Get the curve used by internal ImageSDK

GetDiscretizedGreenCurve(int numDiscretizedPoints)

Get the curve used by internal ImageSDK

GetDiscretizedBlueCurve(int numDiscretizedPoints)

Get the curve used by internal ImageSDK

GetDiscretizedLumaCurve(int numDiscretizedPoints)

Get the curve used by internal ImageSDK

GetDiscretizedRgbCurve(int numDiscretizedPoints)

Get the curve used by internal ImageSDK

SetOutputFormat(BitmapFormat format)

Set the pixel format for the output image.

OutputFormat()

Gets the current configured pixel format, that this config object will produce

SetOutputColorSpace(ColorSpace colorspace)

Set the pixel format for the output image.

OutputColorSpace()

The color space of the output image

SetCanvasClip(CanvasClip canvasClip)

Sets the CanvasClip property

SetCrop(int x, int y, int width, int height)

Configure for cropping the raw-image

SetCrop(Rect cropRect)

Configure for cropping the raw-image

ResetCrop()

Reset (remove) any applied crop

ResetOutputScaling()

Convenience method to reset (remove) any scaling.

SetOutputScale(double scaleFactor)

Configure scaling of the raw-image

SetOutputWidth(int destinationWidth)

Configures the output scaling using an absolute output width. Height is automatically calculated from the aspect ratio.

SetOutputHeight(int destinationHeight)

Configures the output scaling using an absolute output height. Width is automatically calculated from the aspect ratio.

SetContrast(float contrast)

Adjust the contrast of the image

SetBrightness(float brightness)

Adjust the brightness of the image

SetSaturation(float saturation)

Adjust the saturation of colors in the image

SetExposure(float exposure)

Adjust th exposure of the image. This is doing almost the same as the SetGain but using an exponential function.

SetPolynomialTransformation(float ax, float bx, float cx, float ay, float by, float cy)

Gain image nonlinearly. See PolynomialTransform

SetPolynomialTransformationNormalized(float ax, float bx, float cx, float ay, float by, float cy)

Gain image nonlinearly. See PolynomialTransformNormalized

SetGain(float gain)

Adjust the gain of the image. This is doing almost the same as SetExposure but just as a linear gain value.

SetBlackLevel(float r, float g, float b)

Set the black level. This is a color that is regarded as black as in the level tool of most image editors

SetBlackLevelTarget(float r, float g, float b)

Set the black level target. This is a color that is regarded as black as in the level tool of most image editors

SetMidtoneLevel(float r, float g, float b)

Set the midtone level. This is a color that is used as 50% level of the color values. Known from the level tool of most image editors

SetWhiteLevel(float r, float g, float b)

Set the white level. This is a color that is regarded as white. Known from the level tool of most image editors

SetWhiteLevelTarget(float r, float g, float b)

Set the white level target. This is a color that is regarded as white. Known from the level tool of most image editors

SetSharpening(float amount, float radius, float threshold, float haloAmount)

Adjust the parameters of sharpening of the image.

SetLuminanceNoiseReductionAmount(float luminanceNoiseReductionAmount)

Sets the strength of the Luminance Noise Reduction algorithm to reduce noise.

SetNoiseReductionSinglePixelEnabled(bool noiseReductionSinglePixelEnabled)

Toggles Single Pixel noise reduction to eliminate hot pixels

SetColorNoiseReductionAmount(float colorNoiseReductionAmount)

Sets the strength of the Color Noise Reduction algorithm to reduce noise.

SetClarity(int clarityMethod, float clarityFactor)

Setup the clarity tool. Its used as a tool to help control the local contrast in the image. A negative value will decrease local contrast and and positive increase it. Its a combination of selecting a method and a factor (amount)

SetShadowRecovery(float shadowRecovery)

Set shadow recovery. Used to extract details only in the shadows of the image by making them brighter.

SetHighlightRecovery(float highlightRecovery)

Set highlight recovery. Used to extract details only in the highlights of the image by reducing the brightness of highlight pixels.

SetWhiteBalanceGain(float redGain, float greenGain, float blueGain)

Sets the White Balance as gain for each channels (RGB)

SetWhiteBalanceMode(WhiteBalanceMode mode)

Sets the White Balance mode

SetGeometricCorrectionEnabled(bool enabled)

Sets the Enabled state of the Geometric Aberration correction

SetGeometricCorrection(GeometricCorrection geometricCorrection)

Sets Geometric Aberration correction parameters to be applied.

SetGeometricCorrectionCompensationEnabled(bool enabled)

Sets the Enabled to allow to compensation Geometric Aberration for environmental variables

SetGeometricCorrectionCompensationPressure(float pressure)

Inject a value for the environmental pressure variable used for compensation of Geometric Aberration

SetEnableLinearPath(bool enabled)

Set EnableLinearPath setting. This setting is used to disable most of the processing steps to make sure that the debayering of the image into rgb domain is done only using a simple linear mapping enabling only the minimum needed processing.

SetOrientation(OrientationMode orientation)

SetDualExposureOutput(DualExposureOutput mode)

SetExposureMaskThreshold(float overExposureThreshold, float underExposureThreshold)

Threshold for exposure mask

SetMaskThresholdClipWarningCount(int count)

Threshold for clipping count

SetRedCurve(Point2D[] points)

Set the curve for red values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

SetGreenCurve(Point2D[] points)

Set the curve for green values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

SetBlueCurve(Point2D[] points)

Set the curve for blue values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

SetLumaCurve(Point2D[] points)

Set the curve for luma values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

SetRgbCurve(Point2D[] points)

Set the curve for rgb values as known from the curves tool in most image editors. The curve is defined as a vector of discreete coordinate pairs (x,y) that is interpolated.

SaveToFile(string filePath)

Stores the ConvertConfig object to a persisted model located at filePath

Serialize()

Returns a serialized JSON representation of the ConvertConfig object

ApplyTo(RawImage image, Func< UInt32, byte[]> allocFunction=null)

Trigger processing of the applied options on the raw-image and return a new image as an RGB bitmap

ApplyTo(RawImage image, ref BitmapImage maskImage, Func< UInt32, byte[]> allocFunction=null)

Trigger processing of the applied options on the raw-image and return a new image as an RGB bitmap

LoadFromFile(string filePath)

Creates a ConvertConfig object from a persisted model located at filePath

Deserialize(string json)

Creates a ConvertConfig object from a well-formed JSON string

Discretize(Point2D[] points, UInt16 bits)

Returns a list of ‘Y’ values of the Curve defined by the input Points. This is applicable for the RGB/LumaCurve)