Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

Hi, I'm trying to convert the following C++ code in Java (for an Android app). 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;
    }
}

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

Hi, I'm trying to convert the following C++ code in Java (for an Android app). 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;
    }
}

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

Hi, I'm trying to convert the following C++ code in Java (for an Android app). 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;
    }
}

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

Hi, I'm trying to convert the following C++ code in Java (for an Android app). 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;
    }
}

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

Hi, I'm trying to convert the following C++ code in Java (for an Android app). 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;
    }
}