PANDORE Version 6 | GREYC-IMAGE |
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.
if a zoom factor is > 1 then the image is enlarged along
the related axis.
if a zoom factor is < 1 then the image is shrunk along
the related axis.
(zoomz is ignored for 2D images but must be given).
Returns SUCCESS or FAILURE.
plinearrescale 2 2 0 tangram.pan a.pan
plinearrescale 0.5 0.5 0 tangram.pan a.pan
Augmentation ou réduction de la taille d'une image par interpolation bilinéaire.
Author: Régis Clouard