C++ pixel access question.

Asked 2 years ago, Updated 2 years ago, 71 views

for (int row = 0; row < result.rows; row++) {

            uchar* pointer_row = result.ptr<uchar>(row);


            for (col = 0; col < result.cols; col++) {


                uchar b = pointer_row[col * 3 + 0];
                uchar g = pointer_row[col * 3 + 1];
                uchar r = pointer_row[col * 3 + 2];
}

The above code reads the cols of the image from 0 (left),

    for (col =2588; col > result.cols; col--) {


                uchar b = pointer_row[col * 3 + 0];
                uchar g = pointer_row[col * 3 + 1];
                uchar r = pointer_row[col * 3 + 2];
    }

I want to code like above. I know the code above is wrong. I'm sure you know how it feels. I can only explain it like this because I'm a total beginner Help!

c++ opencv

2022-09-20 19:48

1 Answers

So you want to reverse the for tour? If so…

for (col = result.cols; col >= 0; col--) {
    // Omitted
}


2022-09-20 19:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.