# Meaning of cv::idft() with DFT_REAL_OUTPUT option

I would like to ask about cv::idft() with DFT_REAL_OUTPUT for non-symmetric matrix. Let me explain in detail.

If an input matrix in time domain has only real component, dft of the input matrix has some kind of symmetric structure. For example,

```
const int width = 4;
const int height = 4;
cv::Mat in1ch = (cv::Mat_<double>(width, height)
<< 1.0, 0.2, 0.4, 0.5,
0.4, 0.3, 0.2, 0.1,
0.5, 0.7, 0.3, 0.8,
0.2, 0.9, 0.8, 0.1
);
// dfted: dft result of in1ch
// [7.4 0.4-0.6i 0.2 0.4+0.6i;
// -0.2+i 1-0.6i 1.4-0.2i -0.2-i;
// 1.4 1.2+1.4i -0.2 1.2-1.4i;
// -0.2-i -0.2+i 1.4+0.2i 1+0.6i]
cv::Mat dfted;
cv::dft(in1ch, dfted, DFT_COMPLEX_OUTPUT);
```

And the idft result of the symmetric matrix will have only real component.

```
// idfted: idft result of dfted
// it is the same with in1ch
cv::Mat idfted;
cv::idft(dfted, idfted, DFT_REAL_OUTPUT | DFT_SCALE);
```

On the contrary, the idft result of a non-symmetric matrix will have real and imaginary component. However, if I give a non-symmetric matrix to cv::idft() with DFT_REAL_OUTPUT, I get a matrix having only real component.

```
// notSym: non-symmetric matrix which is almost the same with dfted
// [7.4 1.3+0.2i 0.2 0.4+0.6i;
// -0.2+i 1-0.6i 1.4-0.2i -0.2-i;
// 1.4 1.2+1.4i -0.2 0.4+i;
// -0.2-i -0.2+i 1.4+0.2i 1+0.6i]
cv::Mat notSym = dfted.clone();
notSym.at<cv::Vec2f>(0, 1) = cv::Vec2f(1.3, 0.2);
notSym.at<cv::Vec2f>(2, 3) = cv::Vec2f(0.4, 1.0);
// idfted2:
// [1.1125 0.1 0.2875 0.6
// 0.5125 0.2 0.0875 0.2
// 0.6125 0.6 0.1875 0.9
// 0.3125 0.8 0.6875 0.2]
cv::Mat idfted2;
cv::idft(notSym, idfted2, DFT_REAL_OUTPUT | DFT_SCALE);
```

Here are the questions:

- Q1. To apply cv::idft() for non-symmetric matrix Is a meaningful procedure? If so, what is the meaning of the result?
- Q2. What is an implementation of cv::idft() with DFT_REAL_OUTPUT? Is there some reference?