3 #include "../../catch2/catch.hpp"
8 #define MX_NO_ERROR_REPORTS
10 #include "../../../include/math/func/gaussian.hpp"
11 #include "../../../include/improc/imageXCorrDiscrete.hpp"
12 #include "../../../include/improc/eigenCube.hpp"
13 #include "../../../include/ioutils/fits/fitsFile.hpp"
21 SCENARIO(
"Verify X-Corr with center of light calculation",
"[improc::imageXCorrDiscrete]" )
23 GIVEN(
"two Gaussians")
25 WHEN(
"1 at geometric center")
31 mx::math::func::gaussian2D<double>(im0.data(), im0.rows(), im0.cols(), 0., 1.0, 31.5, 31.5, 2);
32 mx::math::func::gaussian2D<double>(im2.data(), im2.rows(), im2.cols(), 0., 1.0, 31.5+4, 31.5+4, 2);
39 xcf.m_peakMethod = mx::improc::xcorrPeakMethod::centroid;
48 std::cerr << x <<
" " << y <<
"\n";
50 REQUIRE(fabs(x-2) < 1e-8 );
51 REQUIRE(fabs(y-2) < 1e-8 );
53 WHEN(
"geometric quarter")
58 mx::math::func::gaussian2D<double>(im.data(), im.rows(), im.cols(), 0., 1.0, 15.5, 15.5, 2);
63 REQUIRE(fabs(x-15.5) < 1e-8 );
64 REQUIRE(fabs(y-15.5) < 1e-8 );
Class to manage interactions with a FITS file.
int write(const dataT *im, int d1, int d2, int d3, fitsHeader *head)
Write the contents of a raw array to the FITS file.
Find the optimum shift to align two images using the discrete cross correlation.
ccImT m_ccIm
The cross-correlation image.
ccImT m_refIm
The normalized reference image.
int refIm(const ccImT &im0)
Set the reference image.
Eigen::Array< scalarT, -1, -1 > eigenImage
Definition of the eigenImage type, which is an alias for Eigen::Array.
int imageCenterOfLight(typename imageT::Scalar &x, typename imageT::Scalar &y, const imageT &im)
Calculate the center of light of an image.
SCENARIO("Verify X-Corr with center of light calculation", "[improc::imageXCorrDiscrete]")