3 #include "../../catch2/catch.hpp"
8 #define MX_NO_ERROR_REPORTS
10 #include "../../../include/math/func/gaussian.hpp"
12 #include "../../../include/improc/imageUtils.hpp"
13 #include "../../../include/improc/eigenCube.hpp"
15 #include "../../../include/improc/imageTransforms.hpp"
17 #include "../../../include/math/fit/fitGaussian.hpp"
25 SCENARIO(
"Verify direction and accuracy of various image shifts",
"[improc::imageTransforms]" )
27 GIVEN(
"a Gaussian image")
36 shift.resize(im.rows(), im.cols());
38 fit.
setArray(shift.data(), shift.rows(), shift.cols());
41 mx::math::func::gaussian2D<double>(im.data(), im.rows(), im.cols(), 0., 1.0, 127.5, 127.5, 8);
42 fit.
setGuess(0.0, 1.0, 127.5, 127.5, 8.0);
46 REQUIRE(fabs(fit.
x0() - 127.0) < 1e-4);
47 REQUIRE(fabs(fit.
y0() - 127.0) < 1e-4);
51 REQUIRE(fabs(fit.
x0() - 128.0) < 1e-4);
52 REQUIRE(fabs(fit.
y0() - 128.0) < 1e-4);
56 REQUIRE(fabs(fit.
x0() - 128.5) < 1e-4);
57 REQUIRE(fabs(fit.
y0() - 128.5) < 1e-4);
62 REQUIRE(fabs(fit.
x0() - 128.0) < 1e-4);
63 REQUIRE(fabs(fit.
y0() - 127.0) < 1e-4);
67 REQUIRE(fabs(fit.
x0() - 127.2) < 1e-3);
68 REQUIRE(fabs(fit.
y0() - 128.2) < 1e-3);
72 REQUIRE(fabs(fit.
x0() - 128.8) < 1e-3);
73 REQUIRE(fabs(fit.
y0() - 126.8) < 1e-3);
Class to manage fitting a 2D Gaussian to data via the levmarInterface.
realT x0()
Get the center x-coordinate.
void setGuess(realT G0, realT G, realT x0, realT y0, realT sigma)
Set the initial guess for a symmetric Gaussian.
realT y0()
Get the center y-coordinate.
void setArray(realT *data, int nx, int ny)
Set the data aray.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.