TransformToGrayscaleOp

public class TransformToGrayscaleOp

Transforms an image to GrayScale as an image processing unit.

Supported color spaces:

The conversion is based on OpenCV RGB to GRAY conversion https://docs.opencv.org/master/de/d25/imgproc_color_conversions.html#color_convert_rgb_gray

Public Constructors

TransformToGrayscaleOp()
Creates a TransformToGrayscaleOp.

Public Methods

TensorImage
apply(TensorImage image)
Applies the transformation to grayscale and returns a TensorImage.
int
getOutputImageHeight(int inputImageHeight, int inputImageWidth)
Computes the height of the expected output image when input image size is given.
int
getOutputImageWidth(int inputImageHeight, int inputImageWidth)
Computes the width of the expected output image when input image size is given.
PointF
inverseTransform(PointF point, int inputImageHeight, int inputImageWidth)
Transforms a point from coordinates system of the result image back to the one of the input image.

Inherited Methods

Public Constructors

public TransformToGrayscaleOp ()

Creates a TransformToGrayscaleOp.

Public Methods

public TensorImage apply (TensorImage image)

Applies the transformation to grayscale and returns a TensorImage.

If the input image is already ColorSpaceType.GRAYSCALE, this op will be a no-op.

Parameters
image

public int getOutputImageHeight (int inputImageHeight, int inputImageWidth)

Computes the height of the expected output image when input image size is given.

Parameters
inputImageHeight
inputImageWidth

public int getOutputImageWidth (int inputImageHeight, int inputImageWidth)

Computes the width of the expected output image when input image size is given.

Parameters
inputImageHeight
inputImageWidth

public PointF inverseTransform (PointF point, int inputImageHeight, int inputImageWidth)

Transforms a point from coordinates system of the result image back to the one of the input image.

Parameters
point the point from the result coordinates system.
inputImageHeight the height of input image.
inputImageWidth the width of input image.
Returns
  • the point with the coordinates from the coordinates system of the input image.