This module allows to extract a part of an image and to resize it to
the desired dimensions. This operation is realized using an 
interpolation~\cite{thevenaz.blu.ea:image}\cite{unser.aldroubi.ea:fast}
\index{interpolation!of an image}
\index{crop!an image}
that can be chosen with the \verb+-o+ option. The image is assumed
to be equal to a constant value $bg$ (set with the \verb+-b+ option)
outside its boundaries. Moreover, it is assumed that the image
has been sampled at the center of each pixel; that is, the value 
$in(i,j)$ corresponds to the exact value of the continuous image
at point $(i+1/2,j+1/2)$. The subpart of the original image that has
to be extracted is defined by the rectangle $(X1,Y1)-(X2,Y2)$. The user
can choose a magnification factor $z$ (using \verb+-z+ option), 
which will set the output image dimensions by rounding to the nearest 
integer the magnified input dimensions. Another possibility is to choose 
the output dimensions $sx$ and $sy$ (using the \verb+-x+ and \verb+-y+ 
options); in that case, the magnification factor will be computed 
accordingly. If only one output dimension is specified, then the other
one will be set in order to preserve the aspect ratio of the original 
region.

\medskip

{\bf \verb+-o+ option (interpolation order) :} 

\smallskip

All interpolation schemes described below are separable, so they can
be applied separately on each coordinate. Direct interpolation of 
a discrete set of value $u_k$ is defined by 
$$u(x) = \sum_k u_k \,\varphi(x-k+1/2),$$
where $\varphi$ is the interpolation function.

$\bullet$ 0: nearest-neighbor interpolation, which corresponds to direct 
interpolation with a B-spline of order 0,
$$\beta^0(x) = \left\{\begin{array}{lcl}
1       & & -1/2 \leq |x| < 1/2 \\ 
0       & & {\mathrm else}.
\end{array}\right.$$
\index{interpolation!nearest neighbor}

$\bullet$ 1: bilinear interpolation, which corresponds to direct interpolation
with a B-spline of order 1,
$$\beta^1(x) = \left\{\begin{array}{lcl}
1-|x|   & & 0 \leq |x| \leq 1 \\ 
0       & & 1 \leq |x|.
\end{array}\right.$$
\index{interpolation!bilinear}

$\bullet$ -3: direct interpolation with cubic Keys' function, defined by
$$\varphi_a(x) = \left\{\begin{array}{lcl}
(a+2)|x|^3 - (a+3)|x|^2+1       & & 0 \leq |x| \leq 1 \\ 
a|x|^3 - 5a|x|^2+8a|x|-4        & & 1 \leq |x| \leq 2 \\ 
0                               & & 2 \leq |x|.
\end{array}\right.$$
This function is $C^1$ and depends on a parameter $a \in [-1,0]$ that 
can be set with the \verb+-p+ option. Its default value, $-1/2$,
ensures an approximation order equal to 3 (instead of 2 for other
values).
\index{interpolation!Keys bicubic}

\smallskip

$\bullet$ n=3,5,7,9,11: indirect interpolation 
with the B-spline of order $n$
$$\beta^n(x) := \beta^0*\beta^{n-1}(x) =
\sum_{k=0}^{n+1}\frac{(-1)^k(n+1)}{(n+1-k)!k!}
\left(\frac{n+1}2+x-k\right)^n_+,$$
where $(x)^n_+ = \big(\max(0,x)\big)^n$.
Contrary to direct interpolation, 
indirect interpolation uses coefficients $c_k$ to define
$$u(x) = \sum_k c_k \,\varphi(x-k+1/2).$$
This set of coefficients $(c_k)$ must be computed first in order
to ensure that $u(k+1/2)=u_k$. For B-spline interpolation, this
operation is performed by the \verb+finvspline+ module.
Note that $\beta^n$ is of class $C^{n-1}$. In particular, the
cubic spline performs a better (indirect) interpolation ($C^2$ and
approximation order of 4) than the Keys cubic (direct) interpolant 
($C^1$ and approximation order of 3).
\index{interpolation!spline}
\index{B-spline}

\medskip

NB : calling this module with out=in is possible

