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. But there is a function in Open CV
Scalar mean(const Mat& mtx)
Can I use that? If yes then what would my Scalar element exactly have. The documentation states it is a 4 element vector. Which elements would contain the mean R, G and B if any?
cv::Mat3b roiMat = imgMat(cv::Rect(hSt,vSt,hEn,vEn));
mean = cv::mean(roiMat);
What would mean have/be?
What about that:
I hope it helps,
Good luck