Package science.aist.imaging.api
Interface ImageFunction<IN,OUT>
-
- All Superinterfaces:
Function<ImageWrapper<IN>,ImageWrapper<OUT>>
- All Known Implementing Classes:
AdaptiveOptimalThresholdFunction
,AnisotropicDiffusionFilterFunction
,BrightnessFilter
,ColoredToGreyscaleFunction
,ColorPartsSegmentationFunction
,ColorTransformFunction
,DilateFunction
,ErodeFunction
,GammaCorrectionFunction
,GaussFilterFunction
,GenericImageFunction
,GenericMorphFunction
,HistogramEqualizationFunction
,InvertFunction
,MaskBasedEdgeDetection
,MeanFilterFunction
,NormalizeFunction
,OpenCVBackgroundSubtraction
,OpenCVBGR2GrayscaleFunction
,OpenCVBGR2HSVFunction
,OpenCVCannyEdgeDetection
,OpenCVContrastFunction
,OpenCVCropFunction
,OpenCVDistanceMap
,OpenCVGaussFilterFunction
,OpenCVInvertFunction
,OpenCVMorphologicalSkeletonFunction
,OpenCVPaddingFunction
,OpenCVPerspectiveTransformation
,OpenCVResizeFunction
,OpenCVRotateFunction
,OpenCVSharpenFunction
,OpenCVSobelEdgeDetection
,OpenCVThresholdFunction
,OpenCVTranslateFunction
,RegionGrowingFunction
,SobelEdgeDetectionFilterFunction
,ThinningFunction
,ThresholdFunction
,ToRGBFunction
,TwoByteCropFunction
,TwoByteScaleFunction
public interface ImageFunction<IN,OUT> extends Function<ImageWrapper<IN>,ImageWrapper<OUT>>
Interface for every sort of image function
This interface also provides different comfort function which are default implemented, to allow easy chaining of different functions
// Example from the PASS project, which uses OpenCVDistanceMap implementation. ImageFunction.closeAfterApply(openCVDistanceMap) .compose((Function<JavaImage, ImageWrapper<Mat>>) imageTransformer::from) .andThen(ImageFunction.closeAfterApply(GraphStructuralElementToGraphRoomTransformer::openCVDistanceMapToJava)) .apply(ji);
- Since:
- 1.0
- Author:
- Andreas Pointner
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default <X> ImageFunction<IN,X>
andThen(ImageFunction<OUT,X> after)
Chains multiple ImageFunctions.default ImageFunction<IN,OUT>
andThenCloseInput()
Closes the input image, after the apply function was executeddefault ImageFunction<IN,OUT>
andThenConsumeInput(Consumer<ImageWrapper<IN>> consumer)
This function returns a function, that execute a given consumer after the apply function for the original function was calledstatic <T extends ImageWrapper<I>,R,I>
Function<T,R>closeAfterApply(Function<T,R> function)
We do not have everywhere a ImageFunction, sometimes it is just form the type function.
-
-
-
Method Detail
-
closeAfterApply
static <T extends ImageWrapper<I>,R,I> Function<T,R> closeAfterApply(Function<T,R> function)
We do not have everywhere a ImageFunction, sometimes it is just form the type function. In those cases we need a construct, which allows us to close the image wrapper, after another function. Also closes the input function if apply throws an exception.- Type Parameters:
T
- the input type which needs to extend Java Image WrapperR
- the resultI
- the type of the wrapped element of ImageWrapper- Parameters:
function
- the function to be executed- Returns:
- a new function, which executes the function that is passed as parameter and the closes the image wrapper.
-
andThenConsumeInput
default ImageFunction<IN,OUT> andThenConsumeInput(Consumer<ImageWrapper<IN>> consumer)
This function returns a function, that execute a given consumer after the apply function for the original function was called- Parameters:
consumer
- the consumer to be executed after the accept function- Returns:
- a new function, that call the apply function of this function, then executes the consumer and the returns the result of the original function
-
andThenCloseInput
default ImageFunction<IN,OUT> andThenCloseInput()
Closes the input image, after the apply function was executed- Returns:
- a new function which closes the input of the function after it was executed
-
andThen
default <X> ImageFunction<IN,X> andThen(ImageFunction<OUT,X> after)
Chains multiple ImageFunctions. The first input function is applied and its result is passed to the after ImageFunction, which will then calculate the final result. The interim image will be automatically closed.- Type Parameters:
X
- the resulting type of the applied image functions- Parameters:
after
- the function to apply after this function is applied- Returns:
- a composed function that first applies this function and then applies the
after
function - Since:
- 1.2
-
-