public static <Input extends ImageGray<Input>, Output extends ImageGray<Output>>
	ConvolveInterface<Input,Output>
	convolve( Kernel2D kernel, Class<Input> inputType, Class<Output> outputType , BorderType borderType)
	{
		outputType = BoofTesting.convertToGenericType(outputType);

		Class<?> borderClassType = FactoryImageBorder.lookupBorderClassType((Class)inputType);
		Method m;
		try {
			switch(borderType) {
				case SKIP:
					m = ConvolveImageNoBorder.class.
							getMethod("convolve",kernel.getClass(),inputType,outputType);
					break;

				case EXTENDED:
					m = BoofTesting.findMethod(ConvolveImage.class,"convolve",kernel.getClass(),inputType,outputType,borderClassType);
					break;

				case REFLECT:
					m = BoofTesting.findMethod(ConvolveImage.class,"convolve",kernel.getClass(),inputType,outputType,borderClassType);
					break;

				case WRAP:
					m = BoofTesting.findMethod(ConvolveImage.class,"convolve",kernel.getClass(),inputType,outputType,borderClassType);
					break;

				case NORMALIZED:
					m = ConvolveImageNormalized.class.
							getMethod("convolve",kernel.getClass(),inputType,outputType);
					break;

				default:
					throw new IllegalArgumentException("Unknown border type "+ borderType);

			}
		} catch (NoSuchMethodException e) {
			throw new IllegalArgumentException("The specified convolution cannot be found");
		}

		return new GenericConvolve<>(m, kernel, borderType, ImageType.single(inputType), ImageType.single(outputType));
	}
public static < Input extends ImageGray < Input > , Output extends ImageGray < Output > > ConvolveInterface < Input , Output > convolve ( Kernel2D kernel , Class < Input > inputType , Class < Output > outputType , BorderType borderType ) { outputType = BoofTesting . convertToGenericType ( outputType ) ; Class < ? > borderClassType = FactoryImageBorder . lookupBorderClassType ( ( Class ) inputType ) ; Method m ; try { switch ( borderType ) { case SKIP : m = ConvolveImageNoBorder . class . getMethod ( "convolve" , kernel . getClass ( ) , inputType , outputType ) ; break ; case EXTENDED : m = BoofTesting . findMethod ( ConvolveImage . class , "convolve" , kernel . getClass ( ) , inputType , outputType , borderClassType ) ; break ; case REFLECT : m = BoofTesting . findMethod ( ConvolveImage . class , "convolve" , kernel . getClass ( ) , inputType , outputType , borderClassType ) ; break ; case WRAP : m = BoofTesting . findMethod ( ConvolveImage . class , "convolve" , kernel . getClass ( ) , inputType , outputType , borderClassType ) ; break ; case NORMALIZED : m = ConvolveImageNormalized . class . getMethod ( "convolve" , kernel . getClass ( ) , inputType , outputType ) ; break ; default : throw new IllegalArgumentException ( "Unknown border type " + borderType ) ; } } catch ( NoSuchMethodException e ) { throw new IllegalArgumentException ( "The specified convolution cannot be found" ) ; } return new GenericConvolve < > ( m , kernel , borderType , ImageType . single ( inputType ) , ImageType . single ( outputType ) ) ; }
Creates a filter for convolving 2D kernels along the image axis.

@param kernel Convolution kernel.
@param inputType Specifies input image type.
@param outputType Specifies input image type.
@param borderType How the image border is handled.
@return FilterInterface which will perform the specified convolution.