diff --git a/modules/core/src/dxt.cpp b/modules/core/src/dxt.cpp index 79cb31ceed..90eb392f58 100644 --- a/modules/core/src/dxt.cpp +++ b/modules/core/src/dxt.cpp @@ -1070,11 +1070,12 @@ RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab, } } - if( complex_output && (n & 1) == 0 ) + if (complex_output && ((n & 1) == 0 || n == 1)) { dst[-1] = dst[0]; dst[0] = 0; - dst[n] = 0; + if (n > 1) + dst[n] = 0; } }