Updated by Kirill Kornyakov almost 13 years ago

In core/src/matrix.cpp (cv::reduce):

<pre>
if( op == CV_REDUCE_AVG )
{
op = CV_REDUCE_SUM;
if( sdepth < CV_32S && ddepth < CV_32S )
temp.create(dst.rows, dst.cols, CV_32SC(src.channels()));
}

</pre>
should be:

<pre>
if( op == CV_REDUCE_AVG )
{
op = CV_REDUCE_SUM;
if( sdepth < CV_32S && ddepth < CV_32S ){
temp.create(dst.rows, dst.cols, CV_32SC(src.channels()));
ddepth=CV_32S;
}
}

</pre>
otherwise when computing the mean of 8U matrices, ddepth is 8U even though temp is 32S, and no valid function is found. This appears in [[OpenCV]] 2.1 and 2.2 at least.

Back