net.sourceforge.jiu.color.reduction
Class ReduceToBilevelThreshold
public class ReduceToBilevelThreshold
Reduces a
GrayIntegerImage to a
BilevelImage by setting all values below
a certain threshold value to black and everything else to white.
Default value
If no threshold is specified via
setThreshold(int), this operation
uses a default value of (
IntegerImage.getMaxSample(int) + 1) / 2.
Usage example
This example sets all values below 33 percent luminance to black,
everything else to white.
GrayIntegerImage image = ...;
ReduceToBilevelThreshold red = new ReduceToBilevelThreshold();
red.setInputImage(image);
red.setThreshold(image.getMaxSample(0) / 3);
red.process();
BilevelImage reducedImage= (BilevelImage)red.getOutputImage();
threshold
private Integer threshold
getThreshold
public Integer getThreshold()
Returns the current threshold value, or null if
none was specified and the operation's process method was not
run yet.
setThreshold
public void setThreshold(int newThreshold)
Sets a new threshold value.
newThreshold - the new threshold value to be used for this operation