Package boofcv.alg.color
Class ColorLab
java.lang.Object
boofcv.alg.color.ColorLab
Conversion between RGB and CIE LAB color space. LAB color is designed to approximate human vision. L for lightness and a and b for the color-opponent dimensions, The reference white used in the conversions below is D65.
Note:
- L has a range of 0 to 100
- L = 0 is black and L* = 100 is diffuse white
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
invTran
(double t) static float
invTran
(float t) static void
labToLinearRgb
(double L, double a, double b, double[] linearRgb) Conversion from CEI LAB to gamma corrected linear RGB.static void
labToLinearRgb
(float L, float a, float b, float[] linearRgb) Conversion from CEI LAB to gamma corrected linear RGB.static void
labToRgb
(double L, double a, double b, double[] linearRgb, int[] rgb) Conversion of CEI LAB to 8-bit RGB.static void
labToRgb
(float L, float a, float b, float[] linearRgb, float[] rgb) Conversion of CEI LAB to 8-bit RGB.static void
labToRgb
(float L, float a, float b, float[] linearRgb, int[] rgb) Conversion of CEI LAB to 8-bit RGB.static <T extends ImageGray<T>>
voidConvert a 3-channelPlanar
image from LAB into RGB.static void
labToXyz
(double L, double a, double b, double[] xyz) Convert CEI LAB to CEI XYZ color spacestatic void
labToXyz
(float L, float a, float b, float[] xyz) Convert CEI LAB to CEI XYZ color spacestatic void
linearRgbToLab
(double r, double g, double b, double[] lab) Conversion from gamma corrected linear RGB into CEI LAB.static void
linearRgbToLab
(float r, float g, float b, float[] lab) Conversion from gamma corrected linear RGB into LAB.static void
rgbToLab
(double r, double g, double b, float[] lab) Conversion from 8-bit RGB into CIE LAB.static void
rgbToLab
(int r, int g, int b, double[] lab) Conversion from 8-bit RGB into CIE LAB.static void
rgbToLab
(int r, int g, int b, float[] lab) Conversion from 8-bit RGB into CIE LAB.static <T extends ImageGray<T>>
voidConvert a 3-channelPlanar
image from RGB into LAB.static void
xyzToLab
(double X, double Y, double Z, double[] lab) Convert CEI XYZ to CEI LAB color spacestatic void
xyzToLab
(float X, float Y, float Z, float[] lab) Convert CEI XYZ to CEI LAB color space
-
Field Details
-
epsilon
public static final double epsilon- See Also:
-
kappa
public static final double kappa- See Also:
-
Xr
public static final double Xr- See Also:
-
Yr
public static final double Yr- See Also:
-
Zr
public static final double Zr- See Also:
-
epsilon_f
public static final float epsilon_f- See Also:
-
kappa_f
public static final float kappa_f- See Also:
-
Xr_f
public static final float Xr_f- See Also:
-
Yr_f
public static final float Yr_f- See Also:
-
Zr_f
public static final float Zr_f- See Also:
-
-
Constructor Details
-
ColorLab
public ColorLab()
-
-
Method Details
-
rgbToLab
public static void rgbToLab(int r, int g, int b, double[] lab) Conversion from 8-bit RGB into CIE LAB. 8-bit = range of 0 to 255. -
rgbToLab
public static void rgbToLab(int r, int g, int b, float[] lab) Conversion from 8-bit RGB into CIE LAB. 8-bit = range of 0 to 255. -
rgbToLab
public static void rgbToLab(double r, double g, double b, float[] lab) Conversion from 8-bit RGB into CIE LAB. 8-bit = range of 0 to 255. -
labToRgb
public static void labToRgb(double L, double a, double b, double[] linearRgb, int[] rgb) Conversion of CEI LAB to 8-bit RGB. Converts to linearRgb and then applies gamma correction.- Parameters:
linearRgb
- (output) Workspace to store intermediate linearRgb resultsrgb
- (output) 8-bit RGB color. 0 to 255
-
labToRgb
public static void labToRgb(float L, float a, float b, float[] linearRgb, int[] rgb) Conversion of CEI LAB to 8-bit RGB. Converts to Linear RGB and then applies gamma correction.- Parameters:
linearRgb
- (output) Workspace to store intermediate linearRgb resultsrgb
- (output) 8-bit RGB color. 0 to 255
-
labToRgb
public static void labToRgb(float L, float a, float b, float[] linearRgb, float[] rgb) Conversion of CEI LAB to 8-bit RGB. Converts to Linear RGB and then applies gamma correction.- Parameters:
linearRgb
- (output) Workspace to store intermediate Linear RGB resultsrgb
- (output) 8-bit RGB color. 0 to 255
-
labToLinearRgb
public static void labToLinearRgb(float L, float a, float b, float[] linearRgb) Conversion from CEI LAB to gamma corrected linear RGB. Linear RGB values have a range of 0:1 -
labToLinearRgb
public static void labToLinearRgb(double L, double a, double b, double[] linearRgb) Conversion from CEI LAB to gamma corrected linear RGB. Linear RGB values have a range of 0:1 -
xyzToLab
public static void xyzToLab(double X, double Y, double Z, double[] lab) Convert CEI XYZ to CEI LAB color space -
xyzToLab
public static void xyzToLab(float X, float Y, float Z, float[] lab) Convert CEI XYZ to CEI LAB color space -
labToXyz
public static void labToXyz(double L, double a, double b, double[] xyz) Convert CEI LAB to CEI XYZ color space -
labToXyz
public static void labToXyz(float L, float a, float b, float[] xyz) Convert CEI LAB to CEI XYZ color space -
invTran
public static double invTran(double t) -
invTran
public static float invTran(float t) -
linearRgbToLab
public static void linearRgbToLab(double r, double g, double b, double[] lab) Conversion from gamma corrected linear RGB into CEI LAB. Normalized RGB values have a range of 0:1 -
linearRgbToLab
public static void linearRgbToLab(float r, float g, float b, float[] lab) Conversion from gamma corrected linear RGB into LAB. Normalized RGB values have a range of 0:1 -
rgbToLab
Convert a 3-channelPlanar
image from RGB into LAB. RGB is assumed to have a range from 0:255 NOTE: Input and output image can be the same instance.- Parameters:
rgb
- (Input) 8-bit RGB encoded image. R = channel 0, G = channel 1, B = channel 2lab
- (Output) LAB encoded image. L = channel 0, A = channel 1, B = channel 2
-
labToRgb
Convert a 3-channelPlanar
image from LAB into RGB. RGB will have a range from 0 to 255. NOTE: Input and output image can be the same instance.- Parameters:
lab
- (Input) LAB encoded image. L = channel 0, A = channel 1, B = channel 2rgb
- (Output) 8-bit RGB encoded image. R = channel 0, G = channel 1, B = channel 2
-