title: Get value from OpenCV Mat
body: <p>I have one channel matrix in my program,  with next definition: </p>
  
  <pre><code>matchingResult.create(result_cols, result_rows, CV_32FC1);
  </code></pre>
  
  <p>It is not a matrix of colours.<br>
  I use <em>minMaxLoc</em> method to find of positions of the min and max values:</p>
  
  <pre><code>double minValue;
  double maxValue;
  cv::Point minLocation;
  cv::Point maxLocation;          
  cv::minMaxLoc(_matchingMap, &amp;minValue, &amp;maxValue, &amp;minLocation, &amp;maxLocation);
  </code></pre>
  
  <p>This method returns correct values: </p>
  
  <blockquote>
    <p>MinValue: -287909 MaxValue: 682182 MinLocation: [5, 1] MaxLocation:
    [4, 2]</p>
  </blockquote>
  
  <p>If I print the matrix into <em>cout</em> I'll get same result.</p>
  
  <p>But I can't get same value from the matrix by using the location of max value (maxLocation), or change value of the max.<br>
  If I try to get value: </p>
  
  <pre><code>double value = _matchingMap.at&lt;double&gt;(maxLocation);
  std::cout&lt;&lt;"Value for "&lt;&lt;maxLocation &lt;&lt; " is "&lt;&lt;value &lt;&lt; std::endl;
  </code></pre>
  
  <p>I'll get something strange:</p>
  
  <blockquote>
    <p>Value for [4, 2] is -1.08215e+39</p>
  </blockquote>
  
  <p>I want to change values in matrix by using row/coll coordinates, but I do something wrong. I can't find error, may smb can show me the correct way.</p>
  
  <p>How to iterate a matrix I've seen <a href="http://docs.opencv.org/2.4/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html#performance-difference" rel="nofollow">here</a> </p>