org.shapelogic.color
Class ColorDistance1

java.lang.Object
  extended by org.shapelogic.color.ColorDistance1
All Implemented Interfaces:
IColorDistance
Direct Known Subclasses:
ColorDistance1RGB, ColorDistanceWithImage1

public class ColorDistance1
extends java.lang.Object
implements IColorDistance

ColorNorm is the scaled 1 norm in the color space.
The 1 norm is called the Taxicab norm or Manhattan norm.
It is then scaled down by the number of dimensions, so that the distance of 2 colors will be the same in gray and RGB space.

This could be changed to use scaling for the different component.

This should work for both color and gray.

Author:
Sami Badawi

Field Summary
protected  int _referenceColor
           
static ColorDistance1 INSTANCE
           
 
Constructor Summary
ColorDistance1()
           
 
Method Summary
 double distance(ColorChannels colorV1, ColorChannels colorV2)
           
 double distance(int[] color1, int[] color2)
           
 double distance(int color1, int color2)
           
 double distanceToReferenceColor(int color)
           
static ColorDistance1 getInstance()
           
 void setReferenceColor(int color)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static ColorDistance1 INSTANCE

_referenceColor

protected int _referenceColor
Constructor Detail

ColorDistance1

public ColorDistance1()
Method Detail

distance

public double distance(ColorChannels colorV1,
                       ColorChannels colorV2)
Specified by:
distance in interface IColorDistance

distance

public double distance(int[] color1,
                       int[] color2)
Specified by:
distance in interface IColorDistance

getInstance

public static ColorDistance1 getInstance()

distance

public double distance(int color1,
                       int color2)
Specified by:
distance in interface IColorDistance

distanceToReferenceColor

public double distanceToReferenceColor(int color)
Specified by:
distanceToReferenceColor in interface IColorDistance

setReferenceColor

public void setReferenceColor(int color)
Specified by:
setReferenceColor in interface IColorDistance


Copyright © 2009. All Rights Reserved.