CVB.Net 14.0
ConvertColorSpace Class Reference

Color space conversions supported by the Foundation Package. More...

Classes

struct  ColorTwistMatrix
 Matrix defining color transformations. More...
 

Static Public Member Functions

static Image TwistColors (Image img, ColorTwistMatrix matrix)
 Apply the given matrix to the given img . More...
 
static Image ToRGB (Image img)
 Convert the input image to RGB. More...
 
static Image ToRGBFrom (Image img, ColorModel assumedColorModel)
 Convert the input image to RGB. More...
 
static Image ToYUV (Image img)
 Convert the input image to YUV. More...
 
static Image ToYCbCr (Image img)
 Convert the input image to YCbCr. More...
 
static Image ToCieXYZ (Image img)
 Convert the input image to CIE XYZ. More...
 
static Image ToCieLUV (Image img)
 Convert the input image to CIE LUV. More...
 
static Image ToCieLab16 (Image img)
 Convert the input image to CIE Lab with DataTypes.Int16BppUnsigned for better precision. More...
 
static Image ToCieLab8 (Image img)
 Convert the input image to CIE Lab with DataTypes.Int8BppUnsigned. More...
 
static Image ToYCC (Image img)
 Convert the input image to YCC. More...
 
static Image ToHLS (Image img)
 Convert the input image to HLS. More...
 
static Image ToHSV (Image img)
 Convert the input image to HSV. More...
 
static Image ToMono (Image img, MonochromeConversion conversion)
 Convert the input image to mono. More...
 
static Image ToMono (Image img)
 Convert the input image to mono. More...
 
static Image ToMono (Image img, double weightR, double weightG, double weightB)
 Convert the input image to mono. More...
 
static Image SwapChannels (Image img, int[] newArrangement)
 Create a new image by rearranging the planes of the input image. More...
 

Detailed Description

Color space conversions supported by the Foundation Package.

Member Function Documentation

◆ SwapChannels()

static Image SwapChannels ( Image  img,
int[]  newArrangement 
)
static

Create a new image by rearranging the planes of the input image.

This method differs from ImagePlaneCollection.Map(IEnumerable<int>) in that this creates a new interleaved image buffer instead of just giving a new view on the data.

Parameters
imgInput image.
newArrangementArray that defines the new plane arrangement. For example for an RGB image, the array [2,1,0] would cause the image planes to be rearranged to BGR plane order.
Returns
New transformed image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToCieLab16()

static Image ToCieLab16 ( Image  img)
static

Convert the input image to CIE Lab with DataTypes.Int16BppUnsigned for better precision.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToCieLab8()

static Image ToCieLab8 ( Image  img)
static

Convert the input image to CIE Lab with DataTypes.Int8BppUnsigned.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToCieLUV()

static Image ToCieLUV ( Image  img)
static

Convert the input image to CIE LUV.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToCieXYZ()

static Image ToCieXYZ ( Image  img)
static

Convert the input image to CIE XYZ.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToHLS()

static Image ToHLS ( Image  img)
static

Convert the input image to HLS.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToHSV()

static Image ToHSV ( Image  img)
static

Convert the input image to HSV.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToMono() [1/3]

static Image ToMono ( Image  img)
static

Convert the input image to mono.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToMono() [2/3]

static Image ToMono ( Image  img,
double  weightR,
double  weightG,
double  weightB 
)
static

Convert the input image to mono.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
weightRWeight (multiplier) for the red channel
weightGWeight (multiplier) for the green channel
weightBWeight (multiplier) for the blue channel
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToMono() [3/3]

static Image ToMono ( Image  img,
MonochromeConversion  conversion 
)
static

Convert the input image to mono.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
conversionWeighting method to apply
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToRGB()

static Image ToRGB ( Image  img)
static

Convert the input image to RGB.

Parameters
imgInput image.
Returns
New converted image.
Exceptions
InvalidCastExceptionIf the input image has an unknown/inconvertible color model
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToRGBFrom()

static Image ToRGBFrom ( Image  img,
ColorModel  assumedColorModel 
)
static

Convert the input image to RGB.

This method differs from ToRGB(Image) in that if the color model is ColorModel.RGBGuess instead assumedColorModel is used.

With that you can build your own images consisting of the desired color space and convert it to RGB.

Parameters
imgInput image.
assumedColorModelIn cases where the color model of the input image is not known (indicated by the value ColorModel.RGBGuess), the source image's color model should be assumed to be the one provided in assumedColorModel .
Returns
New converted image.
Exceptions
InvalidCastExceptionIf the input image has an unknown/inconvertible color model
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToYCbCr()

static Image ToYCbCr ( Image  img)
static

Convert the input image to YCbCr.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToYCC()

static Image ToYCC ( Image  img)
static

Convert the input image to YCC.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ ToYUV()

static Image ToYUV ( Image  img)
static

Convert the input image to YUV.

If the input image is something other than RGB, an internal conversion to RGB happens, increasing the processing time accordingly.

Parameters
imgImage to be converted.
Returns
New converted image.
Exceptions
ArgumentNullExceptionIf the input img is null
ObjectDisposedExceptionIf the input img has already been disposed

◆ TwistColors()

static Image TwistColors ( Image  img,
ColorTwistMatrix  matrix 
)
static

Apply the given matrix to the given img .

Parameters
imgImage to apply the matrix to
matrixMatrix defining the color twist transformation.
Returns
Transformed image