Ask Your Question

jacobdang's profile - activity

2020-04-13 15:56:08 -0600 received badge  Notable Question (source)
2019-10-09 03:39:25 -0600 received badge  Popular Question (source)
2017-06-20 23:29:03 -0600 asked a question 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...) 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?