org.shapelogic.color
Class GrayRange

java.lang.Object
  extended by org.shapelogic.color.GrayAndVariance
      extended by org.shapelogic.color.GrayRange
All Implemented Interfaces:
ColorChannels, IColorAndVariance, IColorRange, HasArea, HasPixelArea, PixelHandler
Direct Known Subclasses:
GrayEdgeArea

public class GrayRange
extends GrayAndVariance
implements IColorRange

GrayRange describes a range of colors in the Gray 8 bit.
Used for color clustering, and particle counter.

Author:
Sami Badawi

Field Summary
protected  int _colorCenter
          Color encoded in an int.
protected  IColorDistance _distance
          Distance from colorCenter that will be accepted in this Range.
protected  boolean _frozen
           
 
Fields inherited from class org.shapelogic.color.GrayAndVariance
_grayStatistic, _maxColor, _maxDistance, _minColor
 
Constructor Summary
GrayRange()
           
 
Method Summary
 boolean colorInRange(int color)
          Whether a color belong to the ColorRange.
 double distanceFromRange(int color)
          Distance of input color from this ColorRange.
 double distanceFromRangeCenter(int color)
          Distance of input color from this ColorRange.
 int getColorCenter()
           
 IColorDistance getDistance()
           
 double getMaxDistance()
           
 boolean isRangeFrozen()
          If the ColorRange can change.
 void merge(IColorAndVariance colorAndVariance)
           
 void putPixel(int x, int y, int color)
          Add the color for a given point (x,y).
 void setColorCenter(int center)
           
 void setDistance(IColorDistance distance)
           
 void setMaxDistance(double distance)
           
 
Methods inherited from class org.shapelogic.color.GrayAndVariance
getArea, getColorChannels, getMeanBlue, getMeanColor, getMeanGray, getMeanGreen, getMeanRed, getPixelArea, getStandardDeviation, setPixelArea, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.shapelogic.color.IColorAndVariance
getMeanBlue, getMeanColor, getMeanGreen, getMeanRed, getStandardDeviation
 
Methods inherited from interface org.shapelogic.color.ColorChannels
getColorChannels
 
Methods inherited from interface org.shapelogic.imageutil.HasArea
getArea
 
Methods inherited from interface org.shapelogic.imageutil.HasPixelArea
getPixelArea, setPixelArea
 

Field Detail

_distance

protected IColorDistance _distance
Distance from colorCenter that will be accepted in this Range.


_colorCenter

protected int _colorCenter
Color encoded in an int.


_frozen

protected boolean _frozen
Constructor Detail

GrayRange

public GrayRange()
Method Detail

putPixel

public void putPixel(int x,
                     int y,
                     int color)
Description copied from class: GrayAndVariance
Add the color for a given point (x,y).
The points needs to be added in sequence.

Specified by:
putPixel in interface PixelHandler
Overrides:
putPixel in class GrayAndVariance

colorInRange

public boolean colorInRange(int color)
Description copied from interface: IColorRange
Whether a color belong to the ColorRange.

Specified by:
colorInRange in interface IColorRange

distanceFromRange

public double distanceFromRange(int color)
Description copied from interface: IColorRange
Distance of input color from this ColorRange.

Specified by:
distanceFromRange in interface IColorRange

isRangeFrozen

public boolean isRangeFrozen()
Description copied from interface: IColorRange
If the ColorRange can change.

Specified by:
isRangeFrozen in interface IColorRange

getMaxDistance

public double getMaxDistance()
Specified by:
getMaxDistance in interface IColorRange

setMaxDistance

public void setMaxDistance(double distance)
Specified by:
setMaxDistance in interface IColorRange

getColorCenter

public int getColorCenter()
Specified by:
getColorCenter in interface IColorRange

setColorCenter

public void setColorCenter(int center)
Specified by:
setColorCenter in interface IColorRange

distanceFromRangeCenter

public double distanceFromRangeCenter(int color)
Description copied from interface: IColorRange
Distance of input color from this ColorRange.

Specified by:
distanceFromRangeCenter in interface IColorRange

merge

public void merge(IColorAndVariance colorAndVariance)
Specified by:
merge in interface IColorAndVariance
Overrides:
merge in class GrayAndVariance

getDistance

public IColorDistance getDistance()
Specified by:
getDistance in interface IColorRange

setDistance

public void setDistance(IColorDistance distance)
Specified by:
setDistance in interface IColorRange


Copyright © 2008. All Rights Reserved.