How would I be able to cycle through an image using opencv as if it were a 2d array to get the rgb values of each pixel? Also, would a mat be preferable over an iplimage for
This is an old question but needs to get updated since opencv is being actively developed. Recently, OpenCV has introduce parallel_for_ which complies with c++11 lambda functions. Here is the example
parallel_for_(Range(0 , img.rows * img.cols), [&](const Range& range){
for(int r = range.start; r(i)[j] = doSomethingWithPixel(img.at(i,j));
}
});
This is mention-worthy that this method uses the CPU cores in modern computer architectures.