Ask Your Question
0

How can i add all 'R' values in the image?

asked 2015-01-07 03:58:10 -0600

guru gravatar image

I need to add all the R values in the image . How can i do this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2015-01-07 04:12:45 -0600

berak gravatar image

updated 2015-01-07 04:13:25 -0600

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] = sum of red channel,
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-07 03:58:10 -0600

Seen: 823 times

Last updated: Jan 07 '15