52 #ifndef __PCL_WorldTransformation_h
53 #define __PCL_WorldTransformation_h
58 #include <pcl/Diagnostics.h>
74 #define __PCL_WCS_SPLINE_VERSION_CURRENT "2.0"
75 #define __PCL_WCS_SPLINE_VERSION_OLD "1.3"
76 #define __PCL_WCS_MIN_SPLINE_MAX_POINTS 1000
77 #define __PCL_WCS_MAX_SPLINE_MAX_DENSE_POINTS 2100
78 #define __PCL_WCS_MAX_SPLINE_MAX_DDM_POINTS 25000
79 #define __PCL_WCS_DEFAULT_SPLINE_MAX_DENSE_POINTS 2100
80 #define __PCL_WCS_DEFAULT_SPLINE_MAX_DDM_POINTS 4000
81 #define __PCL_WCS_DEFAULT_SPLINE_MAX_POINTS 4000
82 #define __PCL_WCS_DEFAULT_SPLINE_RBF RadialBasisFunction::DDMThinPlateSpline
83 #define __PCL_WCS_DEFAULT_SPLINE_ORDER 2
84 #define __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS 0.005F
85 #define __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_ENABLED true
86 #define __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_REJECT_FRACTION 0.10F
173 : m_transWI( transIW.Inverse() )
174 , m_transIW( transIW )
214 return m_transWI.Transform( p );
221 return m_transIW.Transform( p );
241 class PCL_CLASS XMLElement;
373 rbf_type rbf = __PCL_WCS_DEFAULT_SPLINE_RBF,
374 float smoothness = __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS,
375 int order = __PCL_WCS_DEFAULT_SPLINE_ORDER,
376 bool enableSimplifier = __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_ENABLED,
377 float simplifierRejectFraction = __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_REJECT_FRACTION,
379 : m_controlPointsW( controlPointsW )
380 , m_controlPointsI( controlPointsI )
383 , m_smoothness( smoothness )
384 , m_useSimplifiers( enableSimplifier )
385 , m_simplifierRejectFraction( simplifierRejectFraction )
386 , m_weights( weights )
388 EnsureValidRBFParameters();
390 CalculateLinearApproximation();
429 EnsureValidRBFParameters();
431 if ( linearIW.IsSingularMatrix() )
432 CalculateLinearApproximation();
434 m_linearIW = linearIW;
472 return m_controlPointsW.IsEmpty() || m_controlPointsI.IsEmpty();
501 if ( m_gridWI.IsValid() )
502 if ( m_gridWI.ReferenceRect().IncludesFast( pW ) )
503 return m_gridWI( pW );
504 return m_splineWI( pW );
525 if ( m_gridIW.IsValid() )
526 if ( m_gridIW.ReferenceRect().IncludesFast( pI ) )
527 return m_gridIW( pI );
528 return m_splineIW( pI );
567 PCL_PRECONDITION( deltaI >= 1 && deltaI <= 64 )
568 deltaI =
Range( deltaI, 1, 64 );
574 DRect rectW( std::numeric_limits<double>::max(), std::numeric_limits<double>::max(),
575 std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest() );
576 for (
int x = 0; x < rectI.
Width(); ++x )
577 for (
int p = 0; p < 2; ++p )
580 if ( pW.
x < rectW.
x0 )
582 if ( pW.
x > rectW.
x1 )
584 if ( pW.
y < rectW.
y0 )
586 if ( pW.
y > rectW.
y1 )
589 for (
int y = 0; y < rectI.
Height(); ++y )
590 for (
int p = 0; p < 2; ++p )
593 if ( pW.
x < rectW.
x0 )
595 if ( pW.
x > rectW.
x1 )
597 if ( pW.
y < rectW.
y0 )
599 if ( pW.
y > rectW.
y1 )
602 double deltaW = m_splineIW(
DPoint( -deltaI/2, -deltaI/2 ) ).DistanceTo(
603 m_splineIW(
DPoint( +deltaI/2, +deltaI/2 ) ) )/1.4142;
605 m_gridWI.Initialize( rectW, deltaW, m_splineWI,
false );
606 m_gridIW.Initialize( rectI, deltaI, m_splineIW,
false );
616 return m_gridWI.IsValid() && m_gridIW.IsValid();
628 return HasGridInterpolations() ? m_gridIW.Delta() : 0.0;
637 return "PCL:AstrometricSolution:SplineWorldTransformation:";
669 return int( m_controlPointsW.Length() );
686 return m_controlPointsW;
703 return m_controlPointsI;
742 return m_maxSplinePoints;
765 xWI = m_splineWI.SplineX().Length();
766 yWI = m_splineWI.SplineY().Length();
767 xIW = m_splineIW.SplineX().Length();
768 yIW = m_splineIW.SplineY().Length();
796 return m_useSimplifiers;
806 return m_simplifierRejectFraction;
826 xWI = m_splineWI.ErrorX();
827 yWI = m_splineWI.ErrorY();
828 xIW = m_splineIW.ErrorX();
829 yIW = m_splineIW.ErrorY();
834 IsoString m_version = __PCL_WCS_SPLINE_VERSION_CURRENT;
837 rbf_type m_rbf = __PCL_WCS_DEFAULT_SPLINE_RBF;
838 int m_order = __PCL_WCS_DEFAULT_SPLINE_ORDER;
839 float m_smoothness = __PCL_WCS_DEFAULT_SPLINE_SMOOTHNESS;
840 int m_maxSplinePoints = __PCL_WCS_DEFAULT_SPLINE_MAX_POINTS;
841 bool m_useSimplifiers = __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_ENABLED;
842 float m_simplifierRejectFraction = __PCL_WCS_DEFAULT_SURFACE_SIMPLIFIER_REJECT_FRACTION;
844 bool m_truncated =
false;
863 void EnsureValidRBFParameters();
864 void InitializeSplines();
865 void CalculateLinearApproximation();
A generic point in the two-dimensional space.
component x
Abscissa (horizontal, or X-axis coordinate).
component y
Ordinate (vertical, or Y-axis coordinate).
A generic rectangle in the two-dimensional space.
component x1
Horizontal coordinate of the lower right corner.
component y1
Vertical coordinate of the lower right corner.
component y0
Vertical coordinate of the upper left corner.
component x0
Horizontal coordinate of the upper left corner.
component Width() const noexcept
component Height() const noexcept
Generic vector of arbitrary length.
Homography geometric transformation.
Eight-bit string (ISO/IEC-8859-1 or UTF-8 string)
Discretized vector surface interpolation/approximation in two dimensions.
Vector surface spline interpolation/approximation in two dimensions.
spline::rbf_type rbf_type
constexpr const T & Range(const T &x, const T &a, const T &b) noexcept