@Reference(type=Article, author="Nobuyuki Otsu", title="A Threshold Selection Method from Gray-Level Histograms", year="1979", journal="Systems, Man and Cybernetics, IEEE Transactions on", pages={"62","66"}, number="1", volume="9", customData={"keywords","Displays;Gaussian distribution;Histograms;Least squares approximation;Marine vehicles;Q measurement;Radar tracking;Sea measurements;Surveillance;Target tracking","doi","10.1109/TSMC.1979.4310076","ISSN","0018-9472"}) public class OtsuThreshold extends Object implements ImageProcessor<FImage>
Constructor and Description |
---|
OtsuThreshold()
Default constructor
|
OtsuThreshold(int numBins)
Construct with the given number of histogram bins
|
Modifier and Type | Method and Description |
---|---|
static float |
calculateThreshold(FImage img,
int numBins)
Estimate the threshold for the given image.
|
static float |
calculateThreshold(float[] data,
int numBins)
Estimate the threshold for the given data.
|
static FloatFloatPair |
calculateThresholdAndVariance(float[] data,
int numBins)
Estimate the threshold and inter-class variance for the given data.
|
static FloatFloatPair |
computeThresholdAndVarianceFromHistogram(int[] histData,
int total)
Estimate the threshold and inter-class variance for the given histogram.
|
static float |
computeThresholdFromHistogram(int[] histData,
int total)
Estimate the threshold for the given histogram.
|
protected static int[] |
makeHistogram(FImage fimg,
int numBins) |
protected static int[] |
makeHistogram(float[] data,
int numBins,
float min,
float max) |
void |
processImage(FImage image)
Process an image.
|
public OtsuThreshold()
public OtsuThreshold(int numBins)
numBins
- the number of histogram binsprotected static int[] makeHistogram(FImage fimg, int numBins)
protected static int[] makeHistogram(float[] data, int numBins, float min, float max)
public static float calculateThreshold(FImage img, int numBins)
img
- the imagenumBins
- the number of histogram binspublic static float calculateThreshold(float[] data, int numBins)
Internally, the data will be min-max normalised before the histogram is
built, and the specified number of bins will cover the entire
max-min
range. The returned threshold will have
min
added to it to return it to the original range.
data
- the datanumBins
- the number of histogram binspublic static FloatFloatPair calculateThresholdAndVariance(float[] data, int numBins)
Internally, the data will be min-max normalised before the histogram is
built, and the specified number of bins will cover the entire
max-min
range. The returned threshold will have
min
added to it to return it to the original range.
data
- the datanumBins
- the number of histogram binspublic static float computeThresholdFromHistogram(int[] histData, int total)
histData
- the histogramtotal
- the total number of items in the histogrampublic static FloatFloatPair computeThresholdAndVarianceFromHistogram(int[] histData, int total)
histData
- the histogramtotal
- the total number of items in the histogrampublic void processImage(FImage image)
ImageProcessor
Image.internalAssign(Image)
.processImage
in interface ImageProcessor<FImage>
image
- The image to process in place.