title: MATLAB Image Mass and Inertia
body: <p>I have a piece of code, I am trying to understand. It is given by my colleague and I am struggling on why she employed the way she did. In comments she mentioned the variable inertai1 gives the uniformity factor. I was wondering how does this give uniformity of an image. </p>
  
  <p><strong>Background of Code:</strong> 
  Initially it is a 2D image. The intensity values in every column is added and I got a 1D vector. Then all the values are divided by the maximum value in the 1D vector. Basically Normalizing.</p>
  
  <p>If I is the image read. I has values from 0 to 255.</p>
  
  <pre><code>S = sum(I,2); Smax = max(S);
  Cprofile = S/Smax;
  
  I2 = I*10; 
  I2(I2&gt;255) = 255;
  S2 = sum(I2,2); S2max = max(S2);
  Cprofile2 = S2/S2max;
  kCprofile2 = fft(Cprofile2); 
  //Do some frequency manipulations
  Cprofile2_f = ifft(kCprofile2)
  </code></pre>
  
  <p>inperpx is inch per pixel. </p>
  
  <p>b1 and d1 are the first and last indices of Cprofile I am interested in.</p>
  
  <pre><code> inertia1=0;
      mass1=0;
  
      for ii=b1:d1;
          mass1=mass1+inperpx*Cprofile(ii);
          inertia1=inertia1+abs(Cprofile2_f(ii)-Cprofile(ii))*inperpx;
      end
  
      inertia1=1-inertia1/mass1; 
  </code></pre>