Package boofcv.alg.filter.binary
Class ThresholdImageOps
java.lang.Object
boofcv.alg.filter.binary.ThresholdImageOps
Operations for thresholding images and converting them into a binary image.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic GrayU8
localGaussian
(GrayF32 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayF32 storage1, @Nullable GrayF32 storage2) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
localGaussian
(GrayU16 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayU16 storage1, @Nullable GrayU16 storage2) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
localGaussian
(GrayU8 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayU8 storage1, @Nullable GrayU8 storage2) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
localMean
(GrayF32 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayF32 storage1, @Nullable GrayF32 storage2, @Nullable GrowArray<DogArray_F32> storage3) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
localMean
(GrayU16 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayU16 storage1, @Nullable GrayU16 storage2, @Nullable GrowArray<DogArray_I32> storage3) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
localMean
(GrayU8 input, @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable GrayU8 storage1, @Nullable GrayU8 storage2, @Nullable GrowArray<DogArray_I32> storage3) Thresholds the image using a locally adaptive threshold that is computed using a local square region centered on each pixel.static GrayU8
Applies a global threshold across the whole image.static GrayU8
Applies a global threshold across the whole image.static GrayU8
Applies a global threshold across the whole image.static GrayU8
Applies a global threshold across the whole image.static GrayU8
Applies a global threshold across the whole image.static GrayU8
Applies a global threshold across the whole image.
-
Constructor Details
-
ThresholdImageOps
public ThresholdImageOps()
-
-
Method Details
-
threshold
public static GrayU8 threshold(GrayF32 input, @Nullable @Nullable GrayU8 output, float threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
threshold
public static GrayU8 threshold(GrayF64 input, @Nullable @Nullable GrayU8 output, double threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
threshold
public static GrayU8 threshold(GrayU8 input, @Nullable @Nullable GrayU8 output, int threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
threshold
public static GrayU8 threshold(GrayS16 input, @Nullable @Nullable GrayU8 output, int threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
threshold
public static GrayU8 threshold(GrayU16 input, @Nullable @Nullable GrayU8 output, int threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
threshold
public static GrayU8 threshold(GrayS32 input, @Nullable @Nullable GrayU8 output, int threshold, boolean down) Applies a global threshold across the whole image. If 'down' is true, then pixels with values <= to 'threshold' are set to 1 and the others set to 0. If 'down' is false, then pixels with values > to 'threshold' are set to 1 and the others set to 0.- Parameters:
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.- Returns:
- Output image.
-
localMean
public static GrayU8 localMean(GrayU8 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayU8 storage1, @Nullable @Nullable GrayU8 storage2, @Nullable @Nullable GrowArray<DogArray_I32> storage3) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-
localGaussian
public static GrayU8 localGaussian(GrayU8 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayU8 storage1, @Nullable @Nullable GrayU8 storage2) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-
localMean
public static GrayU8 localMean(GrayU16 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayU16 storage1, @Nullable @Nullable GrayU16 storage2, @Nullable @Nullable GrowArray<DogArray_I32> storage3) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-
localGaussian
public static GrayU8 localGaussian(GrayU16 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayU16 storage1, @Nullable @Nullable GrayU16 storage2) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-
localMean
public static GrayU8 localMean(GrayF32 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayF32 storage1, @Nullable @Nullable GrayF32 storage2, @Nullable @Nullable GrowArray<DogArray_F32> storage3) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-
localGaussian
public static GrayU8 localGaussian(GrayF32 input, @Nullable @Nullable GrayU8 output, ConfigLength width, float scale, boolean down, @Nullable @Nullable GrayF32 storage1, @Nullable @Nullable GrayF32 storage2) 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) * scale > T(x,y) ? 0 : 1- Parameters:
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 threshold. Try 0.95down
- Should it threshold up or down.storage1
- (Optional) Storage for intermediate step. If null will be declared internally.storage2
- (Optional) Storage for intermediate step. If null will be declared internally.- Returns:
- Thresholded image.
-