title: c++ and opencv get and set pixel color to Mat
body: <p>I'm trying to set a new color value to some pixel into a cv::Mat image my code is below:</p>
  
  <pre><code>    Mat image = img;
      for(int y=0;y&lt;img.rows;y++)
      {
          for(int x=0;x&lt;img.cols;x++)
          {
          Vec3b color = image.at&lt;Vec3b&gt;(Point(x,y));
          if(color[0] &gt; 150 &amp;&amp; color[1] &gt; 150 &amp;&amp; color[2] &gt; 150)
          {
              color[0] = 0;
              color[1] = 0;
              color[2] = 0;
              cout &lt;&lt; "Pixel &gt;200 :" &lt;&lt; x &lt;&lt; "," &lt;&lt; y &lt;&lt; endl;
          }
          else
          {
              color.val[0] = 255;
              color.val[1] = 255;
              color.val[2] = 255;
          }
      }
      imwrite("../images/imgopti"+to_string(i)+".tiff",image);
  </code></pre>
  
  <p>It seems to get the good pixel in output (with cout) however in the output image (with imwrite) the pixel concerned aren't modified. I have already tried using color.val[0].. I still can't figure out why the pixel colors in the output image dont change.
  thanks</p>