40 #include <pcl/common/intensity.h> 41 #include <pcl/common/transformation_from_correspondences.h> 42 #include <pcl/tracking/tracker.h> 62 template <
typename PointInT,
73 using Ptr = shared_ptr<PyramidalKLTTracker<PointInT, IntensityT>>;
74 using ConstPtr = shared_ptr<const PyramidalKLTTracker<PointInT, IntensityT>>;
82 int tracking_window_width = 7,
83 int tracking_window_height = 7)
97 kernel_ << 1.f / 16, 1.f / 4, 3.f / 8, 1.f / 4, 1.f / 16;
353 const Eigen::Array2i& location,
354 const Eigen::Array4f& weights,
355 Eigen::ArrayXXf& win,
356 Eigen::ArrayXXf& grad_x_win,
357 Eigen::ArrayXXf& grad_y_win,
358 Eigen::Array3f& covariance)
const;
361 const Eigen::ArrayXXf& prev_grad_x,
362 const Eigen::ArrayXXf& prev_grad_y,
364 const Eigen::Array2i& location,
365 const Eigen::Array4f& weights,
366 Eigen::Array2f& b)
const;
376 std::vector<FloatImageConstPtr>& pyramid,
382 const std::vector<FloatImageConstPtr>& previous_pyramid,
383 const std::vector<FloatImageConstPtr>& current_pyramid,
386 std::vector<int>& status,
387 Eigen::Affine3f& motion)
const;
443 #include <pcl/tracking/impl/pyramidal_klt.hpp> int track_height_2_
half of tracking window height
int track_width_
tracking width
typename PointCloudIn::ConstPtr PointCloudInConstPtr
~PyramidalKLTTracker()
Destructor.
void setEpsilon(float epsilon)
Set epsilon.
typename PointCloudIn::Ptr PointCloudInPtr
shared_ptr< const PyramidalKLTTracker< PointInT, IntensityT > > ConstPtr
void setTrackingWindowHeight(int height)
Set tracking window height.
shared_ptr< PointCloud< float > > Ptr
void setNumberOfKeypoints(std::size_t number)
Set the maximum number of points to track after sorting detected keypoints according to their respons...
Defines functions, macros and traits for allocating and using memory.
void derivatives(const FloatImage &src, FloatImage &grad_x, FloatImage &grad_y) const
compute Scharr derivatives of a source cloud.
void setAccuracy(float accuracy)
Set accuracy.
pcl::PointCloud< pcl::PointUV >::ConstPtr getTrackedPoints() const
int track_width_2_
half of tracking window width
void convolve(const FloatImageConstPtr &input, FloatImage &output) const
Separately convolve image with decomposable convolution kernel.
int nb_levels_
number of pyramid levels
FloatImage::ConstPtr FloatImageConstPtr
virtual void spatialGradient(const FloatImage &img, const FloatImage &grad_x, const FloatImage &grad_y, const Eigen::Array2i &location, const Eigen::Array4f &weights, Eigen::ArrayXXf &win, Eigen::ArrayXXf &grad_x_win, Eigen::ArrayXXf &grad_y_win, Eigen::Array3f &covariance) const
extract the patch from the previous image, previous image gradients surrounding pixel alocation while...
IndicesPtr indices_
A pointer to the vector of point indices to use.
PyramidalKLTTracker(int nb_levels=5, int tracking_window_width=7, int tracking_window_height=7)
Constructor.
pcl::PointCloud< PointInT > PointCloudIn
Eigen::Affine3f getResult() const override
Return the computed transformation from tracked points.
void mismatchVector(const Eigen::ArrayXXf &prev, const Eigen::ArrayXXf &prev_grad_x, const Eigen::ArrayXXf &prev_grad_y, const FloatImage &next, const Eigen::Array2i &location, const Eigen::Array4f &weights, Eigen::Array2f &b) const
virtual void computePyramids(const PointCloudInConstPtr &input, std::vector< FloatImageConstPtr > &pyramid, pcl::InterpolationType border_type) const
Compute the pyramidal representation of an image.
std::vector< FloatImageConstPtr > ref_pyramid_
input pyranid at t-1
void convolveCols(const FloatImageConstPtr &input, FloatImage &output) const
Convolve image columns.
pcl::TransformationFromCorrespondences transformation_computer_
compute transformation from successfully tracked points
bool getInitialized() const
std::size_t getNumberOfKeypoints()
bool initCompute() override
This method should get called before starting the actual computation.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
typename TrackerBase::PointCloudIn PointCloudIn
bool initialized_
is the tracker initialized ?
pcl::PointCloud< float > FloatImage
FloatImage::Ptr FloatImagePtr
Pyramidal Kanade Lucas Tomasi tracker.
pcl::PointIndicesConstPtr getPointsToTrackStatus() const
shared_ptr< PyramidalKLTTracker< PointInT, IntensityT > > Ptr
void convolveRows(const FloatImageConstPtr &input, FloatImage &output) const
Convolve image rows.
int kernel_last_
index of last element in kernel
void setTrackingWindowSize(int width, int height)
set the tracking window size
void setPointsToTrack(const pcl::PointIndicesConstPtr &points)
Provide a pointer to points to track.
std::size_t keypoints_nbr_
number of points to detect
Eigen::Affine3f motion_
computed transformation between tracked points
void downsample(const FloatImageConstPtr &input, FloatImageConstPtr &output) const
downsample input
float min_eigenvalue_threshold_
Defines all the PCL implemented PointT point type structures.
PointIndices::ConstPtr PointIndicesConstPtr
PointCloudInConstPtr ref_
point cloud at t-1
float getAccuracy() const
void setMaxIterationsNumber(unsigned int max)
Set the maximum number of iterations in the Lucas Kanade loop.
void setNumberOfThreads(unsigned int nr_threads=0)
Initialize the scheduler and set the number of threads to use.
Eigen::Array< float, 5, 1 > kernel_
smoothing kernel
float accuracy_
accuracy criterion to stop iterating
IntensityT intensity_
intensity accessor
float epsilon_
epsilon for subpixel computation
pcl::PointCloud< pcl::PointUV >::ConstPtr keypoints_
detected keypoints 2D coordinates
void setTrackingWindowWidth(int width)
Set tracking window width.
void setNumberOfPyramidLevels(int levels)
Set the number of pyramid levels.
void computeTracking() override
Abstract tracking method.
int getNumberOfPyramidLevels() const
shared_ptr< const PointCloud< float > > ConstPtr
int getTrackingWindowHeight()
Tracker represents the base tracker class.
int getTrackingWindowWidth()
PointCloudConstPtr input_
The input point cloud dataset.
PointCloudInConstPtr getReferenceCloud() const
Get a pointer of the cloud at t-1.
pcl::PointIndicesPtr keypoints_status_
status of keypoints of t-1 at t
unsigned int getMaxIterationsNumber() const
virtual void track(const PointCloudInConstPtr &previous_input, const PointCloudInConstPtr ¤t_input, const std::vector< FloatImageConstPtr > &previous_pyramid, const std::vector< FloatImageConstPtr > ¤t_pyramid, const pcl::PointCloud< pcl::PointUV >::ConstPtr &previous_keypoints, pcl::PointCloud< pcl::PointUV >::Ptr ¤t_keypoints, std::vector< int > &status, Eigen::Affine3f &motion) const
unsigned int threads_
number of hardware threads
Defines all the PCL and non-PCL macros used.
int track_height_
tracking height
int kernel_size_2_
smoothing kernel half size
std::string tracker_name_
The tracker name.
unsigned int max_iterations_
maximum number of iterations
PointIndices::Ptr PointIndicesPtr