52 #ifndef __PCL_PixelInterpolation_h 53 #define __PCL_PixelInterpolation_h 58 #include <pcl/Diagnostics.h> 72 # pragma warning( push ) 73 # pragma warning( disable : 4267 ) // conversion from 'size_t' to ... 147 const sample* data,
int width,
int height,
bool unclipped =
false )
148 : m_interpolation( interpolation )
149 , m_unclipped( unclipped )
151 if ( !m_interpolation.IsNull() )
152 m_interpolation->Initialize( data, width, height );
178 PCL_PRECONDITION( !m_interpolation.IsNull() )
179 return *m_interpolation;
188 PCL_PRECONDITION( !m_interpolation.IsNull() )
189 return *m_interpolation;
205 PCL_PRECONDITION( !m_interpolation.IsNull() )
206 double r = (*m_interpolation)( x, y );
209 if ( r > P::MaxSampleValue() )
210 return P::MaxSampleValue();
211 if ( r < P::MinSampleValue() )
212 return P::MinSampleValue();
214 return P::FloatToSample( r );
223 template <
typename T>
226 return operator()( p.
x, p.
y );
257 virtual String Description()
const = 0;
286 template <
class P,
class T>
289 return new Interpolator<P>( NewInterpolation( data ), data, width, height, unclipped );
297 throw NotImplemented( *
this,
"Interpolate 32-bit floating point images" );
303 throw NotImplemented( *
this,
"Interpolate 64-bit floating point images" );
309 throw NotImplemented( *
this,
"Interpolate 32-bit complex images" );
315 throw NotImplemented( *
this,
"Interpolate 64-bit complex images" );
321 throw NotImplemented( *
this,
"Interpolate 8-bit integer images" );
327 throw NotImplemented( *
this,
"Interpolate 16-bit integer images" );
333 throw NotImplemented( *
this,
"Interpolate 32-bit integer images" );
369 return "Nearest neighbor interpolation";
437 return "Bilinear interpolation";
513 return String().
Format(
"Bicubic spline interpolation, c=%.2f", m_clamp );
615 return "Bicubic B-spline interpolation";
683 : m_rh(
Max( 1, rh ) )
684 , m_rv(
Max( 1, rv ) )
686 PCL_PRECONDITION( rh >= 1 )
687 PCL_PRECONDITION( rv >= 1 )
688 m_filter = filter.
Clone();
698 m_filter = x.m_filter->Clone();
717 return "Bicubic interpolation, " + m_filter->Description().
AppendFormat(
" (%dx%d)", 2*m_rh + 1, 2*m_rv + 1 );
805 PCL_PRECONDITION( n >= 1 )
806 PCL_PRECONDITION( clamp < 0 || 0 <= clamp && clamp <= 1 )
894 PCL_PRECONDITION( clamp < 0 || 0 <= clamp && clamp <= 1 )
906 String desc(
"Lanczos-3 LUT interpolation" );
979 : m_clamp(
Range( clamp, 0.0F, 1.0F ) )
981 PCL_PRECONDITION( clamp < 0 || 0 <= clamp && clamp <= 1 )
993 String desc(
"Lanczos-4 LUT interpolation" );
1066 : m_clamp(
Range( clamp, 0.0F, 1.0F ) )
1068 PCL_PRECONDITION( clamp < 0 || 0 <= clamp && clamp <= 1 )
1080 String desc(
"Lanczos-5 LUT interpolation" );
1126 # pragma warning( pop ) 1129 #endif // __PCL_PixelInterpolation_h String Description() const override
Bicubic filter interpolation algorithms.
traits_type::sample sample
A generic point in the two-dimensional space.
sample operator()(const GenericPoint< T > &p) const
BidimensionalInterpolation< sample > & Interpolation()
String Description() const override
sample operator()(double x, double y) const
Lanczos pixel interpolation.
const CubicFilter & Filter() const
Two dimensional LUT-based 3rd-order Lanczos interpolation algorithm.
Lanczos 3rd-order LUT-based pixel interpolation.
String Description() const override
String Description() const override
const BidimensionalInterpolation< sample > & Interpolation() const
constexpr const T & Max(const T &a, const T &b) noexcept
A smart pointer with exclusive object ownership and optional automatic object destruction.
An exception that indicates an unsupported feature.
traits_type::sample sample
Lanczos 5th-order LUT-based pixel interpolation.
Two dimensional Lanczos interpolation algorithm.
virtual ~PixelInterpolation()
Bicubic spline pixel interpolation.
Lanczos 3rd-order LUT-based pixel interpolation.
Generic two-dimensional pixel interpolator.
String & Format(const_c_string8 fmt,...)
Lanczos4LUTPixelInterpolation(float clamp=0.3F)
Bilinear pixel interpolation.
Bicubic B-Spline Interpolation Algorithm.
Two dimensional LUT-based 4th-order Lanczos interpolation algorithm.
BicubicSplinePixelInterpolation(double clamp=__PCL_BICUBIC_SPLINE_CLAMPING_THRESHOLD)
component x
Abscissa (horizontal, or X-axis coordinate).
Lanczos5LUTPixelInterpolation(float clamp=0.3F)
String Description() const override
LanczosPixelInterpolation(int n=3, float clamp=0.3)
Bicubic B-spline pixel interpolation.
virtual CubicFilter * Clone() const
BicubicFilterPixelInterpolation(int rh, int rv, const CubicFilter &filter)
virtual ~BicubicFilterPixelInterpolation()
String Description() const override
BicubicFilterPixelInterpolation(const BicubicFilterPixelInterpolation &x)
Two dimensional LUT-based 5th-order Lanczos interpolation algorithm.
Interpolator(BidimensionalInterpolation< sample > *interpolation, const sample *data, int width, int height, bool unclipped=false)
virtual bool IsThreadSafe() const
String Description() const override
traits_type::sample sample
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept
NearestNeighbor pixel interpolation.
Bicubic pixel interpolation - an alias for BicubicSplinePixelInterpolation.
String & AppendFormat(const_c_string8 fmt,...)
Mitchell-Netravali parameterized cubic filters.
Two-dimensional nearest neighbor interpolation algorithm.
String Description() const override
Lanczos3LUTPixelInterpolation(float clamp=0.3F)
Abstract root base class for all pixel interpolation algorithms.
component y
Ordinate (vertical, or Y-axis coordinate).
Bicubic spline interpolation algorithm.
BicubicPixelInterpolation(double c=__PCL_BICUBIC_SPLINE_CLAMPING_THRESHOLD)
String Description() const override
traits_type::sample sample
traits_type::sample sample
Bilinear interpolation algorithm.
Pixel interpolation based on Mitchell-Netravali parameterized bicubic filters.
Interpolator< P > * NewInterpolator(const T *data, int width, int height, bool unclipped=false) const