Class ImageOps
ImageOp
and ImageDataOp
objects.
The Gson types in v0.2.0 are subject to change in later version. Specifically, each category will likely have an additional part to the subtype. This is currently the case with "core", but not other subtypes.
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Channel and color operations.static class
Core operations.static class
Filtering operations.static class
Machine learning operations.static class
Normalization operations.static class
AbstractImageOp
to simplify the process of handling padding.static class
Thresholding operations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImageDataOp
buildImageDataOp
(Collection<? extends ColorTransforms.ColorTransform> inputChannels) Create anImageDataOp
, optionally using a specified collection of input channels.static ImageDataOp
buildImageDataOp
(ColorTransforms.ColorTransform... inputChannels) Create anImageDataOp
, optionally using a specified array of input channels.static ImageDataServer
<BufferedImage> buildServer
(ImageData<BufferedImage> imageData, ImageDataOp dataOp, PixelCalibration resolution) static ImageDataServer
<BufferedImage> buildServer
(ImageData<BufferedImage> imageData, ImageDataOp dataOp, PixelCalibration resolution, int tileWidth, int tileHeight) static Mat
padAndApply
(ImageOp op, Mat mat) Apply an op after adding symmetric (reflection) padding.static Mat
padAndApply
(ImageOp op, Mat mat, int padType) Apply an op after adding specified padding.static void
registerDataOp
(Class<? extends ImageDataOp> cls, String label) Register anImageDataOp
class for JSON serialization/deserialization.static void
registerOp
(Class<? extends ImageOp> cls, String label) Register anImageOp
class for JSON serialization/deserialization.
-
Constructor Details
-
ImageOps
public ImageOps()
-
-
Method Details
-
registerOp
Register anImageOp
class for JSON serialization/deserialization.Labels should typically be all lowercase and begin with "op." and include "ext" if the op is added via an extension.
For example, an "op.threshold.ext.triangle" would be a suitable label for an op added via an extension to apply a threshold using the triangle method.
- Parameters:
cls
- the op to register; this must be compatible with JSON serialization.label
- an identifying label; that this must be unique. If it does not start with "op." a warning will be logged.
-
registerDataOp
Register anImageDataOp
class for JSON serialization/deserialization.Labels should typically be all lowercase and begin with "data.op." and include "ext" if the op is added via an extension.
- Parameters:
cls
- the op to register; this must be compatible with JSON serialization.label
- an identifying label; that this must be unique. If it does not start with "data.op." a warning will be logged.
-
buildServer
public static ImageDataServer<BufferedImage> buildServer(ImageData<BufferedImage> imageData, ImageDataOp dataOp, PixelCalibration resolution) Build anImageServer
that generates pixels on demand from anImageData
by applying anImageDataOp
.Warning! Because
ImageData
are mutable, this can potentially result in inconsistencies if a change is made that impacts the behavior of the op while tiles are still being requested.- Parameters:
imageData
- theImageData
to wrapdataOp
- the op performing pixel transformationsresolution
- the resolution at which the op should be applied- Returns:
- the
ImageDataServer
-
buildServer
public static ImageDataServer<BufferedImage> buildServer(ImageData<BufferedImage> imageData, ImageDataOp dataOp, PixelCalibration resolution, int tileWidth, int tileHeight) Build anImageServer
that generates pixels on demand from anImageData
by applying anImageDataOp
.Warning! Because
ImageData
are mutable, this can potentially result in inconsistencies if a change is made that impacts the behavior of the op while tiles are still being requested.- Parameters:
imageData
- theImageData
to wrapdataOp
- the op performing pixel transformationsresolution
- the resolution at which the op should be appliedtileWidth
- the tile width for the servertileHeight
- the tile height of the server- Returns:
- the
ImageDataServer
-
buildImageDataOp
Create anImageDataOp
, optionally using a specified array of input channels.- Parameters:
inputChannels
- array ofColorTransforms.ColorTransform
objects used to extract the pixels that will form the channels of the outputMat
. If empty, the original image channels will be used.- Returns:
- the
ImageDataOp
-
buildImageDataOp
public static ImageDataOp buildImageDataOp(Collection<? extends ColorTransforms.ColorTransform> inputChannels) Create anImageDataOp
, optionally using a specified collection of input channels.- Parameters:
inputChannels
- array ofColorTransforms.ColorTransform
objects used to extract the pixels that will form the channels of the outputMat
. If empty, the original image channels will be used.- Returns:
- the
ImageDataOp
-
padAndApply
Apply an op after adding specified padding.This is useful when applying padded ops to Mats directly, rather than via an
ImageDataOp
. Because the op will strip off any padding, callingop.apply(mat)
directly often results in a smaller output than the input image. Using this method instead gives an output image that is the same size as the input.- Parameters:
op
- the op to applymat
- the image to processpadType
- the OpenCV boundary padding type- Returns:
- the result of applying the op to the input image; note that this is often a modified version of the input image itself, since many ops work in-place.
- See Also:
-
padAndApply
Apply an op after adding symmetric (reflection) padding.This is useful when applying padded ops to Mats directly, rather than via an
ImageDataOp
. Because the op will strip off any padding, calling op.apply(mat) directly often results in a smaller output than the input image. Using this method instead gives an output image that is the same size as the input.- Parameters:
op
- the op to applymat
- the image to process- Returns:
- the result of applying the op to the input image; note that this is often a modified version of the input image itself, since many ops work in-place.
-