Class PointProviderLab
java.lang.Object
org.glavo.monetfx.internal.quantize.PointProviderLab
- All Implemented Interfaces:
PointProvider
Provides conversions needed for K-Means quantization. Converting input to points, and converting
the final state of the K-Means algorithm to colors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(double[] one, double[] two) Standard CIE 1976 delta E formula also takes the square root, unneeded here.double[]fromInt(int argb) Convert a color represented in ARGB to a 3-element array of L*a*b* coordinates of the color.inttoInt(double[] lab) Convert a 3-element array to a color represented in ARGB.
-
Constructor Details
-
PointProviderLab
public PointProviderLab()
-
-
Method Details
-
fromInt
public double[] fromInt(int argb) Convert a color represented in ARGB to a 3-element array of L*a*b* coordinates of the color.- Specified by:
fromIntin interfacePointProvider
-
toInt
public int toInt(double[] lab) Convert a 3-element array to a color represented in ARGB.- Specified by:
toIntin interfacePointProvider
-
distance
public double distance(double[] one, double[] two) Standard CIE 1976 delta E formula also takes the square root, unneeded here. This method is used by quantization algorithms to compare distance, and the relative ordering is the same, with or without a square root.This relatively minor optimization is helpful because this method is called at least once for each pixel in an image.
- Specified by:
distancein interfacePointProvider
-