4

I'm trying to compute the convolution of two images using the FFT implementation in mkl API. The steps are:

  • Calculate the FFT of the two images
  • Multiply the spectra
  • Calculate the inverse FFT, that is the convolution matrix.

I succeeded converting the images from real-valued to complex-valued using this descriptor:

dataSize[0] = OpRows;
dataSize[1] = OpCols;

DataStrides[0] = 0;
DataStrides[1] = OpCols;
DataStrides[2] = 1;

DftiCreateDescriptor(&_descriptor_F, DFTI_SINGLE, DFTI_COMPLEX, 2, dataSize);
DftiSetValue(_descriptor_F, DFTI_INPUT_STRIDES, DataStrides);
DftiSetValue(_descriptor_F, DFTI_OUTPUT_STRIDES, DataStrides);
DftiSetValue(_descriptor_F, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
DftiCommitDescriptor(_descriptor_F);

cv::Mat dst = cv::Mat(src.size(), CV_32FC2);
DftiComputeForward(_descriptor_F, (MKL_Complex8*)src.data, (MKL_Complex8*)dst.data);

(cv::Mat is the image format used by Opencv). And for the multiplication of complex arrays this function:

    vcMulByConj(...);

However, I'd like to calculate the FFT, setting the flag DFTI_REAL in the descriptor constructor.

The problem is that the resulting transformation if packed in some format that doesn't allow the usage of vcMulByConj(...); I found some functions from IPPs that unpack this type of array, however, I'd like something similar to vcMulByConj(...) with a flag that specifies the packed format.

As far as I searched, I couldn't find anything (also with some basic examples) that solves this issue.

Any help would be welcome.

0 Answers0