I need to sum all the elements in a matrix. I used the function
sum(sum(A));
in matlab. Where A
is a matrix of size 300*360.
I want to implement the same function in OpenCV. I used something like this.
double s=cv::sum(cv::sum(A));
But there is error showing cannot convert scalar to double. How to fix this problem?
sum(A(:))
instead ofsum(sum(A))
– Damondamour