I am using OpenCV in C++. I have a matrix that stores the ROI from a certain image. Now I want to calculate the mean R,G and B values of all the pixels (ROI Matrix values basically). The longer way is to use two for loops and access each pixel and then each stream.