title: Histogram equalization for normalized image without histeq function in MATLAB
body: <p>i'm trying to make histogram equalization code for normalized image without builtin function in MATLAB like 'histeq'</p>
  
  <p>I have normalized gray image that has values between [0,1]</p>
  
  <pre><code>    input_img = mat2gray(img);
  </code></pre>
  
  <p>and I have found an example code wihout histeq function</p>
  
  <pre><code>    for i=1:size(GIm,1)
          for j=1:size(GIm,2)
              value=GIm(i,j);
              freq(value+1)=freq(value+1)+1;
              probf(value+1)=freq(value+1)/numofpixels;
          end
      end
  
      sum=0;
      no_bins=255;
  
      %The cumulative distribution probability is calculated. 
  
      for i=1:size(probf)
         sum=sum+freq(i);
         cum(i)=sum;
         probc(i)=cum(i)/numofpixels;
         output(i)=round(probc(i)*no_bins);
      end
  
      for i=1:size(GIm,1)
          for j=1:size(GIm,2)
                  HIm(i,j)=output(GIm(i,j)+1);
          end
      end
  
      figure,imshow(HIm);
      title('Histogram equalization');
  </code></pre>
  
  <p>but this code is applied to an image that has a grayscale of [0,255]</p>
  
  <p>how should I apply this code to my grayscale normalized image?</p>
  
  <p>my image size 450x450</p>