Fast rescaling code for gray level images.
Fast rescaling code for gray level images. This class augments the base class GScaler with a function for rescaling gray level images. Function scale computes an arbitrary segment of the output image given the corresponding pixels in the input image.Example --- The following functions returns an gray level image (sixteen gray levels, size nw by nh) containing a rescaled version of the input image
GBitmap *rescale_bitmap(const GBitmap &in, int nw, int nh) { int w = in.columns(); // Get input width int h = in.raws(); // Get output width GBitmapScaler scaler(w,h,nw,nh); // Creates bitmap scaler GRect desired(0,0,nw,nh); // Desired output = complete bitmap GRect provided(0,0,w,h); // Provided input = complete bitmap GBitmap *out = new GBitmap; scaler.scale(provided, in, desired, *out); // Rescale out->change_grays(16); // Reduce to 16 gray levels return out; }
set_input_size and set_output_size. The
size of the output image is given by outw and outh. .
GBitmapScaler(int inw, int inh, int outw, int outh)
void scale( const GRect &provided_input, const GBitmap &input, const GRect &desired_output, GBitmap &output )
Alphabetic index HTML hierarchy of classes or Java