Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Both these functions are implemented in stat.cpp file (https://github.com/Itseez/opencv/blob/master/modules/core/src/stat.cpp).

cv::sum(): For calculation sum of CV_8U matrix we split matrix to few pieces. After that we sum each piece to int value and add this int value to the result double value.

cv::norm(): Similarly to sum. E.g. we sum the squares of the values to the integer variable and then add this value to the double value for L2 norm. After calculating the sum we call sqrt() function.