org.shapelogic.imageprocessing
Class SBColorCompare

java.lang.Object
  extended by org.shapelogic.imageprocessing.SBSimpleCompare
      extended by org.shapelogic.imageprocessing.SBColorCompare
All Implemented Interfaces:
SBPixelCompare

public class SBColorCompare
extends SBSimpleCompare

Compare implementations for RGB.

Author:
Sami Badawi

Field Summary
protected  int[] _colorChannels
           
protected  int[] _splitColorChannels
           
static int MASK
           
 
Fields inherited from class org.shapelogic.imageprocessing.SBSimpleCompare
_currentColor, _farFromReferenceColor, _maxDistance, _modifying, _slImage, bitSet, fillWithOwnColor, handledColor, mask, numberOfPixels
 
Constructor Summary
SBColorCompare()
           
 
Method Summary
 void action(int index)
          This used for changes to other images or say modify all colors to the first found.
 int colorDistance(int[] rgb1, int[] rgb2)
          split color coded as int into 3 int
 int colorDistance(int color1, int color2)
          split color coded as int into 3 int
 int getColorAsInt(int index)
           
 void grabColorFromPixel(int startX, int startY)
           
 void init(SLImage ipIn)
          Call at start, this might also work as a reset
 void setCurrentColor(int color)
           
 boolean similar(int index)
          Tells if the color at index is close enought the set color to be considered part of the segmented area.
 
Methods inherited from class org.shapelogic.imageprocessing.SBSimpleCompare
getCurrentColor, getHandledColor, getMaxDist, getNumberOfPixels, init, isFarFromReferencColor, isHandled, isModifying, newSimilar, setFarFromReferencColor, setHandled, setHandledColor, setMaxDist, setMaxDistance, setModifying
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MASK

public static final int MASK
See Also:
Constant Field Values

_colorChannels

protected int[] _colorChannels

_splitColorChannels

protected int[] _splitColorChannels
Constructor Detail

SBColorCompare

public SBColorCompare()
Method Detail

similar

public boolean similar(int index)
Tells if the color at index is close enought the set color to be considered part of the segmented area. XXX very slow split currentColor into components

Parameters:
index - to image

init

public void init(SLImage ipIn)
          throws java.lang.Exception
Description copied from class: SBSimpleCompare
Call at start, this might also work as a reset

Overrides:
init in class SBSimpleCompare
Throws:
java.lang.Exception

colorDistance

public int colorDistance(int color1,
                         int color2)
split color coded as int into 3 int


colorDistance

public int colorDistance(int[] rgb1,
                         int[] rgb2)
split color coded as int into 3 int


action

public void action(int index)
This used for changes to other images or say modify all colors to the first found.


getColorAsInt

public int getColorAsInt(int index)

setCurrentColor

public void setCurrentColor(int color)
Specified by:
setCurrentColor in interface SBPixelCompare
Overrides:
setCurrentColor in class SBSimpleCompare
Parameters:
color - The currentColor to set.

grabColorFromPixel

public void grabColorFromPixel(int startX,
                               int startY)
Specified by:
grabColorFromPixel in interface SBPixelCompare
Overrides:
grabColorFromPixel in class SBSimpleCompare


Copyright © 2009. All Rights Reserved.