5
#ifndef OPENCV_QUALITY_QUALITY_UTILS_HPP
6
#define OPENCV_QUALITY_QUALITY_UTILS_HPP
8
#include "qualitybase.hpp"
14
namespace
quality_utils
18
static
CV_CONSTEXPR
const
int
EXPANDED_MAT_DEFAULT_TYPE = CV_32F;
22
inline
R extract_mat(InputArray in,
const
int
type = -1)
26
in.getMat().convertTo( result, (type != -1) ? type : in.getMat().type());
27
else
if
( in.isUMat() )
28
in.getUMat().convertTo( result, (type != -1) ? type : in.getUMat().type());
30
CV_Error(Error::StsNotImplemented,
"Unsupported input type");
37
inline
R expand_mat( InputArray src,
int
TYPE_DEFAULT = EXPANDED_MAT_DEFAULT_TYPE)
39
auto
result = extract_mat<R>(src, -1);
44
int
type = TYPE_DEFAULT;
46
switch
(result.depth())
54
result.convertTo(result, type);
70
row_min = result.row(0)
71
, row_max = result.row(1)
75
data.row(0).copyTo(row_min);
76
data.row(0).copyTo(row_max);
78
for
(
int
y = 1; y < data.rows; ++y)
80
auto
row = data.row(y);
95
for
(
int
y = 0; y < mat.rows; ++y)
97
auto
row = mat.row(y);
98
auto
row_min = range.row(0);
99
auto
row_max = range.row(1);
101
for
(
int
x = 0; x < mat.cols; ++x)
102
row.at<T>(x) =
min
+ (
max
-
min) * (row.at<T>(x) - row_min.at<T>(x) ) / (row_max.at<T>(x) - row_min.at<T>(x));
n-dimensional dense array class
Definition:
mat.hpp:802
Template class for specifying the size of an image or rectangle.
Definition:
core/types.hpp:316
CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element maximum of two arrays or an array and a scalar.
CV_EXPORTS_W void min(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element minimum of two arrays or an array and a scalar.
#define CV_Error(code, msg)
Call the error handler.
Definition:
base.hpp:320
#define CV_Assert(expr)
Checks a condition at runtime and throws exception if it fails
Definition:
base.hpp:342
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75