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

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.

NoiseReductionRadiusRange

The value range of the NoiseReductionRadius 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, 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)

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)

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.

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.

Clarity

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

NoiseReductionRadius

The pixel radius used for the Noise Reduction algorithm to sample neighbouring pixels to reduce noise. The value is between 0 and 32. Default is 0.

SharpeningAmount

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

GeometricCorrectionEnabled

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

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

HistogramStage

Request in which stage of the processing pipeline a histogram must be sampled (its mainly used for debugging). Default is to not sample a histogram.

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.

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 underexposed threshold and overexposed threshold should also be set

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

SetOutputFormat(BitmapFormat format)

Set the pixel format for the output image.

OutputFormat()

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

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.

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

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

SetSharpeningAmount(float sharpeningAmount)

Adjust the amount of sharpening of the image.

SetNoiseReductionRadiusAmount(int noiseReductionRadius)

Sets the pixel radius used for the 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)

SetGeometricCorrectionEnabled(bool enabled)

Sets the Enabled state of the Geometric Aberration correction

SetGeometricCorrection(GeometricCorrection geometricCorrection)

Sets Geometric Aberration correction parameters to be applied.

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.

SetHistogramStage(HistogramStage stage)

Request in which stage of the processing pipeline a histogram must be sampled (its mainly used for debugging). Default is to not sample a histogram Its a combination of selecting a method and a factor (amount)

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

newFromFile(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)