Why DFT_REAL_OUTPUT is different from the real part of complex result

I foward DFT a image and get a complex result, then i want inverse it to my image, when i use C2C, i get the real part of result and it just my image. but when i use C2R, the result is nothing about my image. i can not understand it, why it is different? any help is expected, please! version opencv4.5.5 cuda10.1 windows10

A minimal example is welcome

acronym :
real input to complex-Hermitian output (r2c)
complex-Hermitian input to real output (c2r)
c2c ??

my code is this:
C2C:
Mat img=imread(… );
GpuMat src, dst;
src.upload(img);
src.convertTo(src, CV_32F);
GpuMat planes[2]={src, GpuMat(src.size(), CV_32F, Scalar(0)};
GpuMat complex;
cuda::merge(planes, 2, complex);
cuda::dft(complex, complex, complex.size(), DFT_SCALE);
cuda::dft(complex, complex, complex.size(), DFT_INVERSE);
cuda::split(complex, planes);
dst=planes[0];
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
the follow is C2R:
Mat img=imread(… );
GpuMat src, dst;
src.upload(img);
src.convertTo(src, CV_32F);
GpuMat planes[2]={src, GpuMat(src.size(), CV_32F, Scalar(0)};
GpuMat complex;
cuda::merge(planes, 2, complex);
cuda::dft(complex, complex, complex.size(), DFT_SCALE);
cuda::dft(complex, dst, complex.size(), DFT_INVERSE | DFT_REAL_OUTPUT);//and complex is changed by this step

I’m not sure exactly what you are trying to achieve but the docs specify, that the source matrix for your C2R should be the result of R2C

  • DFT_REAL_OUTPUT specifies the output as real. The source matrix is the result of
    real-complex transform, so the destination matrix must be real.

Have you looked at the C2C

and R2C then C2R

test cases?

It’s a mathematical property of fourier transform.