public static GrayU8 convert(ImageGray input , double min , double max , int numValues , GrayU8 output )
	{
		// see if it can use the faster straight forward convert
		if( min == 0 && max == 255 && numValues == 256 ) {
			if( output == null )
				output = new GrayU8(input.width,input.height);
			convert(input,output);
			return output;
		}

		ImageDataType type = input.getImageType().getDataType();
		if( type == ImageDataType.U8) {
			return ConvertImage.convert((GrayU8)input,(int)min,(int)max,numValues,output);
		} else if( type == ImageDataType.S8) {
			return ConvertImage.convert((GrayS8)input,(int)min,(int)max,numValues,output);
		} else if( type == ImageDataType.U16 ) {
			return ConvertImage.convert((GrayU16)input,(int)min,(int)max,numValues,output);
		} else if( type == ImageDataType.S16 ) {
			return ConvertImage.convert((GrayS16)input,(int)min,(int)max,numValues,output);
		} else if( type == ImageDataType.S32 ) {
			return ConvertImage.convert((GrayS32)input,(int)min,(int)max,numValues,output);
		} else if( type == ImageDataType.S64 ) {
			return ConvertImage.convert((GrayS64)input,(long)min,(long)max,numValues,output);
		} else if( type == ImageDataType.F32 ) {
			return ConvertImage.convert((GrayF32)input,(float)min,(float)max,numValues,output);
		} else if( type == ImageDataType.F64 ) {
			return ConvertImage.convert((GrayF64)input,min,max,numValues,output);
		} else {
			throw new IllegalArgumentException("Unknown image type: " + type);
		}
	}
public static GrayU8 convert ( ImageGray input , double min , double max , int numValues , GrayU8 output ) { if ( min == 0 && max == 255 && numValues == 256 ) { if ( output == null ) output = new GrayU8 ( input . width , input . height ) ; convert ( input , output ) ; return output ; } ImageDataType type = input . getImageType ( ) . getDataType ( ) ; if ( type == ImageDataType . U8 ) { return ConvertImage . convert ( ( GrayU8 ) input , ( int ) min , ( int ) max , numValues , output ) ; } else if ( type == ImageDataType . S8 ) { return ConvertImage . convert ( ( GrayS8 ) input , ( int ) min , ( int ) max , numValues , output ) ; } else if ( type == ImageDataType . U16 ) { return ConvertImage . convert ( ( GrayU16 ) input , ( int ) min , ( int ) max , numValues , output ) ; } else if ( type == ImageDataType . S16 ) { return ConvertImage . convert ( ( GrayS16 ) input , ( int ) min , ( int ) max , numValues , output ) ; } else if ( type == ImageDataType . S32 ) { return ConvertImage . convert ( ( GrayS32 ) input , ( int ) min , ( int ) max , numValues , output ) ; } else if ( type == ImageDataType . S64 ) { return ConvertImage . convert ( ( GrayS64 ) input , ( long ) min , ( long ) max , numValues , output ) ; } else if ( type == ImageDataType . F32 ) { return ConvertImage . convert ( ( GrayF32 ) input , ( float ) min , ( float ) max , numValues , output ) ; } else if ( type == ImageDataType . F64 ) { return ConvertImage . convert ( ( GrayF64 ) input , min , max , numValues , output ) ; } else { throw new IllegalArgumentException ( "Unknown image type: " + type ) ; } }
Converts pixel values in the input image into an integer values from 0 to numValues.
@param input Input image
@param min minimum input pixel value, inclusive
@param max maximum input pixel value, inclusive
@param numValues Number of possible pixel values in output image
@param output (Optional) Storage for the output image.  Can be null.
@return The converted output image.