cbr.ccv
Class CCVExtractor

java.lang.Object
  extended bycbr.ccv.CCVExtractor
All Implemented Interfaces:
FeatureExtractor

public class CCVExtractor
extends Object
implements FeatureExtractor

This class extracts color coherence vectors from images.

Version:
"$Id: CCVExtractor.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Volker Roth

Field Summary
protected  ArrayList activeareas_
          The array of active areas.
protected  ArrayList activespans_
          The array of active spans.
protected  ArrayList areas_
          The list of areas whose analysis is in progress.
protected  int[] coherent_
          The per color counts of coherent pixels.
protected  ArrayList freeareas_
          The array of unused areas.
protected  ArrayList freespans_
          The array of unused spans.
protected  int[] incoherent_
          The per color counts of incoherent pixels.
protected  ArrayList spans_
          The list of spans whose analysis is in progress.
protected  float tau_
          The tau value in percent of total pixel count.
 
Constructor Summary
CCVExtractor()
          Creates a fresh instance.
CCVExtractor(float tau)
          Creates a fresh instance that uses the given tau to distinguish between coherent and incoherent pixel areas.
 
Method Summary
 FeatureVector extract(byte[] px, int w, int h)
          This method extracts the CCV from a byte array of RGB222 pixels.
 FeatureVector extract(Image im)
          Extracts the color coherence vector from the given image.
 FeatureVector extract(int[] px, int width, int height)
          Extracts the color coherence vector from the given array of RGB888 pixels.
protected  void freeArea(Area area)
           
protected  Area newArea(int color, int size)
           
protected  void scan(List list, byte[] px, int off, int width)
          Fills the given list instance with the list of spans initialised from the given pixel buffer starting at the given offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

freespans_

protected ArrayList freespans_
The array of unused spans. Spans are re-used for better performance. This avoids expensive creation of objects.


freeareas_

protected ArrayList freeareas_
The array of unused areas. Areas are re-used for better performance. This avoids expensive creation of objects.


activespans_

protected ArrayList activespans_
The array of active spans.


activeareas_

protected ArrayList activeareas_
The array of active areas.


spans_

protected ArrayList spans_
The list of spans whose analysis is in progress.


areas_

protected ArrayList areas_
The list of areas whose analysis is in progress.


coherent_

protected int[] coherent_
The per color counts of coherent pixels.


incoherent_

protected int[] incoherent_
The per color counts of incoherent pixels.


tau_

protected float tau_
The tau value in percent of total pixel count. The default value is 1% (0.01).

Constructor Detail

CCVExtractor

public CCVExtractor()
Creates a fresh instance.


CCVExtractor

public CCVExtractor(float tau)
Creates a fresh instance that uses the given tau to distinguish between coherent and incoherent pixel areas. The tau value must be in the range [0,1] and stands for the minimum percentage of the overall image size in pixels that a continuous pixel area must represent in order to be classified as coherent. A good value of tau is 0,01 (1% of the image area). This is also the defaut value in case the default constructor is called.

Parameters:
tau - The tau value.
Method Detail

extract

public FeatureVector extract(Image im)
                      throws InterruptedException,
                             ImageException
Extracts the color coherence vector from the given image. The image is blurred and quantised before the vector is extracted.

Specified by:
extract in interface FeatureExtractor
Parameters:
im - The image from which the CCV is extacted.
Returns:
The color coherence vector of the given image.
Throws:
InterruptedException - if an interrupt occurs while the image's pixel data is loaded.
ImageException - if for instance the dimensions of the given image cannot be determined.

extract

public FeatureVector extract(int[] px,
                             int width,
                             int height)
Extracts the color coherence vector from the given array of RGB888 pixels. The pixels are blurred and quantised before extraction.

Specified by:
extract in interface FeatureExtractor
Parameters:
px - The byte array of RGB222 pixel values of the image from which the CCV is extracted.
Returns:
The color coherence vector of the given image.

extract

public FeatureVector extract(byte[] px,
                             int w,
                             int h)
This method extracts the CCV from a byte array of RGB222 pixels. The pixel array should already be blurred. This method is primarily called internally. It will be rarely used by an external instance but for testing purposes.

The caller has to make sure that the pixel values are in the range [0,63]. Any pixel outside this range will cause an ArrayIndexOutOfBoundsException to be thrown in the course of this method call. The easiest way to assure this range is to use the Quantizer.

Specified by:
extract in interface FeatureExtractor
Parameters:
px - The byte array of RGB222 pixel values of the image from which the CCV is extracted.
w - The width of the image in pixels.
h - The height of the image in pixels.
Returns:
The color coherence vector of the given image.

scan

protected void scan(List list,
                    byte[] px,
                    int off,
                    int width)
Fills the given list instance with the list of spans initialised from the given pixel buffer starting at the given offset. Exactly width pixels are consumed.


newArea

protected Area newArea(int color,
                       int size)

freeArea

protected void freeArea(Area area)


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.