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
Nested ClassesModifier and TypeClassDescriptionstatic classChannel and color operations.static classCore operations.static classFiltering operations.static classMachine learning operations.static classNormalization operations.static classAbstractImageOpto simplify the process of handling padding.static classThresholding operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ImageDataOpbuildImageDataOp(Collection<? extends ColorTransforms.ColorTransform> inputChannels) Create anImageDataOp, optionally using a specified collection of input channels.static ImageDataOpbuildImageDataOp(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 MatpadAndApply(ImageOp op, Mat mat) Apply an op after adding symmetric (reflection) padding.static MatpadAndApply(ImageOp op, Mat mat, int padType) Apply an op after adding specified padding.static voidregisterDataOp(Class<? extends ImageDataOp> cls, String label) Register anImageDataOpclass for JSON serialization/deserialization.static voidregisterOp(Class<? extends ImageOp> cls, String label) Register anImageOpclass for JSON serialization/deserialization.
-
Constructor Details
-
ImageOps
public ImageOps()
-
-
Method Details
-
registerOp
Register anImageOpclass 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 anImageDataOpclass 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 anImageServerthat generates pixels on demand from anImageDataby applying anImageDataOp.Warning! Because
ImageDataare 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- theImageDatato 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 anImageServerthat generates pixels on demand from anImageDataby applying anImageDataOp.Warning! Because
ImageDataare 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- theImageDatato 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.ColorTransformobjects 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.ColorTransformobjects 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.
-