title: Get a pixel by Mat::at
body: <p>I'm trying to get a pixel from a Mat object. To test I try to draw a diagonal line on a square and expect to get a perfect line crossing from the top left to the down right vertex.</p>
  
  <pre><code>for (int i =0; i&lt;500; i++){
       //I just hard-coded the width (or height) to make the problem more obvious
  
    (image2.at&lt;int&gt;(i, i)) = 0xffffff;
       //Draw a white dot at pixels that have equal x and y position.
  }
  </code></pre>
  
  <p>The result, however, is not as expected.
  Here is a diagonal line drawn on a color picture.
  <img src="https://i.stack.imgur.com/Ubdt0.jpg" alt="enter image description here">
  Here is it on a grayscale picture.
  <img src="https://i.stack.imgur.com/CZ6DZ.jpg" alt="enter image description here">
  Anyone sees the problem?</p>