Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to know the output array type of meanStdDev without looking at the source code

Hi All:

The API documentation of meanStdDev (C++: void meanStdDev(InputArray src, OutputArray mean, OutputArray stddev, InputArray mask=noArray())) does not clearly indicate the OutputArray type, i.e., whether the output array is a CV_32S or CV_32F or CV_64F. Only by checking the source code (https://github.com/opencv/opencv/blob/master/modules/core/src/stat.cpp) I find out the rules for determining the output type:

int type = _src.type(), depth = CV_MAT_DEPTH(type); ddepth = std::max(CV_32S, depth), sqddepth = std::max(CV_32F, depth), dtype = CV_MAKE_TYPE(ddepth, cn), sqdtype = CV_MAKETYPE(sqddepth, cn); // dtype and sqdtype refers to the output array type of mean and stddev

Without such important type info, I do not know how to properly access the output array (i.e. mean.at<t>(0)). I am wondering is there a easier way to look up such important info? In addition, what are the general rules regarding the input/output parameters types for OpenCV functions?