public static <T extends ImageGray<T>>T average(ImageInterleaved input , T output ) {
		ImageDataType type = input.getImageType().getDataType();
		if( type == ImageDataType.U8) {
			return (T)ConvertImage.average((InterleavedU8)input,(GrayU8)output);
		} else if( type == ImageDataType.S8) {
			return (T)ConvertImage.average((InterleavedS8)input,(GrayS8)output);
		} else if( type == ImageDataType.U16 ) {
			return (T)ConvertImage.average((InterleavedU16)input,(GrayU16)output);
		} else if( type == ImageDataType.S16 ) {
			return (T)ConvertImage.average((InterleavedS16)input,(GrayS16)output);
		} else if( type == ImageDataType.S32 ) {
			return (T)ConvertImage.average((InterleavedS32)input,(GrayS32)output);
		} else if( type == ImageDataType.S64 ) {
			return (T)ConvertImage.average((InterleavedS64)input,(GrayS64)output);
		} else if( type == ImageDataType.F32 ) {
			return (T)ConvertImage.average((InterleavedF32)input,(GrayF32)output);
		} else if( type == ImageDataType.F64 ) {
			return (T)ConvertImage.average((InterleavedF64)input,(GrayF64)output);
		} else {
			throw new IllegalArgumentException("Unknown image type: " + type);
		}
	}
public static < T extends ImageGray < T > > T average ( ImageInterleaved input , T output ) { ImageDataType type = input . getImageType ( ) . getDataType ( ) ; if ( type == ImageDataType . U8 ) { return ( T ) ConvertImage . average ( ( InterleavedU8 ) input , ( GrayU8 ) output ) ; } else if ( type == ImageDataType . S8 ) { return ( T ) ConvertImage . average ( ( InterleavedS8 ) input , ( GrayS8 ) output ) ; } else if ( type == ImageDataType . U16 ) { return ( T ) ConvertImage . average ( ( InterleavedU16 ) input , ( GrayU16 ) output ) ; } else if ( type == ImageDataType . S16 ) { return ( T ) ConvertImage . average ( ( InterleavedS16 ) input , ( GrayS16 ) output ) ; } else if ( type == ImageDataType . S32 ) { return ( T ) ConvertImage . average ( ( InterleavedS32 ) input , ( GrayS32 ) output ) ; } else if ( type == ImageDataType . S64 ) { return ( T ) ConvertImage . average ( ( InterleavedS64 ) input , ( GrayS64 ) output ) ; } else if ( type == ImageDataType . F32 ) { return ( T ) ConvertImage . average ( ( InterleavedF32 ) input , ( GrayF32 ) output ) ; } else if ( type == ImageDataType . F64 ) { return ( T ) ConvertImage . average ( ( InterleavedF64 ) input , ( GrayF64 ) output ) ; } else { throw new IllegalArgumentException ( "Unknown image type: " + type ) ; } }
Converts a {@link Planar} into a {@link ImageGray} by computing the average value of each pixel
across all the bands.

@param input Input Planar image that is being converted. Not modified.
@param output (Optional) The single band output image.  If null a new image is created. Modified.
@return Converted image.