52 #ifndef __PCL_PhaseMatrices_h
53 #define __PCL_PhaseMatrices_h
87 template <
class P1,
class P2>
inline
94 if ( A.IsEmpty() || B.NumberOfPixels() != N )
95 throw Error(
"Invalid image geometry in PhaseCorrelationMatrix()" );
97 if ( R.NumberOfPixels() != N )
98 R.AllocateData( A.Width(), B.Width() );
100 if ( R.Status().IsInitializationEnabled() )
101 R.Status().Initialize(
"Phase correlation matrix", N );
108 for ( ; r < rN; ++r, ++a, ++b, ++R.Status() )
111 *r = P1::ToSample( num/
Max( tiny,
Abs( num ) ) );
136 template <
class P1,
class P2>
inline
143 if ( A.IsEmpty() || B.NumberOfPixels() != N )
144 throw Error(
"Invalid image geometry in CrossPowerSpectrumMatrix()" );
146 if ( R.NumberOfPixels() != N )
147 R.AllocateData( A.Width(), B.Width() );
149 if ( R.Status().IsInitializationEnabled() )
150 R.Status().Initialize(
"Cross power spectrum matrix", N );
157 for ( ; r < rN; ++r, ++a, ++b, ++R.Status() )
158 *r = P1::ToSample( (*b * ~*a)/
Max( tiny,
Abs( *a ) *
Abs( *b ) ) );
A simple exception with an associated error message.
typename pixel_traits::sample sample
T Abs(const Complex< T > &c) noexcept
void PhaseCorrelationMatrix(Complex< T > *__restrict__ i, const Complex< T > *__restrict__ j, const Complex< T > *__restrict__ a, const Complex< T > *__restrict__ b) noexcept
void CrossPowerSpectrumMatrix(Complex< T > *__restrict__ i, const Complex< T > *__restrict__ j, const Complex< T > *__restrict__ a, const Complex< T > *__restrict__ b) noexcept
constexpr const T & Max(const T &a, const T &b) noexcept