title: errors occuring while compiling the code for histogram equalization
body: <p>I'm trying to implement my own Histogram equalization without using the library routine for histogram equalization in opencv c++ 2.4.13.2 version.
  I compiled the program in terminal as follows:</p>
  
  <pre><code>g++ `pkg-config --cflags opencv` histogram_Equalization.cpp `pkg-config --libs opencv` -o histeq
  </code></pre>
  
  <p>i'm getting the errors as given below:<a href="https://i.stack.imgur.com/DQU02.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DQU02.png" alt="errors"></a></p>
  
  <p>Here is the code of mine:</p>
  
  <pre><code>#include &lt;opencv2/opencv.hpp&gt;
  #include &lt;opencv2/imgproc/imgproc.hpp&gt;
  #include&lt;opencv2/highgui/highgui.hpp&gt;
  #include&lt;opencv2/core/core.hpp&gt;
  #include&lt;iostream&gt;
  #include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  using namespace std;
  using namespace cv;
  Mat *calculateHist(Mat &amp;M, Mat &amp;He)
  {
      float P[256]={0};
      int i, j, k, r;
      float sum = 0.0;
      float T[256]={0}; 
      int S[256]={0};
      for(i=0;i&lt;M.rows;i++)
      {
          for(j=0;j&lt;M.cols;j++)
          {
              int tmp = M.at&lt;uchar&gt;(i,j); 
              P[tmp] = P[tmp] +1; //[(M.at&lt;uchar&gt;(i,j))] + 1;
          }
      }
      for (i=0;i&lt;M.rows;i++)
      {
          for(j=0;j&lt;M.cols;j++)
          {
              sum = sum + P[(M.at&lt;uchar&gt;(i,j))];
          }
      }
      //int num_pixel = (M.rows)*(M.cols)
      for(i=0;i&lt;256;i++)
      {
          P[i] = P[i]/(sum); 
      }
      T[0] = P[0];
      for( k=1; k&lt;256;k++)
      {
          T[k] = T[k-1] + P[k];
      }
      for( r=0; r&lt; 256; r++)
      {
          S[r] = cvRound(T[r]*255);
      }
      for(i=0;i&lt;M.rows;i++)
      {
          for(j=0;j&lt;M.cols;j++)
          {
              r = M.at&lt;uchar&gt;(i, j);
              He.at&lt;uchar&gt;(i,j) = S[r];
          }
      }
      return (&amp;He);
  }
  int main(int argc, char *argv[])
  {
  
      Mat image = imread(argv[1],0);
      Mat He(image.size,image.type);
  
      He = calculateHist(image, He);
      imshow("original_image", image);
      imshow( "histogram_equalized", He );
  
  
      waitKey(0);
      return 0;
  }
  </code></pre>