diff --git a/modules/core/src/stat.cpp b/modules/core/src/stat.cpp index a978c90fd2..60d3be9990 100644 --- a/modules/core/src/stat.cpp +++ b/modules/core/src/stat.cpp @@ -4150,7 +4150,9 @@ double cv::PSNR(InputArray _src1, InputArray _src2) { CV_INSTRUMENT_REGION() - CV_Assert( _src1.depth() == CV_8U ); + //Input arrays must have depth CV_8U + CV_Assert( _src1.depth() == CV_8U && _src2.depth() == CV_8U ); + double diff = std::sqrt(norm(_src1, _src2, NORM_L2SQR)/(_src1.total()*_src1.channels())); return 20*log10(255./(diff+DBL_EPSILON)); }