Maven module :un.api : api-image :
Class : un.impl.image.process.detection.HaarFilter
Extends/Implements : -
Subclasses : -

/*
This source code has been placed into the public domain.


Variables : -
Functions : HaarFilter, HaarFilter, getIterations, getFractionalBits, setIterations, setFractionalBits, filter, invert, filterToImage, valuesToImage




Constructs a new object for performing filtering. Individual filtering
instances are constructed to operate on data of a predetermined size. All
arrays passed to a filter must have a length which corresponds to the
size specified at construction (specifically size x size).
param  size the length of the side of all squares of data/filter values
public void HaarFilter (int size)


Constructs a new object for performing filtering. Individual filtering
instances are constructed to operate on data of a predetermined size. All
arrays passed to a filter must have a length which corresponds to the
size specified at construction (specifically size x size). See

@see #setIterations(int) for information about the iterations parameter
@see #setFractionalBits(int) for information about the fractionalBits
parameter

@param size the length of the side of all squares of data/filter values
@param iterations the number of iterations performed during filtering, or
-1 to use the default value
@param fractionalBits the number of binary fractional bits in the number
representation used in filters, or -1 to use the default value
public void HaarFilter (int size, int iterations, int fractionalBits)


The number of iterations that will be applied during a call to the
filter method.

@see #setIterations(int) for more information

@return the number of iterations performed during filtering, never
negative
public int getIterations ()


The number of fractional bits that will be used in the filtered values
returned by the filter method.
see  #setFractionalBits(int) for more information
return  the number of binary fractional bits in the number representation
used in filters, never negative
public int getFractionalBits ()


Specifies the number of times that the Haar wavelet is successively
applied during a call to the filter method. This cannot
exceed ln2(size). This maximum forms the sensible default value and can
be specified by passing a negative number to this method.
param  iterations the number of iterations performed during filtering, or -1 for the
default value
public void setIterations (int iterations)


Specifies the number of bits in the integers returned by the
filter method that represent fractions of a whole number. If
fractionalBits is not zero, these bits will form the least significant
bits of the integers. Due to the size constraints that arise from
arithmetic on ints the number of fractional bits cannot
exceed 23. The sensible default value for the number of fractional bits
is twice the number of iterations; this default can be specified by
passing a negative number to this method.

@param fractionalBits the number of binary fractional bits in the number
representation used in filters, or -1 for the default value
public void setFractionalBits (int fractionalBits)


Filters the byte values supplied by applying the Haar wavelet for a
number of iterations and stores the result in the specified integer
array. If no filter array is supplied then a new array is created. The
values returned may have been scaled to accomodate fractional bits.
param  values a byte array of length containing the values to be
filtered, not null
param  filter an array which is to contain the filter values, or null
return  the array which contains the filter values
public int[] filter (byte[] values, int[] filter)


/*
NOTE: As indicated, this implementation has not been thoroughly tested.
In particular, it might be possible that this method could overflow when
inverting large filters. I have not yet had the time to prove otherwise.
public byte[] invert (int[] filter, byte[] values)


A utility method for converting filter values generated by this object
into an TYPE_BYTE_GRAY BufferedImage. If the
fractionalBits parameter of this object has been modified
since the filter was created then the image may not be accurately
generated.

@param filter an array containing the filter values, not null
@return the generated image
public Image filterToImage (int[] filter)


A utility method for converting data values into an
TYPE_BYTE_GRAY BufferedImage.

@param values an array containing the data values, not null
@return the generated image
public Image valuesToImage (byte[] values)