12345678910111213141516171819202122232425262728293031 |
- #pragma once
- #include <opencv2\imgproc\imgproc.hpp>
- using namespace cv;
- namespace graft_cv{
- // CForkDetectOptimal类实现优化
- // 用于优化分叉点检测
- // 要求:1)分叉点位于茎中心
- // 2)通过分叉点的线能够实现有效切割
- // 方法:通过茎中心线上的点,切割角度,找到不伤叶子的最优位置进行切割
- // 采用虚拟切割线两侧区域前景对比的方法
- class CForkDetectOptimal
- {
- public:
- CForkDetectOptimal();
- CForkDetectOptimal(int w, int h);
- ~CForkDetectOptimal();
- double center_pt_index(const Mat& binimg, Point¢, double cut_angle);
- void set_roi_size(int w, int h);
- void get_roi_size(int &w, int &h);
- private:
- int m_roi_width;
- int m_roi_height;
- double roi_object_size(const Mat& binimg, RotatedRect &rrect);
- bool is_in_rrect(Point2f* ptf4,Point2f ptf, float fAngle);
- };
- };
|