Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

there's a builtin sum function for that:

e.g. if you have a (bgr) image:

Mat img = imread("my.png");
Scalar s = sum(img);
//s[0] = sum of blue channel,
//s[1] = sum of green channel,
//s[2]... now guess what...

there's a builtin sum function for that:

e.g. if you have a (bgr) image:

Mat img = imread("my.png");
Scalar s = sum(img);
//s[0] = sum of blue channel,
//s[1] = sum of green channel,
//s[2]... now guess what...
//s[2] = sum of red channel,