title: FFT scale power spectrum
body: <p>I have problem to scale out power spectrum of image using FFT. The code is below</p>
  
  <pre><code>void spectrumFFT(Complex&lt;double&gt; *f, Complex&lt;double&gt; *output, int width, int height){
  
          Complex&lt;double&gt; *temp = new Complex&lt;double&gt;[width * height];
          Complex&lt;double&gt; *singleValue = new Complex&lt;double&gt;();            
  
          for(int j = 0; j &lt; height; j++){
              for(int i = 0; i &lt; width; i++){
                   singleValue = f[i + j * width];
                   Complex&lt;double&gt; tempSwap = singleValue-&gt;Mag();
                   // tempSwap assign Magnitude value from singleValue
  
                   temp[i + j * width] = tempSwap;                 
              }
           }
  </code></pre>
  
  <p>Let's say temp 1-D array is fill of magnitude value. What my problem is how to scale out min and max value of magnitude which range between [0 - 255).</p>
  
  <p>Note : input *f is already calculated value of 2DFFT and *output value will be filled with min and max value of magnitude.</p>
  
  <p>Any idea with programming?</p>
  
  <p>Thank you,</p>
  
  <p>Regards,
  Ichiro</p>