Interface ImageOp

All Superinterfaces:
All Known Implementing Classes:

public interface ImageOp extends UriResource
An operation that may be applied to a Mat.

This is intended to apply simple transforms to an image (e.g. color transforms, channel extraction, filtering, normalization), which may impact the number and type of image channels - but not other aspects of the image, with the exception of removing any padding.

Operations may be chained

  • Method Details

    • apply

      Mat apply(Mat input)
      Apply operation to the image. The input may be modified (and the operation applied in-place), therefore should be duplicated if a copy is required to be kept.

      Note that any non-empty padding will be removed, potentially giving an output image smaller than the input. If this is not desirable use ImageOps.padAndApply(ImageOp, Mat).

      input - input image
      output image, which may be the same as the input image
      See Also:
    • getPadding

      default Padding getPadding()
      Get the padding requested for this operation. The default is to return Padding.empty().

      Subclasses that perform neighborhood operations should override this. If the padding is non-empty, it will be removed when apply(Mat) is called - and so the Mat that is output will be smaller than the Mat that was input.

      the padding requested by this operation
    • getChannels

      default List<ImageChannel> getChannels(List<ImageChannel> channels)
      Get appropriate channels to reflect the output of this transform. The default is to return the input list unchanged.

      Classes that change the meaning or number of channels should override this. In particular, the number of channels in the output list should match the number of channels output by this transformer, given the input channels.

      channels -
    • getOutputType

      default PixelType getOutputType(PixelType inputType)
      Get the output pixel type. The default is to return the pixel type unchanged.
      inputType - the input pixel type
      the output pixel type
    • getURIs

      default Collection<URI> getURIs() throws IOException
      Default implementation returns an empty list; classes should override this if necessary.
      Specified by:
      getURIs in interface UriResource
      the required URIs
    • updateURIs

      default boolean updateURIs(Map<URI,URI> replacements) throws IOException
      Default implementation makes no changes; classes should override this if necessary.
      Specified by:
      updateURIs in interface UriResource
      replacements - replacement map, where the key gives the current URI and the value gives its replacement.
      true if URIs were changed, false otherwise