title: Find maximum value of a cv::Mat
body: <p>I am trying to find the maximum pixel value of a <code>cv::Mat</code>.</p>
  
  <p>The Problem : <code>*maxValue</code> is always returning <code>0</code>.</p>
  
  <p>From <a href="https://stackoverflow.com/questions/10158756/using-stdmax-element-on-a-vectordouble">this S.O. thread</a>, I understand that '<code>max_element</code> return iterators, not values. This is why I use <code>*maxValue</code>'</p>
  
  <pre><code>cv::Mat imageMatrix;
  
  double  sigmaX = 0.0;
  int ddepth = CV_16S; //  ddepth – The desired depth of the destination image
  
  
  cv::GaussianBlur( [self cvMatFromUIImage:imageToProcess], imageMatrix, cv::Size(3,3), sigmaX);
  
  cv::Laplacian(imageMatrix, imageMatrix, ddepth, 1);
  
  std::max_element(imageMatrix.begin(),imageMatrix.end());
  
  std::cout &lt;&lt; "The maximum value is : " &lt;&lt; *maxValue &lt;&lt; std::endl;
  </code></pre>
  
  <p>Note : If <code>min_element</code> is substituted in place of <code>max_element</code>, and <code>minValue</code> in place of <code>maxValue</code>, <code>*minValue</code> will always return <code>0</code>.</p>