36#ifndef VIGRA_AFFINE_REGISTRATION_FFT_HXX
37#define VIGRA_AFFINE_REGISTRATION_FFT_HXX
39#include "mathutil.hxx"
41#include "linear_solve.hxx"
42#include "tinyvector.hxx"
43#include "splineimageview.hxx"
44#include "imagecontainer.hxx"
45#include "multi_shape.hxx"
46#include "affinegeometry.hxx"
47#include "correlation.hxx"
109template <
class SplineImage,
110 class DestIterator,
class DestAccessor>
149template <
class SplineImage,
150 class DestIterator,
class DestAccessor>
158template <
class SplineImage,
162 MultiArrayView<2, T1, S1> dest)
172 template <
class SrcIterator,
class SrcAccessor,
173 class DestIterator,
class DestAccessor>
175 maximumFastNCC(SrcIterator s_ul, SrcIterator s_lr, SrcAccessor s_acc,
176 DestIterator d_ul, DestIterator d_lr, DestAccessor d_acc,
177 TinyVector<int,2> & position,
178 double & correlation_coefficent)
180 typename DestIterator::difference_type s_shape = s_lr - s_ul;
181 typename DestIterator::difference_type d_shape = d_lr - d_ul;
183 MultiArray<2, float> src(s_shape.x, s_shape.y), dest(d_shape.x, d_shape.y), ncc(d_shape.x, d_shape.y);
187 copyImage(srcIterRange(s_ul, s_lr, s_acc), destImage(src_view));
188 copyImage(srcIterRange(d_ul, d_lr, d_acc), destImage(dest_view));
195 float max_val = -1.0;
197 for (
int y = 0; y < ncc.height()-s_shape.y; y++)
199 for (
int x = 0; x < ncc.width()-s_shape.x; x++)
201 val = ncc(x+s_shape.x/2, y+s_shape.y/2);
215 correlation_coefficent = max_val;
218 template <
class SrcIterator,
class SrcAccessor,
219 class DestIterator,
class DestAccessor>
221 maximumFastNCC(triple<SrcIterator, SrcIterator, SrcAccessor> src,
222 triple<DestIterator, DestIterator, DestAccessor> dest,
223 TinyVector<int,2> & position,
224 double & correlation_coefficent)
226 maximumFastNCC(src.first, src.second, src.third,
227 dest.first, dest.second, dest.third,
229 correlation_coefficent);
232 template <
class SrcIterator,
class SrcAccessor,
233 class DestIterator,
class DestAccessor>
234 void fourierLogAbsSpectrumInPolarCoordinates(SrcIterator s_ul, SrcIterator s_lr, SrcAccessor s_acc,
235 DestIterator d_ul, DestIterator d_lr, DestAccessor d_acc)
237 using namespace vigra;
239 typename SrcIterator::difference_type shape =
s_lr -
s_ul;
260 fourierLogAbsSpectrumInPolarCoordinates(
src.first,
src.second,
src.third,
dest.first,
dest.second,
dest.third);
357 const int pc_w = size,
384 for (
int y=0; y<
pc_h/2; y++)
415template <
class T1,
class S1,
424 destImageRange(
dest),
510 ignore_argument(
d_lr);
531 for (
int q=0;
q!=5;
q++)
559 for (
int q=0;
q!=5;
q++)
597template <
class T1,
class S1,
607 destImageRange(
dest),
730template <
class T1,
class S1,
741 destImageRange(
dest),
Two dimensional difference vector.
Definition diff2d.hxx:186
Class for a single RGB value.
Definition rgbvalue.hxx:128
void fourierTransform(...)
Compute forward and inverse Fourier transforms.
BasicImageView< T > makeBasicImageView(MultiArrayView< 2, T, Stride > const &array)
Definition multi_array.hxx:3478
void fastNormalizedCrossCorrelation(...)
This function performes a fast normalized cross-correlation.
void estimateGlobalTranslation(...)
Estimate the translation between two images by means of a normalized cross correlation matching.
linalg::TemporaryMatrix< double > rotationMatrix2DDegrees(double angle)
Create homogeneous matrix representing a 2D rotation about the coordinate origin.
Definition affinegeometry.hxx:133
linalg::TemporaryMatrix< double > translationMatrix2D(TinyVector< double, 2 > const &shift)
Create homogeneous matrix representing a 2D translation.
Definition affinegeometry.hxx:64
void moveDCToCenter(...)
Rearrange the quadrants of a Fourier image so that the origin is in the image center.
void affineWarpImage(...)
Warp an image according to an affine transformation.
void transformToPolarCoordinates(SplineImage const &src, DestIterator d_ul, DestIterator d_lr, DestAccessor d_acc)
Transforms a given image to its (image-centered) polar coordinates representation.
Definition affine_registration_fft.hxx:112
void estimateGlobalRotationTranslation(...)
Estimate the (global) rotation and translation between two images by means a normalized cross correla...
void normalizedCrossCorrelation(...)
This function performes a (slow) normalized cross-correlation.
void estimateGlobalRotation(...)
Estimate the rotation between two images by means of a normalized cross correlation matching of the F...
void copyImage(...)
Copy source image into destination image.