How to read the pixels of three channels at the same time?

18 views
Skip to first unread message

Giseli

unread,
Jun 27, 2012, 4:19:44 PM6/27/12
to android...@googlegroups.com
Hi, I'm trying to convert the following C++ code in Java. I need to sum the pixels in the three channels at the same time (and others operations). Any suggestions?

vector<Mat> channel; // in java List<Mat> channel = null;
split(img, channel); // in java org.opencv.core.Core.split(img, channel);

// sum the pixels of three channels - How to do it in Java? The it_r, it_g and it_b are iterators
for (; it_r != it_endr; ++it_r, ++it_g, ++it_b) {
r = (double) *it_r;
g = (double) *it_g;
b = (double) *it_b;

tmp = r + g + b;
if (tmp > sum) {
sum = tmp;
}
}

Thanks!

Andrey Pavlenko

unread,
Jun 28, 2012, 9:26:52 AM6/28/12
to android...@googlegroups.com
Just have answered at  answers.opencv.org
Reply all
Reply to author
Forward
0 new messages