title: OpenCV display the wrong color
body: <p>I am working with OpenCV using C++. I would like to create an image with 3 colors: red, white and black. In detail, I want the background red and then a part white and a part black based on some conditions. </p>
  
  <p>The problem that I have is that when I set a color to white it becomes BLUE. </p>
  
  <p>Could someone know why this happen and how to solve it?</p>
  
  <p>This is my code:</p>
  
  <pre><code>    //initial image total red
  
      cv::Mat image(Size(w, h), CV_8UC3, cv::Scalar(0, 0, 255));          
  
      for (int i = 0; i &lt; h; i++) {
          for (int j = 0; j &lt; w; j++) {
              int pixel_v = (int)imggray.at&lt;uchar&gt;(i,j);
              if (pixel_v &lt; 200) {                
                  int pixel_bl = (int)imgBool.at&lt;uchar&gt;(i, j);
                  if (pixel_bl &gt; 200) {
                      //HERE A WANT WHITE PIXELS, but they are blue
                      image.at&lt;Vec3b&gt;(i, j) = (255, 255, 255);                        
                  }
                  else {
                      //black: this works
                      image.at&lt;Vec3b&gt;(i, j) = (0, 0, 0);
  
                  }
              }
  
  
          }
      }
  </code></pre>