public class GThresholdImageOps
extends java.lang.Object
ThresholdImageOps.| Constructor and Description |
|---|
GThresholdImageOps() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends boofcv.struct.image.ImageGray<T>> |
blockMean(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down)
Applies a threshold to an image by computing the mean values in a regular grid across
the input image.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
blockMinMax(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
double textureThreshold)
Applies a threshold to an image by computing the min and max values in a regular grid across
the input image.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
blockOtsu(T input,
boofcv.struct.image.GrayU8 output,
boolean otsu2,
boofcv.struct.ConfigLength width,
double tuning,
double scale,
boolean down)
Applies a threshold to an image by computing the Otsu threshold in a regular grid across
the input image.
|
static double |
computeEntropy(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes a threshold which maximizes the entropy between the foreground and background regions.
|
static int |
computeEntropy(int[] histogram,
int length,
int totalPixels)
Computes a threshold which maximizes the entropy between the foreground and background regions.
|
static double |
computeHuang(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes Huang's Minimum fyzzy thresholding from an input image.
|
static int |
computeHuang(int[] histogram,
int length)
Implements Huang's fuzzy thresholding method Uses Shannon's entropy
function (one can also use Yager's entropy function) Huang L.-K.
|
static double |
computeLi(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes Li's Minimum Cross Entropy thresholding from an input image.
|
static int |
computeLi(int[] histogram,
int length)
Implements Li's Minimum Cross Entropy thresholding method This
implementation is based on the iterative version (Ref.
|
static double |
computeOtsu(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes the variance based threshold using Otsu's method from an input image.
|
static int |
computeOtsu(int[] histogram,
int length,
int totalPixels)
Computes the variance based Otsu threshold from a histogram directly.
|
static int |
computeOtsu2(boofcv.struct.image.ImageGray input,
int minValue,
int maxValue)
Computes the variance based threshold using a modified Otsu method from an input image.
|
static int |
computeOtsu2(int[] histogram,
int length,
int totalPixels)
Computes a modified modified Otsu threshold which maximizes the distance from the distributions means.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
localGaussian(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
T work1,
boofcv.struct.image.ImageGray work2)
Thresholds the image using a locally adaptive threshold that is computed using a local square region centered
on each pixel.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
localMean(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
T work1,
T work2,
boofcv.concurrency.WorkArrays work3)
Thresholds the image using a locally adaptive threshold that is computed using a local square region centered
on each pixel.
|
static <T extends boofcv.struct.image.ImageGray<T>> |
localNick(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
float k,
boolean down)
Applies
NICK thresholding to the input image. |
static <T extends boofcv.struct.image.ImageGray<T>> |
localOtsu(T input,
boofcv.struct.image.GrayU8 output,
boolean otsu2,
boofcv.struct.ConfigLength width,
double tuning,
double scale,
boolean down) |
static <T extends boofcv.struct.image.ImageGray<T>> |
localSauvola(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
float k,
boolean down)
Applies
Sauvola thresholding to the input image. |
static <T extends boofcv.struct.image.ImageGray<T>> |
threshold(T input,
boofcv.struct.image.GrayU8 output,
double threshold,
boolean down)
Applies a global threshold across the whole image.
|
public static double computeOtsu(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes the variance based threshold using Otsu's method from an input image. Internally it uses
computeOtsu(int[], int, int) and GImageStatistics.histogram(ImageGray, double, int[])
input - Input gray-scale imageminValue - The minimum value of a pixel in the image. (inclusive)maxValue - The maximum value of a pixel in the image. (inclusive)public static int computeOtsu2(boofcv.struct.image.ImageGray input,
int minValue,
int maxValue)
Computes the variance based threshold using a modified Otsu method from an input image. Internally it uses
computeOtsu2(int[], int, int) and GImageStatistics.histogram(ImageGray, double, int[])
input - Input gray-scale imageminValue - The minimum value of a pixel in the image. (inclusive)maxValue - The maximum value of a pixel in the image. (inclusive)public static int computeOtsu(int[] histogram,
int length,
int totalPixels)
histogram - Histogram of pixel intensities.length - Number of elements in the histogram.totalPixels - Total pixels in the imagepublic static int computeOtsu2(int[] histogram,
int length,
int totalPixels)
histogram - Histogram of pixel intensities.length - Number of elements in the histogram.totalPixels - Total pixels in the imagepublic static double computeLi(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes Li's Minimum Cross Entropy thresholding from an input image. Internally it uses
computeLi(int[], int) and GImageStatistics.histogram(ImageGray, double, int[])
input - Input gray-scale imageminValue - The minimum value of a pixel in the image. (inclusive)maxValue - The maximum value of a pixel in the image. (inclusive)public static int computeLi(int[] histogram,
int length)
histogram - Histogram of pixel intensities.length - Number of elements in the histogram.public static double computeHuang(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes Huang's Minimum fyzzy thresholding from an input image. Internally it uses
computeHuang(int[], int) and GImageStatistics.histogram(ImageGray, double, int[])
input - Input gray-scale imageminValue - The minimum value of a pixel in the image. (inclusive)maxValue - The maximum value of a pixel in the image. (inclusive)public static int computeHuang(int[] histogram,
int length)
histogram - Histogram of pixel intensities.length - Number of elements in the histogram.public static double computeEntropy(boofcv.struct.image.ImageGray input,
double minValue,
double maxValue)
Computes a threshold which maximizes the entropy between the foreground and background regions. See
computeEntropy(int[], int, int) for more details.
input - Input gray-scale imageminValue - The minimum value of a pixel in the image. (inclusive)maxValue - The maximum value of a pixel in the image. (inclusive)GImageStatistics.histogram(ImageGray, double, int[])public static int computeEntropy(int[] histogram,
int length,
int totalPixels)
Computes a threshold which maximizes the entropy between the foreground and background regions. See [1] for algorithmic details, which cites [2].
[1] E.R. Davies "Machine Vision Theory Algorithms Practicalities" 3rd Ed. 2005. pg. 124
[2] Hannah, Ian, Devesh Patel, and Roy Davies. "The use of variance and entropic thresholding methods
for image segmentation." Pattern Recognition 28.8 (1995): 1135-1143.
histogram - Histogram of pixel intensities.length - Number of elements in the histogram.totalPixels - Total pixels in the imagepublic static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 threshold(T input,
boofcv.struct.image.GrayU8 output,
double threshold,
boolean down)
input - Input image. Not modified.output - (Optional) Binary output image. If null a new image will be declared. Modified.threshold - threshold value.down - If true then the inequality ≤ is used, otherwise if false then > is used.public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 localMean(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
@Nullable
T work1,
@Nullable
T work2,
@Nullable
boofcv.concurrency.WorkArrays work3)
Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel. The threshold is equal to the average value of the surrounding pixels times the scale. If down is true then b(x,y) = I(x,y) ≤ T(x,y) * scale ? 1 : 0. Otherwise b(x,y) = I(x,y) > T(x,y) * scale ? 0 : 1
NOTE: Internally, images are declared to store intermediate results. If more control is needed over memory call the type specific function.
input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.scale - Scale factor used to adjust thresholddown - Should it threshold up or down.work1 - (Optional) Internal workspace. Can be nullwork2 - (Optional) Internal workspace. Can be nullpublic static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 localGaussian(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
T work1,
boofcv.struct.image.ImageGray work2)
Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel. The threshold is equal to the gaussian weighted sum of the surrounding pixels times the scale. If down is true then b(x,y) = I(x,y) ≤ T(x,y) * scale ? 1 : 0. Otherwise b(x,y) = I(x,y) > T(x,y) * scale ? 0 : 1
NOTE: Internally, images are declared to store intermediate results. If more control is needed over memory call the type specific function.
input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.scale - Scale factor used to adjust thresholddown - Should it threshold up or down.work1 - (Optional) Internal workspace. Can be nullwork2 - (Optional) Internal workspace. Can be nullpublic static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 localOtsu(T input,
boofcv.struct.image.GrayU8 output,
boolean otsu2,
boofcv.struct.ConfigLength width,
double tuning,
double scale,
boolean down)
public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 localSauvola(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
float k,
boolean down)
Sauvola thresholding to the input image.
Intended for use with text image.input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.k - Positive parameter used to tune threshold. Try 0.3down - Should it threshold up or down.ThresholdSauvolapublic static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 localNick(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
float k,
boolean down)
NICK thresholding to the input image.
Intended for use with text image.input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.k - Positive parameter used to tune threshold. Try -0.1 to -0.2down - Should it threshold up or down.ThresholdNickpublic static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 blockMinMax(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down,
double textureThreshold)
ThresholdBlockMinMax for the details.input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.scale - Scale factor used to adjust thresholddown - Should it threshold up or down.textureThreshold - If the min and max values are within this threshold the pixel will be set to 1.public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 blockMean(T input,
boofcv.struct.image.GrayU8 output,
boofcv.struct.ConfigLength width,
double scale,
boolean down)
ThresholdBlockMean for the details.input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.scale - Scale factor used to adjust thresholddown - Should it threshold up or down.public static <T extends boofcv.struct.image.ImageGray<T>> boofcv.struct.image.GrayU8 blockOtsu(T input,
boofcv.struct.image.GrayU8 output,
boolean otsu2,
boofcv.struct.ConfigLength width,
double tuning,
double scale,
boolean down)
ThresholdBlockOtsu for the details.input - Input image.output - (optional) Output binary image. If null it will be declared internally.width - Width of square region.tuning - Tuning parameter. 0 = regular Otsudown - Should it threshold up or down.