Package inra.ijpb.morphology.strel
Class LocalExtremumBufferGray8
java.lang.Object
inra.ijpb.morphology.strel.LocalExtremumBufferGray8
- All Implemented Interfaces:
LocalExtremum
public class LocalExtremumBufferGray8 extends java.lang.Object implements LocalExtremum
Computes the maximum in a local buffer around current point.
This implementation considers a circular buffer (when a value is added, it replaces the first value that was inserted) that makes it possible to update extrema if needed.
Works only for Grayscale images coded between 0 and 255.
- Author:
- David Legland
-
Nested Class Summary
Nested classes/interfaces inherited from interface inra.ijpb.morphology.strel.LocalExtremum
LocalExtremum.Type
-
Constructor Summary
Constructors Constructor Description LocalExtremumBufferGray8(int n)
Main constructor.LocalExtremumBufferGray8(int n, int value)
Initializes an histogram filled with the given value.LocalExtremumBufferGray8(int n, LocalExtremum.Type type)
Constructor from size and type of extremum (minimum or maximum). -
Method Summary
Modifier and Type Method Description void
add(int value)
Adds a value to the local histogram, and update bounds if needed.void
clear()
Resets inner counts with default maximal integer values (Integer.MIN_VALUE for MAX, Integer.MAX_VALUE for MIN)void
fill(int value)
Resets histogram by considering it is filled with the given value.int
getMax()
Returns the maximum value stored in this local histogramvoid
setMinMaxSign(int sign)
Changes the sign used for distinguishing minimum and maximum.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LocalExtremumBufferGray8
public LocalExtremumBufferGray8(int n)Main constructor.- Parameters:
n
- the size of the buffer
-
LocalExtremumBufferGray8
Constructor from size and type of extremum (minimum or maximum).- Parameters:
n
- the size of the buffertype
- the type of extremum (maximum or minimum)
-
LocalExtremumBufferGray8
public LocalExtremumBufferGray8(int n, int value)Initializes an histogram filled with the given value.- Parameters:
n
- the size of the buffervalue
- the initial value of all elements in buffer
-
-
Method Details
-
setMinMaxSign
public void setMinMaxSign(int sign)Changes the sign used for distinguishing minimum and maximum.- Parameters:
sign
- +1 for maximum, -1 for minimum
-
add
public void add(int value)Adds a value to the local histogram, and update bounds if needed. Then removes the last stored value, and update bounds if needed.- Parameters:
value
- the value to add
-
clear
public void clear()Resets inner counts with default maximal integer values (Integer.MIN_VALUE for MAX, Integer.MAX_VALUE for MIN) -
fill
public void fill(int value)Resets histogram by considering it is filled with the given value. Update max and max accordingly.- Parameters:
value
- the new value of all elements in buffer
-
getMax
public int getMax()Returns the maximum value stored in this local histogram- Returns:
- the maximum value in neighborhood
-