37 sel[0][0] = sel[2][0] = sel[0][2] = sel[2][2] = 0;
61 const auto deltax = c1.xbar - c2.xbar;
62 const auto deltay = c1.ybar - c2.ybar;
63 auto mindiff = std::numeric_limits<int>::max();
65 for (
auto y_d = deltay - win; y_d <= deltay + win; ++y_d)
66 for (
auto x_d = deltax - win; x_d <= deltax + win; ++x_d)
69 for (
auto y = 0; y < int(c1.mask.GetHeight()); ++y)
71 for (
auto x = 0; x < int(c1.mask.GetWidth()); ++x)
73 if (!c1.mask.At(x, y))
76 if ((x >= x_d) && (x < x_d + int(c2.dmask.GetWidth())) &&
77 (y >= y_d) && (y < y_d +
int(c2.dmask.GetHeight())) &&
78 c2.dmask.At(x - x_d, y - y_d))
105 for (
auto p : img1.mask)
108 if (npix1 == 0) npix1 = 1;
110 for (
auto p : img2.mask)
113 if (npix2 == 0) npix2 = 1;
114 auto ndiff1 = diffgrad(img1, img2,
int(window));
115 auto ndiff2 = diffgrad(img2, img1,
int(window));
116 return Max(
double(ndiff1) / npix1,
double(ndiff2) / npix2);
Unit::type AngularDistance(const Angle< Unit > &a1, const Angle< Unit > &a2) noexcept(std::is_nothrow_constructible< typename TypeInfo< typename Unit::type >::DiffType >::value &&std::is_nothrow_copy_assignable< typename TypeInfo< typename Unit::type >::DiffType >::value &&std::is_nothrow_constructible< typename Unit::type >::value)
Distance between two angles.
static double Distance(const GradientModel &img1, const GradientModel &img2, size_t window) noexcept
std::vector< pixel_type >::reference At(size_t x, size_t y) noexcept
Returns a reference to a pixel.
size_t GetHeight() const noexcept
GradientModel(const ImageGradient &igr)
const T & Max(const T &a, const T &b)
Returns the max of two values.
#define FOREACHPIXEL(x, y, img)
Convenience macro to sweep an image.
void Erode(const MatrixInt &strel, CMP cmp=std::less< pixel_type >{})
Morphological erosion.
A convenience class for angles units.
ImageBW Threshold(const Image< T > &img, T thresh, CMP cmp=std::less< T >{})
Gradient image in polar form.
Image< typename Unit< T >::type > ThetaChannel(const Image< pixel::Polar2D< R, T >> &img)
size_t GetWidth() const noexcept
Image< R > RhoChannel(const Image< pixel::Polar2D< R, T >> &img)