| Home | | | Quick start | | | Cookbook | | | All symbols | | | Analytical index | | | Namespaces | | | Syntax | | | Statements | | | CX | | | Frequency | | | Functions | | | Examples | | | Examples by command |
This page groups the OpenCV-side complex image and frequency-domain statements. Unlike CX., these commands operate on images/stacks stored as OpenCV Mats, typically CV_32FC2 where channel 0 is real and channel 1 is imaginary.
CV.DFT_COMPLEX, center it with CV.DFT_SHIFT, visualize with CV.SPECTRUM_LOG_MAG/CV.SPECTRUM_PHASE, optionally filter with CV.FREQ_*, then apply CV.IDFT_SHIFT and CV.IDFT_COMPLEX.CV.TO32F gray AS src
CV.DFT_COMPLEX src AS spec
CV.DFT_SHIFT spec AS centered
CV.SPECTRUM_LOG_MAG centered, TRUE AS logmag
GUI.SHOW logmag, "centered log spectrum"
CV.FREQ_GAUSSIAN_LOW_PASS centered, 18 AS lowCentered
CV.IDFT_SHIFT lowCentered AS lowSpec
CV.IDFT_COMPLEX lowSpec AS lowComplex
CV.SPLIT_COMPLEX lowComplex AS lowReal, lowImag
GUI.SHOW lowReal, "low-pass reconstruction"CV.COMPLEX_CONJ complexImage AS dst
Computes the complex conjugate of a complex image by negating the imaginary channel.
CV.COMPLEX_CONJ complexImage AS dstCV.COMPLEX_MAGNITUDE complexImage AS magnitudeImage
Computes per-pixel magnitude sqrt(re^2 + im^2) from a complex image.
CV.COMPLEX_MAGNITUDE complexImage AS magnitudeImageCV.COMPLEX_PHASE complexImage AS phaseImage
Computes per-pixel phase angle atan2(im,re), in radians, from a complex image.
CV.COMPLEX_PHASE complexImage AS phaseImageCV.MERGE_COMPLEX realImage, imagImage AS complexImage
Merges two same-size single-channel images into a CV_32FC2 complex image: channel 0 is real, channel 1 is imaginary.
CV.MERGE_COMPLEX re, im AS zimgCV.SPLIT_COMPLEX complexImage AS realImage, imagImage
Splits a CV_32FC2/CV_64FC2 complex image into real and imaginary single-channel images.
CV.SPLIT_COMPLEX zimg AS re, imCV.DFT_COMPLEX src AS spectrum
Computes a complex 2D DFT. A real single-channel input becomes CV_32FC2; a complex two-channel input is transformed as complex data.
CV.DFT_COMPLEX src AS specCV.DFT_MAGNITUDE src [, logScale] AS dst
Computes a centered 2D DFT magnitude map from the grayscale source, normalized to 0..255 as 32F.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
logScale | When true, applies logarithmic visualization scaling to spectral magnitude/power. |
CV.DFT_MAGNITUDE img, TRUE AS specCV.DFT_SHIFT spectrum AS centered
Circularly shifts a real or complex spectrum so the DC component is at the image center. Dimensions are preserved, including odd sizes.
CV.DFT_SHIFT spectrum AS centeredCV.FREQ_BAND_PASS centeredSpectrum, innerRadius, outerRadius AS filteredSpectrum
Keeps a centered annular frequency band and rejects frequencies outside the selected radii.
CV.FREQ_BAND_PASS centeredSpectrum, innerRadius, outerRadius AS filteredSpectrumCV.FREQ_GAUSSIAN_HIGH_PASS centeredSpectrum, sigma AS filteredSpectrum
Applies a smooth Gaussian high-pass mask to a centered complex spectrum.
CV.FREQ_GAUSSIAN_HIGH_PASS centeredSpectrum, sigma AS filteredSpectrumCV.FREQ_GAUSSIAN_LOW_PASS centeredSpectrum, sigma AS filteredSpectrum
Applies a smooth Gaussian low-pass mask to a centered complex spectrum.
CV.FREQ_GAUSSIAN_LOW_PASS centeredSpectrum, sigma AS filteredSpectrumCV.FREQ_HIGH_PASS centeredSpectrum, radius AS filteredSpectrum
Applies an ideal circular high-pass mask to a centered complex spectrum.
CV.FREQ_HIGH_PASS centeredSpectrum, radius AS filteredSpectrumCV.FREQ_LOW_PASS centeredSpectrum, radius AS filteredSpectrum
Applies an ideal circular low-pass mask to a centered complex spectrum.
CV.FREQ_LOW_PASS centeredSpectrum, radius AS filteredSpectrumCV.FREQ_NOTCH centeredSpectrum, offsetX, offsetY, radius [, mirror] AS filteredSpectrum
Suppresses a circular notch at the offset from the centered DC component. mirror=TRUE also suppresses the symmetric notch.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
mirror | Optional parameter. If omitted, the command uses its internal default. |
CV.FREQ_NOTCH centeredSpectrum, offsetX, offsetY, radius [, mirror] AS filteredSpectrumCV.IDFT_COMPLEX spectrum AS complexImage
Computes the inverse complex DFT with scaling. The output remains a complex image; split it to inspect real and imaginary residuals.
CV.IDFT_COMPLEX spec AS recon
CV.SPLIT_COMPLEX recon AS real, imagCV.IDFT_SHIFT centered AS spectrum
Inverse circular shift for a spectrum previously centered with CV.DFT_SHIFT.
CV.IDFT_SHIFT centered AS spectrumCV.SPECTRUM_LOG_MAG spectrum [, normalize] AS logMagnitudeImage
Computes log(1+magnitude) from a complex spectrum, optionally normalized for display.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
normalize | Optional parameter. If omitted, the command uses its internal default. |
CV.SPECTRUM_LOG_MAG centered, TRUE AS view
GUI.SHOW view, "log spectrum"CV.SPECTRUM_MAGNITUDE spectrum [, normalize] AS magImage
Computes magnitude from a complex spectrum. With normalize=TRUE the result is scaled to 0..255 for display.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
normalize | Optional parameter. If omitted, the command uses its internal default. |
CV.SPECTRUM_MAGNITUDE spectrum [, normalize] AS magImageCV.SPECTRUM_PHASE spectrum [, normalize] AS phaseImage
Computes phase from a complex spectrum. Without normalization the result is in radians; normalized output is intended for GUI display.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
normalize | Optional parameter. If omitted, the command uses its internal default. |
CV.SPECTRUM_PHASE spectrum [, normalize] AS phaseImageCV.SPECTRUM_POWER spectrum [, logScale [, normalize]] AS powerImage
Computes power re^2+im^2 from a complex spectrum, optionally applying log(1+x) and normalization for display.
Parameters enclosed in [...] may be omitted. Nested brackets mean that the later parameter is available only when the previous optional level is also supplied.
| Parameter | Meaning |
|---|---|
logScale | When true, applies logarithmic visualization scaling to spectral magnitude/power. |
normalize | Optional parameter. If omitted, the command uses its internal default. |
CV.SPECTRUM_POWER spectrum [, logScale [, normalize]] AS powerImage