Skip to content

correlation_fftCorrelationFftCorrelationFftcorrelation_fftcorrelation_fft🔗

Short description🔗

correlation_fftCorrelationFftCorrelationFftcorrelation_fftcorrelation_fft — Multiply one image with the complex conjugate of another image in the frequency domain.

Signature🔗

correlation_fft( image ImageFFT1, image ImageFFT2, out image ImageCorrelation )void CorrelationFft( const HObject& ImageFFT1, const HObject& ImageFFT2, HObject* ImageCorrelation )static void HOperatorSet.CorrelationFft( HObject imageFFT1, HObject imageFFT2, out HObject imageCorrelation )def correlation_fft( image_fft1: HObject, image_fft2: HObject ) -> HObject

Herror correlation_fft( const Hobject ImageFFT1, const Hobject ImageFFT2, Hobject* ImageCorrelation )

Herror T_correlation_fft( const Hobject ImageFFT1, const Hobject ImageFFT2, Hobject* ImageCorrelation )

HImage HImage::CorrelationFft( const HImage& ImageFFT2 ) const

HImage HImage.CorrelationFft( HImage imageFFT2 )

Description🔗

As part of calculating the correlation between two images, correlation_fftCorrelationFft multiplies the Fourier transform of the first image ImageFFT1imageFFT1image_fft1 with the complex conjugate of the Fourier-transformed second image ImageFFT2imageFFT2image_fft2.

According to the correlation theorem, the non-normalized correlation of two images in pixel space can be obtained in three steps:

  1. Transforming the images into frequency space using a Fourier transform (see, e.g., fft_genericFftGeneric).

  2. Multiplying one transformed image with the complex conjugate of the other transformed image (pixel-wise).

  3. Transforming the result back into pixel space using an inverse Fourier transform (see, e.g., fft_genericFftGeneric).

The operator correlation_fftCorrelationFft is used to perform the second step, i.e., ImageFFT1imageFFT1image_fft1 is pixel-wise multiplied with the complex conjugate of ImageFFT2imageFFT2image_fft2.

It should be noted that in order to achieve a correct scaling of the correlation in the spatial domain, the operators fft_genericFftGeneric or rft_genericRftGeneric with Normnormnorm \(=\) 'none'"none" must be used for the forward transform (step 1) and fft_genericFftGeneric or rft_genericRftGeneric with Normnormnorm \(=\) 'n'"n" for the reverse transform (step 3). If ImageFFT1imageFFT1image_fft1 and ImageFFT2imageFFT2image_fft2 contain the same number of images, the corresponding images are multiplied pairwise. Otherwise, ImageFFT2imageFFT2image_fft2 must contain only one single image. In this case, the multiplication is performed for each image of ImageFFT1imageFFT1image_fft1 with ImageFFT2imageFFT2image_fft2.

Attention🔗

The filtering is always performed on the entire image, i.e., the domain of the image is ignored.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

Parameters🔗

ImageFFT1imageFFT1image_fft1 (input_object) (multichannel-)image(-array) → object (complex)HObject (complex)HImage (complex)HObject (complex)Hobject (complex)

Fourier-transformed input image 1.

ImageFFT2imageFFT2image_fft2 (input_object) (multichannel-)image(-array) → object (complex)HObject (complex)HImage (complex)HObject (complex)Hobject (complex)

Fourier-transformed input image 2.

Number of elements: ImageFFT2 == ImageFFT1 || ImageFFT2 == 1

ImageCorrelationimageCorrelationimage_correlation (output_object) image(-array) → object (complex)HObject (complex)HImage (complex)HObject (complex)Hobject * (complex)

Result in the frequency domain.

Example🔗

(HDevelop)

* Compute the auto-correlation of an image.
get_image_size(Image,Width,Height)
rft_generic(Image,ImageFFT,'to_freq','none','complex',Width)
correlation_fft(ImageFFT,ImageFFT,Correlation)
rft_generic(Correlation,AutoCorrelation,'from_freq','n','real',Width)

Result🔗

correlation_fftCorrelationFft returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

fft_genericFftGeneric, fft_imageFftImage, rft_genericRftGeneric

Possible successors

fft_genericFftGeneric, fft_image_invFftImageInv, rft_genericRftGeneric

Alternatives

phase_correlation_fftPhaseCorrelationFft

Module🔗

Foundation