Function in OpenCV to find mean / avg over any one dimension (rows/cols) simultaneously
c++, opencv
Solution
reduce should do the trick.
Mat row_mean, col_mean;
reduce(img,row_mean, 0, CV_REDUCE_AVG);
reduce(img,col_mean, 1, CV_REDUCE_AVG);
Problem
I know that there are Opencv functions `mean()` for c++ and `cvAvg` for C , which find average of an image for all channels. I need to find average / mean of all channels of an image in just one direction i.e. mean over all columns (result:a single row vector) and mean over all rows (result:single column vector). Is there any function or efficient method (probably without splitting the channels or using for loop) to do so ?