## SciPy – 53 – elaborazione di immagini multidimensionali – 5 Continuo da qui, copio qui.

Filtri del dominio di Fourier
The functions described in this section perform filtering operations in the Fourier domain. Thus, the input array of such a function should be compatible with an inverse Fourier transform function, such as the functions from the `numpy.fft` module. We therefore have to deal with arrays that may be the result of a real or a complex Fourier transform. In the case of a real Fourier transform only half of the of the symmetric complex transform is stored. Additionally, it needs to be known what the length of the axis was that was transformed by the real fft. The functions described here provide a parameter `n` that in the case of a real transform must be equal to the length of the real transform axis before transformation. If this parameter is less than zero, it is assumed that the input array was the result of a complex Fourier transform. The parameter axis can be used to indicate along which axis the real transform was executed.

• The `fourier_shift` function multiplies the input array with the multidimensional Fourier transform of a shift operation for the given `shift`. The `shift` parameter is a sequences of shifts for each dimension, or a single value for all dimensions.
• The `fourier_gaussian` function multiplies the input array with the multidimensional Fourier transform of a Gaussian filter with given standard-deviations `sigma`. The `sigma` parameter is a sequences of values for each dimension, or a single value for all dimensions.
• The fourier_uniform function multiplies the input array with the multidimensional Fourier transform of a uniform filter with given sizes `size`. The `size` parameter is a sequences of values for each dimension, or a single value for all dimensions.
• The `fourier_ellipsoid` function multiplies the input array with the multidimensional Fourier transform of a elliptically shaped filter with given sizes `size`. The `size` parameter is a sequences of values for each dimension, or a single value for all dimensions. This function is only implemented for dimensions 1, 2, and 3.

No, niente esempi.

Funzioni di interpolazione
This section describes various interpolation functions that are based on B-spline theory. A good introduction to B-splines can be found in M. Unser, “Splines: A Perfect Fit for Signal and Image Processing,” IEEE Signal Processing Magazine, vol. 16, no. 6, pp. 22-38, November 1999.

pre-filtri per splines
Interpolation using splines of an order larger than 1 requires a pre-filtering step. The interpolation functions [here] described […] apply pre-filtering by calling `spline_filter`, but they can be instructed not to do this by setting the `prefilter` keyword equal to `False`. This is useful if more than one interpolation operation is done on the same array. In this case it is more efficient to do the pre-filtering only once and use a prefiltered array as the input of the interpolation functions. The following two functions implement the pre-filtering:

• The `spline_filter1d` function calculates a one-dimensional spline filter along the given axis. An output array can optionally be provided. The order of the spline must be larger then 1 and less than 6.
• The `spline_filter` function calculates a multidimensional spline filter.

Note: The multidimensional filter is implemented as a sequence of one-dimensional spline filters. The intermediate arrays are stored in the same data type as the output. Therefore, if an output with a limited precision is requested, the results may be imprecise because intermediate results may be stored with insufficient precision. This can be prevented by specifying a output type of high precision.

funzioni di interpolazione
Following functions all employ spline interpolation to effect some type of geometric transformation of the input array. This requires a mapping of the output coordinates to the input coordinates, and therefore the possibility arises that input values outside the boundaries are needed. This problem is solved in the same way as described in Filter functions [qui] for the multidimensional filter functions. Therefore these functions all support a mode parameter that determines how the boundaries are handled, and a `cval` parameter that gives a constant value in case that the ‘constant’ mode is used.

The `geometric_transform` function applies an arbitrary geometric transform to the input. The given mapping function is called at each point in the output to find the corresponding coordinates in the input. mapping must be a callable object that accepts a tuple of length equal to the output array rank and returns the corresponding input coordinates as a tuple of length equal to the input array rank. The output shape and output type can optionally be provided. If not given they are equal to the input shape and type.

For example: Optionally extra arguments can be defined and passed to the filter function. The `extra_arguments` and `extra_keywords` arguments can be used to pass a tuple of extra arguments and/or a dictionary of named arguments that are passed to derivative at each call. For example, we can pass the shifts in our example as arguments or Note: The mapping function can also be written in C and passed using a `scipy.LowLevelCallable`. See Extending scipy.ndimage in C [prossimamente] for more information.

The function `map_coordinates` applies an arbitrary coordinate transformation using the given array of coordinates. The shape of the output is derived from that of the coordinate array by dropping the first axis. The parameter coordinates is used to find for each point in the output the corresponding coordinates in the input. The values of coordinates along the first axis are the coordinates in the input array at which the output value is found. (See also the numarray coordinates function.) Since the coordinates may be non- integer coordinates, the value of the input at these coordinates is determined by spline interpolation of the requested order.

Here is an example that interpolates a 2D array at `(0.5, 0.5)` and `(1, 2)`: The `affine_transform` function applies an affine transformation to the input array. The given transformation matrix and offset are used to find for each point in the output the corresponding coordinates in the input. The value of the input at the calculated coordinates is determined by spline interpolation of the requested order. The transformation matrix must be two-dimensional or can also be given as a one-dimensional sequence or array. In the latter case, it is assumed that the matrix is diagonal. A more efficient interpolation algorithm is then applied that exploits the separability of the problem. The output shape and output type can optionally be provided. If not given they are equal to the input shape and type.

The `shift` function returns a shifted version of the input, using spline interpolation of the requested order.

The `zoom` function returns a rescaled version of the input, using spline interpolation of the requested order.

The `rotate` function returns the input array rotated in the plane defined by the two axes given by the parameter axes, using spline interpolation of the requested order. The angle must be given in degrees. If reshape is true, then the size of the output array is adapted to contain the rotated input. Posta un commento o usa questo indirizzo per il trackback.