public static < I extends ImageMultiBand < I > , M extends ImageMultiBand < M > , D extends ImageGray < D > > ImageGradient < I , D > gradientReduce ( ImageGradient < I , M > gradient , DerivativeReduceType type , Class < D > outputType ) { String name ; switch ( type ) { case MAX_F : name = "maxf" ; break ; default : throw new RuntimeException ( "Unknown reduce type " + type ) ; } Class middleType ; switch ( gradient . getDerivativeType ( ) . getFamily ( ) ) { case PLANAR : middleType = Planar . class ; break ; case GRAY : throw new IllegalArgumentException ( "Can't have gradient output be single band" ) ; default : middleType = gradient . getDerivativeType ( ) . getImageClass ( ) ; } Method m = findReduce ( name , middleType , outputType ) ; GradientMultiToSingleBand_Reflection < M , D > reducer = new GradientMultiToSingleBand_Reflection <> ( m , gradient . getDerivativeType ( ) , outputType ) ; return new ImageGradientThenReduce <> ( gradient , reducer ) ; }
Computes the image gradient inside a multi - band image then reduces the output to a single band before returning the results