Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

same compiler / os here, 2 simple modifications made it pass:

  1. do not declare /define your operator inside main (or any other function) . (ok with cl, but g++ hates it.)
  2. make your () operation const:


typedef cv::Point3_<uint8_t> Pixel;
// Parallel execution with function object.
struct Operator {
    void operator ()(Pixel &pixel, const int * position) const {
        pixel.x = 255;
    }
};

int main(int argc, char** argv) {
    Mat image(1920, 1080, CV_8UC3);
    image.forEach<Pixel>(Operator());
    return 0;
}

same compiler / os here, 2 simple modifications made it pass:

  1. do not declare /define your operator inside main (or any other function) . (ok with cl, but g++ hates it.)
  2. will compile, if you make your () operation const:
const:


typedef cv::Point3_<uint8_t> Pixel;
// Parallel execution with function object.
struct Operator {
    void operator ()(Pixel &pixel, const int * position) const {
        pixel.x = 255;
    }
};

int main(int argc, char** argv) {
    Mat image(1920, 1080, CV_8UC3);
    image.forEach<Pixel>(Operator());
    return 0;
}