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 ?
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With