title: I get different results for same image in a program
body: <p>I made a small program that calculates the number of white pixels in a grayscale image. I get different results if I open the image twice in the same program. Same if I display the intensity of the pixels, it changes even if it is the same image. If anyone sees where the problem is please help.</p>
  
  <pre><code>#include "opencv2/imgcodecs.hpp"
  #include "opencv2/highgui.hpp"
  #include "opencv2/imgproc.hpp"
  #include &lt;iostream&gt;
  
  using namespace std;
  using namespace cv;
  int main()
  { int i=0,j,nbr=0,nbr1=0;
  
  
  Mat image=imread("2_.png",CV_LOAD_IMAGE_GRAYSCALE);
  Mat image2=imread("2_.png",CV_LOAD_IMAGE_GRAYSCALE);
  
  for(i=0;i&lt;image.rows;i++)
  {
      for( j=0;j&lt;image.cols;j++)
      {if (image.at&lt;int&gt;(i,j)!=0)
             nbr++;
       if (image2.at&lt;int&gt;(i,j)!=0)
             nbr1++;
      }
  }
  printf("%d\n %d\n",nbr,nbr1);
  
  
      return 0;}
  </code></pre>
  
  <p>Thank you for your help.</p>