#ifndef POWER_RUNE_RUNEDETECTOR_H #define POWER_RUNE_RUNEDETECTOR_H // OpenCV #include #include // STD #include #include #include #include #include "Blade.h" #include "AdamFitter.h" namespace rm_power_rune { class RuneDetector { public: RuneDetector(const int & bin_thres, const int & channel_thres, const int & color, const int & num_points); std::vector detect(const cv::Mat & input); cv::Mat preprocessImage(const cv::Mat & input) const; std::pair, std::vector> findRAndEnds(const cv::Mat & bin_img); static std::vector matchEnds(std::vector &far_ends, std::vector &near_ends); void getAngularV(const std::vector& blades); static void rotatePoints(const cv::Point& center, std::vector& Points, double angle); int binary_thres; int channel_thres; int detect_color; int num_points; // For debug usage cv::Mat binary_img; void drawEnds(cv::Mat & img); int drawResults(cv::Mat & img); private: int width_; int height_; double distance_r_to_center_; double t_; double time_point_; bool is_convergence_; std::vector target_points_; std::vector vec_t_; std::vector angular_v_; fitter::AdamFitter adam_fitter_; cv::Point2f r_; std::pair, std::vector> ends_; std::vector far_ends_; std::vector near_ends_; std::vector blades_; std::vector last_tilt_angles_; }; } #endif //POWER_RUNE_RUNEDETECTOR_H