1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

a part of PR #11364 (extended findNonZero & PSNR) (#11837)

* a part of https://github.com/opencv/opencv/pull/11364 by Tetragramm. Rewritten and extended findNonZero & PSNR to support more types, not just 8u.

* fixed compile & doxygen warnings

* fixed small bug in findNonZero test
This commit is contained in:
Vadim Pisarevsky
2018-06-26 17:10:00 +03:00
committed by GitHub
parent cc8db99695
commit 051b40f956
4 changed files with 106 additions and 27 deletions
+7 -4
View File
@@ -599,7 +599,7 @@ or
// access pixel coordinates
Point pnt = locations[i];
@endcode
@param src single-channel array (type CV_8UC1)
@param src single-channel array
@param idx the output array, type of cv::Mat or std::vector<Point>, corresponding to non-zero indices in the input
*/
CV_EXPORTS_W void findNonZero( InputArray src, OutputArray idx );
@@ -699,7 +699,8 @@ CV_EXPORTS double norm( const SparseMat& src, int normType );
/** @brief Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. Arrays must have depth CV_8U.
This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB),
between two input arrays src1 and src2. The arrays must have the same type.
The PSNR is calculated as follows:
@@ -707,13 +708,15 @@ The PSNR is calculated as follows:
\texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) }
\f]
where R is the maximum integer value of depth CV_8U (255) and MSE is the mean squared error between the two arrays.
where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data)
and MSE is the mean squared error between the two arrays.
@param src1 first input array.
@param src2 second input array of the same size as src1.
@param R the maximum pixel value (255 by default)
*/
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2);
CV_EXPORTS_W double PSNR(InputArray src1, InputArray src2, double R=255.);
/** @brief naive nearest neighbor finder