title: Convert grayscale image to it's negative using OpenCV
body: <p>I'm trying to make a simple function to convert a grayscale image to it's negative using <strong>openCV</strong>. Below I have the function's code:</p>
  
  <pre><code>#include "stdafx.h"
  #include "common.h"
  #include &lt;opencv/cv.h&gt;
  #include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  using namespace cv;
  .........................................
  
  void negative_image()
  {
      Mat img = imread("Images/cameraman.bmp", CV_LOAD_IMAGE_GRAYSCALE);
  
      for (int i = 0; i &lt; img.row; i++)
      {
          for (int j = 0; j &lt; img.cols; j++)
          {
              img.at&lt;uchar&gt;(i, j) = 255 - img.at&lt;uchar&gt;(i, j);
          }
      }
  
      imshow("negative image", img);
      waitKey(0);
  }
  </code></pre>
  
  <p>When I try to build the application I get the following errors:</p>
  
  <p><a href="https://i.stack.imgur.com/I5Scp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I5Scp.png" alt="enter image description here"></a></p>
  
  <p>Any help is appreciated!  </p>