32 #define MAX_Gauss_W 40
48 _(
"Negative standard deviation"));
51 size_t d = (int)ceil(
Thrice(sigma));
56 for (
size_t r = 0; r < d; r++)
57 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(d) -
double(r), sigma));
58 for (
size_t r = d; r < mat.
rows; r++)
59 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(r) -
double(d), sigma));
61 for (
size_t c = 0; c < d; c++)
62 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(d) -
double(c), sigma));
63 for (
size_t c = d; c < mat.
cols; c++)
64 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(c) -
double(d), sigma));
66 for (
size_t r = 0; r < d; r++)
67 for (
size_t c = d + 1; c < mat.
cols; c++)
68 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
70 for (
size_t r = 0; r < d; r++)
71 for (
size_t c = 0; c < d; c++)
72 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
74 for (
size_t r = d + 1; r < mat.
rows; r++)
75 for (
size_t c = 0; c < d; c++)
76 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
78 for (
size_t r = d + 1; r < mat.
rows; r++)
79 for (
size_t c = d + 1; c < mat.
cols; c++)
80 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
120 _(
"Negative standard deviation"));
123 size_t d = (int)ceil(
Thrice(sigma));
128 for (
size_t r = 0; r < d; r++)
129 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(d) -
double(r), sigma));
130 for (
size_t r = d; r < mat.
rows; r++)
131 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(r) -
double(d), sigma));
133 for (
size_t c = 0; c < d; c++)
134 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(d) -
double(c), sigma));
135 for (
size_t c = d; c < mat.
cols; c++)
136 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(c) -
double(d), sigma));
138 for (
size_t r = 0; r < d; r++)
139 for (
size_t c = d + 1; c < mat.
cols; c++)
140 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
142 for (
size_t r = 0; r < d; r++)
143 for (
size_t c = 0; c < d; c++)
144 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
146 for (
size_t r = d + 1; r < mat.
rows; r++)
147 for (
size_t c = 0; c < d; c++)
148 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
150 for (
size_t r = d + 1; r < mat.
rows; r++)
151 for (
size_t c = d + 1; c < mat.
cols; c++)
152 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
155 for (
size_t r = 0; r < mat.
rows; r++)
156 for (
size_t c = 0; c < mat.
cols; c++)
157 mat[r][c] *=
int(d) - int(c);
175 _(
"Negative standard deviation"));
178 size_t d = (int)ceil(
Thrice(sigma));
183 for (
size_t r = 0; r < d; r++)
184 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(d) -
double(r), sigma));
185 for (
size_t r = d; r < mat.
rows; r++)
186 mat[r][d] = (
int)(
MULT *
MeanGauss(
double(r) -
double(d), sigma));
188 for (
size_t c = 0; c < d; c++)
189 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(d) -
double(c), sigma));
190 for (
size_t c = d; c < mat.
cols; c++)
191 mat[d][c] = (
int)(
MULT *
MeanGauss(
double(c) -
double(d), sigma));
193 for (
size_t r = 0; r < d; r++)
194 for (
size_t c = d + 1; c < mat.
cols; c++)
195 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
197 for (
size_t r = 0; r < d; r++)
198 for (
size_t c = 0; c < d; c++)
199 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
201 for (
size_t r = d + 1; r < mat.
rows; r++)
202 for (
size_t c = 0; c < d; c++)
203 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
205 for (
size_t r = d + 1; r < mat.
rows; r++)
206 for (
size_t c = d + 1; c < mat.
cols; c++)
207 mat[r][c] = mat[r][d] * mat[d][c] /
MULT;
209 for (
size_t r = 0; r < mat.
rows; r++)
210 for (
size_t c = 0; c < mat.
cols; c++)
211 mat[r][c] *=
int(d) - int(r);
static MatrixInt NewGaussianSobelY(double sigma)
Creates a Gaussian Sobel Y derivation mask.
static MatrixInt NewChamferDT2()
Creates the second chamfer DT mask.
static MatrixInt NewSobelY()
Creates a Sobel Y derivation mask.
double MeanGauss(double x, double sigma)
Computes Gauss function at x for a given standard deviation (centered in 0) – to use with matrices...
MatrixInt(const Matrix< int > &m)
static MatrixInt NewGaussianSobelX(double sigma)
Creates a Gaussian Sobel X derivation mask.
#define CRN_END_CLASS_CONSTRUCTOR(classname)
Defines a class constructor.
static MatrixInt NewSobelX()
Creates a Sobel X derivation mask.
static MatrixInt NewD8DT2()
Creates the second D8 DT mask.
static MatrixInt NewD4DT1()
Creates the first D4 DT mask.
static MatrixInt NewGaussian3()
Creates a 3x3 Gaussian mask.
static MatrixInt NewD8DT1()
Creates the first D8 DT mask.
constexpr TypeInfo< T >::SumType Thrice(const T &v) noexcept(noexcept(v+v))
Returns three times a value.
A character string class.
static MatrixInt NewGaussian(double sigma)
Creates a Gaussian mask given standard deviation.
static MatrixInt NewChamferDT1()
Creates the first chamfer DT mask.
static MatrixInt NewD4DT2()
Creates the second D4 DT mask.
#define CRN_BEGIN_CLASS_CONSTRUCTOR(classname)
Defines a class constructor.