19 #ifndef LK_OPTICAL_FLOW_LK_OPTICAL_FLOW_H_
20 #define LK_OPTICAL_FLOW_LK_OPTICAL_FLOW_H_
23 #include <ff_msgs/Feature2d.h>
24 #include <ff_msgs/Feature2dArray.h>
26 #include <cv_bridge/cv_bridge.h>
29 #include <opencv2/core/core.hpp>
38 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 void OpticalFlow(
const sensor_msgs::ImageConstPtr& msg,
44 ff_msgs::Feature2dArray* features);
45 sensor_msgs::Image::Ptr
ShowDebugWindow(
const sensor_msgs::ImageConstPtr& msg);
48 void AddNewFeatures(
const std::vector<cv::Point2f>& new_points);
49 void GetNewFeatures(std::vector<cv::Point2f>* new_corners);
50 void CreateFeatureArray(ff_msgs::Feature2dArray* features);
52 void UpdateIdList(
const size_t& num_itr);
54 cv::Mat image_curr_, image_prev_;
56 sensor_msgs::ImageConstPtr image_prev_ptr_;
57 std::vector<cv::Point2f> prev_corners_, curr_corners_, backwards_corners_;
59 std::vector<uchar> status_, backwards_status_;
60 std::vector<float> err_, backwards_err_;
63 bool ignored_last_frame_;
65 int max_lk_pyr_level_;
70 float max_flow_magnitude_, font_size_, max_feature_rad_;
72 std::vector<int> id_list_;
78 #endif // LK_OPTICAL_FLOW_LK_OPTICAL_FLOW_H_