title: Sum of elements in a matrix in OpenCV?
body: <p>I need to sum all the elements in a matrix. I used the function </p>
  
  <pre><code>  sum(sum(A)); 
  </code></pre>
  
  <p>in matlab. Where <code>A</code> is a matrix of size 300*360.
  I want to implement the same function in OpenCV. I used something like this.</p>
  
  <pre><code>  double s=cv::sum(cv::sum(A));
  </code></pre>
  
  <p>But there is error showing cannot convert scalar to double. How to fix this problem?</p>