title: Difference between .at<uchar> and static_cast<uchar> in opencv?
body: <p>I have a float matrix a and I want to access the element at the point (x,y), but I want to convert the data type to unsigned char. The float number in point(x,y) is 652.759</p>
  
  <p>The code I want to use (which is based on Opencv)is </p>
  
  <pre><code>    a.at&lt;uchar&gt;(Point(x,y))
  </code></pre>
  
  <p>The result of above code is 68.</p>
  
  <p>But when I checked the result with simple c++ code</p>
  
  <pre><code>    static_cast&lt;unsigned char&gt;(a.at&lt;float&gt;(Point(x,y)))
  </code></pre>
  
  <p>the result is 140. </p>
  
  <p>Anyone knows why? How can I get the same results by using both the code above?</p>
  
  <p>Thx!</p>