title: Why the Fourier transform does not look correct in C++?
body: <p>I'm trying to calculate the Fourier transform of an image with a lib called <a href="https://www.nayuki.io/page/free-small-fft-in-multiple-languages" rel="nofollow noreferrer">FftComplex</a></p>
  <p>I am processing this image:
  <a href="https://i.stack.imgur.com/60oq6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/60oq6.png" alt="enter image description here" /></a></p>
  <p>I should get and output like this:
  <a href="https://i.stack.imgur.com/bPmrn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bPmrn.jpg" alt="enter image description here" /></a></p>
  <p>But instead I'm getting this:
  <a href="https://i.stack.imgur.com/gLhT3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gLhT3.png" alt="enter image description here" /></a></p>
  <p>This is part of the code:</p>
  <pre><code>    // Convert the raw images to vectors
          PF_PixelFloat* pixelPointerAtIndex;
          for (unsigned long index= 0; index &lt; imgArraySize; index++){
              pixelPointerAtIndex = (PF_PixelFloat*)((char*)inWorld.data + (index * sizeof(PF_PixelFloat)));
              imgRedDataVector.push_back( (std::complex&lt;double&gt;) pixelPointerAtIndex-&gt;red);
              imgGreenDataVector.push_back((std::complex&lt;double&gt;) pixelPointerAtIndex-&gt;green);
              imgBlueDataVector.push_back((std::complex&lt;double&gt;) pixelPointerAtIndex-&gt;blue);
          }
  
      // Fourier Transform
          fft::transform(imgRedDataVector);
          fft::transform(imgGreenDataVector);
          fft::transform(imgBlueDataVector);
  
      // Copy the Fourier data back to the image
          for (unsigned long index = 0; index &lt; imgArraySize; index++) {
              pixelPointerAtIndex = (PF_PixelFloat*)((char*)inWorld.data + (index * sizeof(PF_PixelFloat)));
              pixelPointerAtIndex-&gt;red    = imgRedDataVector[index].real();
              pixelPointerAtIndex-&gt;green  = imgGreenDataVector[index].real();
              pixelPointerAtIndex-&gt;blue   = imgBlueDataVector[index].real();
          }
  </code></pre>
  <p>I also have try this:</p>
  <pre><code>    finalImgRedDataVector[index].imag()
      ...
  </code></pre>
  <p>It seams like I am getting the &quot;Argument&quot; but maybe I'm getting the &quot;Modulus&quot; ?</p>
  <p>Does any body knows what is wrong with this or what I'm missing?</p>
  <p>Thanks.</p>