PANDORE Version 6 GREYC-IMAGE

plinearrescale



Performs an affine rescaling of image using the linear interpolation.



Synopsis

plinearrescale zoomx zoomy zoomyz [im_in|-] [im_out|-]

Description

plinearrescale changes magnification of the input image by a factor zoomx along the x axis, zoomy along the y axis and zoomz along the z axis (for 3D images). The image is enlarged along an axis if the zoom factor is > 1 and is shrunk if the zoom factor is >0 and <1.

This version uses the bilinear interpolation. Bilinear interpolation considers the closest 2x2 neighborhood of known pixel values surrounding the unknown pixel:

   sx = (x/zoomx)-||x/zoomx||
   sy = (x/zoomy)-||y/zoomy||
   dx = sx - ||sx||
   dy = sy - ||sy||
   im_out[y][x] = ((1-dx) * (1-dy) * ims[b][sy][sx]
		 + (1-dx)*dy * ims[b][sy+1][sx]
		 + dx * (1y-dy) * ims[b][sy][sx+1]
		 + dx * dy * ims[b][sy+1][sx+1]);

The bilinear interpolation offers a good comprimise between time processing and result. For 2D image, a better result can be obtained with the bicubic interpolation but with greater processing time (see pbicubicrescale).

To rescale region map or graph, use the operator prescale.

Parameters

Inputs

Outputs

Result

Returns SUCCESS or FAILURE.

Examples

See also

Transformation, pbicubicrescale, prescale

C++ prototype

Errc PlinearRescale( const Img2duc &im_in, Img2duc &im_out, const float zoomy, const float zoomx );

Version française

Augmentation ou réduction de la taille d'une image par interpolation bilinéaire.


Author: Régis Clouard