Class BinaryAccumulator

java.lang.Object
  extended byBinaryAccumulator

public class BinaryAccumulator
extends java.lang.Object

BinaryAccumulator Class

This class represents a two-dimensional array of integer.


Constructor Summary
BinaryAccumulator(int N)
          Creates a N wide binary accumulator
 
Method Summary
 RectInt findBestRelatedComponent(Accumulator acc, double threshold)
          Finds the best related component.
 int get(int x, int y)
          Returns the value of the square at (i,j)
 void init()
          Sets every squares to zero
 void labelling(int x, int y, int label)
          Recursive method that finds a related component including a square of the binary accumulator.
 void makeBinary(Accumulator Acc, double threshold)
          Updates the binary accumulator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryAccumulator

public BinaryAccumulator(int N)
Creates a N wide binary accumulator

Method Detail

init

public void init()
Sets every squares to zero


get

public int get(int x,
               int y)
Returns the value of the square at (i,j)


makeBinary

public void makeBinary(Accumulator Acc,
                       double threshold)
Updates the binary accumulator. The value "1" is set in each square of the binary accumulator corresponding to a square of the accumulator which have a value higher than threshold multiply by the highest accumulator square value

Parameters:
Acc - an accumulator with the same dimension than the binary accumulator
threshold - the threshold

findBestRelatedComponent

public RectInt findBestRelatedComponent(Accumulator acc,
                                        double threshold)
Finds the best related component. The first stage is an appeal to the "init" method. The second is an appeal to the "makeBinary" method. The third isolate each related component ("labelling" method). The fourth finds the rectangle including each related component. the fifth finds the rectangle with the best squares average.


labelling

public void labelling(int x,
                      int y,
                      int label)
Recursive method that finds a related component including a square of the binary accumulator. The detection is based on squares with the "1" value.

Parameters:
x - the X-coordinate of the square
y - the Y-coordinate of the square
label - the value set in the squares of the related component