Package boofcv.alg.misc
Class GImageMiscOps
java.lang.Object
boofcv.alg.misc.GImageMiscOps
Generalized version of
ImageMiscOps
. Type checking is performed at runtime instead of at compile type.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addGaussian
(ImageBase input, Random rand, double sigma, double lowerBound, double upperBound) Adds Gaussian/normal i.i.d noise to each pixel in the image.static void
addUniform
(ImageBase input, Random rand, double min, double max) Adds uniform i.i.d noise to each pixel in the image.static void
copy
(int srcX, int srcY, int dstX, int dstY, int width, int height, ImageBase input, ImageBorder border, ImageBase output) Copies a rectangular region from one image into another.static void
copy
(int srcX, int srcY, int dstX, int dstY, int width, int height, ImageBase input, ImageBase output) Copies a rectangular region from one image into another.
output[dstX:(dstX+width) , dstY:(dstY+height-1)] = input[srcX:(srcX+width) , srcY:(srcY+height-1)]static void
Computes the mean of the absolute value of the difference between the two images.static void
Computes the mean of the absolute value of the difference between the two images.static void
fillBand
(ImageMultiBand input, int band, double value) Computes the mean of the absolute value of the difference between the two images.static void
fillBorder
(ImageBase input, double value, int radius) Fills the outside border with the specified valuestatic void
fillBorder
(ImageBase input, double value, int borderX0, int borderY0, int borderX1, int borderY1) Fills the border with independent border widths for each sidestatic void
fillGaussian
(ImageBase input, Random rand, double mean, double sigma, double lowerBound, double upperBound) Sets each value in the image to a value drawn from a Gaussian distribution.static void
fillRectangle
(ImageBase input, double value, int x0, int y0, int width, int height) Draws a filled rectangle that is aligned along the image axis inside the image.static void
fillUniform
(ImageBase input, Random rand, double min, double max) Sets each value in the image to a value drawn from an uniform distribution that has a range of min ≤ X < max.static void
fillUniformSmart
(ImageBase input, Random rand, double min, double max) Applies "smart" bounds based on image type when filling the image with uniform datastatic void
flipHorizontal
(ImageBase img) Flips the image from left to rightstatic void
flipVertical
(ImageBase img) Flips the image from top to bottomstatic <T extends ImageBase<T>>
voidgrowBorder
(T src, ImageBorder<T> border, int borderX0, int borderY0, int borderX1, int borderY1, T dst) Creates a new image which is a copy of the src image but extended with border pixels.static void
insertBand
(ImageGray input, int band, ImageMultiBand output) Computes the mean of the absolute value of the difference between the two images.static void
* Fills pixels in the image that match the mask target value image with the specified fill valuestatic void
In-place 90 degree image rotation in the counter-clockwise direction.static <T extends ImageBase<T>>
TrotateCCW
(T imageA, T imageB) Rotates the image 90 degrees in the counter-clockwise direction.static void
In-place 90 degree image rotation in the clockwise direction.static <T extends ImageBase<T>>
TrotateCW
(T imageA, T imageB) Rotates the image 90 degrees in the clockwise direction.static <T extends ImageBase<T>>
Ttranspose
(T imageA, T imageB) Transposes the image.
-
Constructor Details
-
GImageMiscOps
public GImageMiscOps()
-
-
Method Details
-
copy
public static void copy(int srcX, int srcY, int dstX, int dstY, int width, int height, ImageBase input, ImageBorder border, ImageBase output) Copies a rectangular region from one image into another. Pixels can be outside the input image.
output[dstX:(dstX+width) , dstY:(dstY+height-1)] = input[srcX:(srcX+width) , srcY:(srcY+height-1)]- Parameters:
srcX
- x-coordinate of corner in input imagesrcY
- y-coordinate of corner in input imagedstX
- x-coordinate of corner in output imagedstY
- y-coordinate of corner in output imagewidth
- Width of region to be copiedheight
- Height of region to be copiedinput
- Input imageborder
- Method used to hand pixels outside the input image borderoutput
- output image
-
copy
public static void copy(int srcX, int srcY, int dstX, int dstY, int width, int height, ImageBase input, ImageBase output) Copies a rectangular region from one image into another.
output[dstX:(dstX+width) , dstY:(dstY+height-1)] = input[srcX:(srcX+width) , srcY:(srcY+height-1)]- Parameters:
srcX
- x-coordinate of corner in input imagesrcY
- y-coordinate of corner in input imagedstX
- x-coordinate of corner in output imagedstY
- y-coordinate of corner in output imagewidth
- Width of region to be copiedheight
- Height of region to be copiedinput
- Input imageoutput
- output image
-
fill
Computes the mean of the absolute value of the difference between the two images.- Parameters:
input
- Input image. Not modified.value
- fill value
-
maskFill
* Fills pixels in the image that match the mask target value image with the specified fill value- Parameters:
input
- An image. Modified.mask
- Mask that indicates which pixels to fill. Not modified.maskTarget
- Pixels in the mask which match this value will be filled.value
- The value that the image is being filled with.
-
fill
Computes the mean of the absolute value of the difference between the two images.- Parameters:
input
- Input image. Not modified.values
- Array which contains the values each band is to be filled with.
-
fillBand
Computes the mean of the absolute value of the difference between the two images.- Parameters:
input
- An image.band
- Which band is to be filled with the specified valuevalue
- The value that the image is being filled with.
-
insertBand
Computes the mean of the absolute value of the difference between the two images.- Parameters:
input
- Single band imageband
- Which band the image is to be inserted intooutput
- The multi-band image which the input image is to be inserted into
-
fillBorder
Fills the outside border with the specified value- Parameters:
input
- An image.value
- The value that the image is being filled with.radius
- Border width.
-
fillBorder
public static void fillBorder(ImageBase input, double value, int borderX0, int borderY0, int borderX1, int borderY1) Fills the border with independent border widths for each side- Parameters:
input
- An image.value
- The value that the image is being filled with.borderX0
- Width of border on leftborderY0
- Width of border on topborderX1
- Width of border on rightborderY1
- Width of border on bottom
-
fillRectangle
public static void fillRectangle(ImageBase input, double value, int x0, int y0, int width, int height) Draws a filled rectangle that is aligned along the image axis inside the image.- Parameters:
input
- Image the rectangle is drawn in. Modifiedvalue
- Value of the rectanglex0
- Top left x-coordinatey0
- Top left y-coordinatewidth
- Rectangle widthheight
- Rectangle height
-
fillGaussian
public static void fillGaussian(ImageBase input, Random rand, double mean, double sigma, double lowerBound, double upperBound) Sets each value in the image to a value drawn from a Gaussian distribution. A user specified lower and upper bound is provided to ensure that the values are within a legal range. A drawn value outside the allowed range will be set to the closest bound.- Parameters:
input
- Input image. Modified.rand
- Random number generatormean
- Distribution's mean.sigma
- Distribution's standard deviation.lowerBound
- Lower bound of value clipupperBound
- Upper bound of value clip
-
fillUniform
Sets each value in the image to a value drawn from an uniform distribution that has a range of min ≤ X < max.- Parameters:
input
- Image which is to be filled. Modified,rand
- Random number generatormin
- Minimum value of the distribution. Inclusive.max
- Maximum value of the distribution. Inclusive.
-
fillUniformSmart
Applies "smart" bounds based on image type when filling the image with uniform data -
addGaussian
public static void addGaussian(ImageBase input, Random rand, double sigma, double lowerBound, double upperBound) Adds Gaussian/normal i.i.d noise to each pixel in the image. If a value exceeds the specified it will be set to the closest bound.- Parameters:
input
- Input image. Modified.rand
- Random number generator.sigma
- Distributions standard deviation.lowerBound
- Allowed lower boundupperBound
- Allowed upper bound
-
addUniform
Adds uniform i.i.d noise to each pixel in the image. Noise range is min ≤ X < max. -
flipVertical
Flips the image from top to bottom -
flipHorizontal
Flips the image from left to right -
transpose
Transposes the image. -
rotateCW
In-place 90 degree image rotation in the clockwise direction. Only works on square images. -
rotateCW
Rotates the image 90 degrees in the clockwise direction. -
rotateCCW
In-place 90 degree image rotation in the counter-clockwise direction. Only works on square images. -
rotateCCW
Rotates the image 90 degrees in the counter-clockwise direction. -
growBorder
public static <T extends ImageBase<T>> void growBorder(T src, ImageBorder<T> border, int borderX0, int borderY0, int borderX1, int borderY1, T dst) Creates a new image which is a copy of the src image but extended with border pixels.- Parameters:
src
- (Input) source imageborder
- (Input) image border generatorborderX0
- (Input) Border x-axis lower extentborderY0
- (Input) Border y-axis lower extentborderX1
- (Input) Border x-axis upper extentborderY1
- (Input) Border y-axis upper extentdst
- (Output) Output image. width=src.width+2*radiusX and height=src.height+2*radiusY
-