freqfilt: VIPS Reference Manual

## freqfilt freqfilt — fourier transforms and frequency-domin filters |

## Stability Level

Stable, unless otherwise indicated

## Functions

int | vips_fwfft ()
int | vips_invfft ()
int | vips_freqmult ()
int | vips_spectrum ()
int | vips_phasecor ()

## Includes

    #include <vips/vips.h>

## Description

To and from Fourier space, filter in Fourier space, convert Fourier-space images to a displayable form.

## Functions

### vips_fwfft ()

    int
    vips_fwfft (VipsImage *in,
                VipsImage **out,
                ...);

Transform an image to Fourier space.

VIPS uses the fftw Fourier Transform library. If this library was not available when VIPS was configured, these functions will fail.

See also: `vips_invfft()`.

[method]

#### Parameters

in | input image |
out | output image. | [out]
... | `NULL`-terminated list of optional named arguments |

#### Returns

0 on success, -1 on error.

### vips_invfft ()

    int
    vips_invfft (VipsImage *in,
                 VipsImage **out,
                 ...);

Optional arguments:

- `real` : only output the real part

Transform an image from Fourier space to real space. The result is complex. If you are OK with a real result, set `real` , it's quicker.

VIPS uses the fftw Fourier Transform library. If this library was not available when VIPS was configured, these functions will fail.

See also: `vips_fwfft()`.

[method]

#### Parameters

in | input image |
out | output image. | [out]
... | `NULL`-terminated list of optional named arguments |

#### Returns

0 on success, -1 on error.

### vips_freqmult ()

    int
    vips_freqmult (VipsImage *in,
                   VipsImage *mask,
                   VipsImage **out,
                   ...);

Multiply `in` by `mask` in Fourier space.

`in` is transformed to Fourier space, multipled with `mask` , then transformed back to real space. If `in` is already a complex image, just multiply then inverse transform.

See also: `vips_invfft()`, `vips_mask_ideal()`.

[method]

#### Parameters

in | input image |
mask | mask image |
out | output image. | [out]
... | `NULL`-terminated list of optional named arguments |

#### Returns

0 on success, -1 on error.

### vips_spectrum ()

    int
    vips_spectrum (VipsImage *in,
                   VipsImage **out,
                   ...);

Make a displayable (ie. 8-bit unsigned int) power spectrum.

If `in` is non-complex, it is transformed to Fourier space. Then the absolute value is passed through `vips_scale()` in log mode, and `vips_wrap()`.

See also: `vips_fwfft()`, `vips_scale()`, `vips_wrap()`.

[method]

#### Parameters

in | input image |
out | output image. | [out]
... | `NULL`-terminated list of optional named arguments |

#### Returns

0 on success, -1 on error.

### vips_phasecor ()

    int
    vips_phasecor (VipsImage *in1,
                   VipsImage *in2,
                   VipsImage **out,
                   ...);

Convert the two input images to Fourier space, calculate phase-correlation, back to real space.

See also: `vips_fwfft()`, `vips_cross_phase()`,

#### Parameters

in1 | first input image |
in2 | second input image |
out | output image. | [out]
... | `NULL`-terminated list of optional named arguments |

#### Returns

0 on success, -1 on error.

## See Also

image