Class PointProviderLab

java.lang.Object
org.glavo.monetfx.internal.quantize.PointProviderLab
All Implemented Interfaces:
PointProvider

public final class PointProviderLab extends Object implements 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distance(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.
    int
    toInt(double[] lab)
    Convert a 3-element array to a color represented in ARGB.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      fromInt in interface PointProvider
    • toInt

      public int toInt(double[] lab)
      Convert a 3-element array to a color represented in ARGB.
      Specified by:
      toInt in interface PointProvider
    • 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:
      distance in interface PointProvider