123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- #pragma once
- #include <string>
- namespace graft_cv{
- typedef unsigned char byte;
- typedef struct
- {
- int channel;
- int width;
- int height;
- byte *data;
- }ImgInfo;
- typedef struct{
- // 调试控制 (5)
- bool image_show;//true--显示处理过程中的中间图片,需要人工回车才能继续执行; false--无图片显示
- bool image_return;//true--返回结果positoninfo中添加返回的图片; false--无图片返回
- int image_row_grid;
- int image_col_grid;
- bool self_camera;
- // timeout (2)
- int timeout_proc; //单个接口处理时间,500ms
- int timeout_append; //100ms
- //image storage parameters(3)
- bool image_save;//是否保存图像
- std::string image_depository;//保存图像目录
- int image_backup_days;//保存图像天数,过期删除
-
- // optimal angle parameters (15)
- bool oa_y_flip;
- int oa_morph_radius;//optimal-angle, open-operation morph-size, = 1;-->COptimalAngle::imgproc(Mat& img)
- int oa_morph_iteration; //optimal-angle, open-operation times, = 5; -->COptimalAngle::imgproc(Mat& img)
- int oa_min_leaf_area; //最小叶片像素面积
- //int oa_min_hist_value;// optimal-angle, columns-histogram, threshold; -->COptimalAngle::imgproc(Mat& img)
- //double oa_col_th_ratio;// = 0.7, rootstock binary image column histogram, threshold ratio for max-value, for
- // detect stem x-range
- //double oa_row_th_ratio; // = 1.2, row histogram of stem x-range subimage, stem diameter ratio for detect
- // stem fork position
- //int oa_stem_x_padding; // = 20;
- //int oa_stem_dia_min; //=20,
- //int oa_stem_fork_y_min;//=10,茎分叉点到茎根最下像素数量
- //double oa_stem_dia_mp; //=0.8,
- //int oa_morph_radius_base;//基质二值化参数
- //int oa_morph_iteration_base; //基质二值化参数
- //int oa_min_hist_value_base;//基质二值化参数
- //int oa_clip_y_min;//定位夹子上边缘y值
- //int oa_clip_y_max;//定位夹子下边缘y值
-
- //rootstock cut parameters (20)
- bool rs_y_flip;
- int rs_min_hist_value;
- double rs_col_th_ratio;// = 0.7, rootstock binary image column histogram, threshold ratio for max-value, for
- // detect stem x-range
- double rs_row_th_ratio; // = 1.2, row histogram of stem x-range subimage, stem diameter ratio for detect
- // stem fork position
- int rs_stem_x_padding; // = 20;
- int rs_stem_dia_min; //=20,
- double rs_stem_dia_mp; //=0.8,
- int rs_stem_fork_y_min;//=10,茎分叉点到茎根最下像素数量
- int rs_stem_edge_detect_window;//=5, 茎单侧边缘点检测,检测时的窗口像素数量
- //和茎粗相关,此数据应小于茎粗(像素数)
- double rs_cand_corner_box_width_ratio;//=3.0 基于茎fork点,茎右侧边缘点为参考点,检测候选角点区域, 茎粗的倍数
- double rs_cand_corner_box_xoffset_ratio;//=-10,cand_corner_box x方向偏移量, 茎粗的倍数
- double rs_opt_corner_xoffset_ratio;//=0.75, 最优切割角点,与参考点间的距离,与茎粗的比率,也就是
- // 最优切割点距离参考点有几倍的茎粗
- double rs_opt_corner_yoffset_ratio;
- double rs_corner_mask_rad_ratio;//二值图像角点检测后,度量角点质量用模板半径系数,为茎粗的几倍
-
- int rs_morph_radius;//=1, open-operation morph-size, = 1;-->COptimalAngle::imgproc(Mat& img)
- int rs_morph_iteration;// = 2
- int rs_morph_iteration_gray;//=5
- int rs_max_corner_num;//=100;
- double rs_corner_qaulity_level;// = 0.1;
- double rs_corner_min_distance;// = 10;
- double rs_cut_angle; //=-135 以上切割点为中心,切削茎的方向,(-180.0,180.0)
- double rs_cut_point_offset_ratio;//向下偏移比例,内接圆半径的倍数0-1.0
- //scion cut parameters (14)
- bool sc_y_flip;
- double sc_col_th_ratio;// = 0.7, scion binary image column histogram, threshold ratio for max-value, for
- // detect stem x-range
- double sc_row_th_ratio; // = 0.66, row histogram of stem x-range subimage, stem diameter ratio for detect
- // stem fork position, x0----x1范围内横向投影,投影值除以(x1-x0)大于此系数即找到边界
- int sc_stem_x_padding; // = 50;
- int sc_stem_dia_min; //=20,
- int sc_clip_padding;//=5 夹子向下间隔,这个间隔向下开始当做茎来处理
- int sc_stem_ymax_padding;//=50 第一次检测到茎最下端(因夹子影响,茎偏小),加大检测范围
- int sc_default_cut_length;//如果没有找到fold_point,直接估计出fold_point
- int sc_stem_edge_detect_window;//=5, 茎单侧边缘点检测,检测时的窗口像素数量
- //和茎粗相关,此数据应小于茎粗(像素数)
- double sc_r2_th; //threshold for r2 ratio
- int sc_r2_window; //= 5; the radius for calculate r2 index
- int sc_average_window;// =10;
- int sc_morph_radius;//scion, open-operation morph-size, = 1;-->COptimalAngle::imgproc(Mat& img)
- int sc_morph_iteration; //scion, open-operation times, = 5; -->COptimalAngle::imgproc(Mat& img)
-
- // camera pixel ratio (3)
- double rs_oa_pixel_ratio; // rootstock optimal-angle camera pixel ratio for millimeter, mm/piexel
- double rs_cut_pixel_ratio; // rootstock cutting camera pixel ratio for millimeter, mm/piexel
- double sc_cut_pixel_ratio; // scion cutting camera pixel ratio for millimeter, mm/piexel
-
- // rootstock grab based points cloud
- double rs_grab_xmin;
- double rs_grab_xmax;
- double rs_grab_ymin;
- double rs_grab_ymax;
- double rs_grab_zmin;
- double rs_grab_zmax;
- double rs_grab_stem_diameter;
- double rs_grab_seedling_dist;
- int rs_grab_stem_min_pts;
- double rs_grab_ror_ratio;
- double rs_grab_offset;
- double rs_grab_fork_th;
- double rs_grab_fork_yup; //茎节高度上限
- double rs_grab_fork_ybt; //茎节高度下限, 不在范围内,按下限
- // scion grab based points cloud
- double sc_grab_xmin;
- double sc_grab_xmax;
- double sc_grab_ymin;
- double sc_grab_ymax;
- double sc_grab_zmin;
- double sc_grab_zmax;
- double sc_grab_stem_diameter;
- double sc_grab_seedling_dist;
- int sc_grab_stem_min_pts;
- double sc_grab_ror_ratio;
- double sc_grab_offset;
- double sc_grab_fork_th;
- double sc_grab_fork_yup; //茎节高度上限
- double sc_grab_fork_ybt; //茎节高度下限, 不在范围内,按下限
-
- } ConfigParam;
- typedef struct
- {
- //以下涉及到位置均为实际位置,毫米
- double rs_grab_x;//砧木上苗抓取位置x,毫米
- double rs_grab_y;//砧木上苗抓取位置y,毫米
- double rs_grab_z;//砧木上苗抓取位置z,毫米
- double rs_width; //茎的宽度(直径),毫米
- double rs_tortuosity; //弯曲度,离茎中心轴线最大距离,毫米
- double rs_count; //当前第一排共有多少株
- double sc_grab_x;//穗苗上苗抓取位置x,毫米
- double sc_grab_y;//穗苗上苗抓取位置y,毫米
- double sc_grab_z;//穗苗上苗抓取位置z,毫米
- double sc_width; //茎的宽度(直径),毫米
- double sc_tortuosity; //弯曲度,离茎中心轴线最大距离,毫米
- double sc_count; //当前第一排共有多少株
- double rs_oa;//砧木最优角度
- //double rs_oa_base;//砧木基质最优角度
- //double rs_oa_stem_y_fork;//茎分叉点y,毫米
- //double rs_oa_clamp_y_end;//茎可视下端y,毫米
- //int rs_oa_width;//每一帧返回叶展宽度
- //int rs_oa_width_base;//每一帧返回基质宽度
-
- double rs_cut_upoint_x;//砧木上切割点x位置,毫米
- double rs_cut_upoint_y;//砧木上切割点y位置,毫米
- double rs_stem_diameter;//砧木茎粗,毫米
- double rs_cut_lpoint_x;//砧木下切割点x位置,毫米
- double rs_cut_lpoint_y;//砧木下切割点y位置,毫米
- char rs_img_id[64];
- double rs_reid_upoint_x;//切后砧木上切割点x位置,毫米
- double rs_reid_upoint_y;//切后砧木上切割点y位置,毫米
- double rs_reid_lpoint_x;//切后砧木下切割点x位置,毫米
- double rs_reid_lpoint_y;//切后砧木下切割点y位置,毫米
- double rs_reid_sola_upoint_x;//茄科切后砧木上切割点x位置,毫米
- double rs_reid_sola_upoint_y;//茄科切后砧木上切割点y位置,毫米
- double rs_reid_sola_cpoint_x;//茄科切后砧木中切割点x位置,毫米
- double rs_reid_sola_cpoint_y;//茄科切后砧木中切割点y位置,毫米
- double rs_reid_sola_lpoint_x;//茄科切后砧木下切割点x位置,毫米
- double rs_reid_sola_lpoint_y;//茄科切后砧木下切割点y位置,毫米
- double sc_reid_sola_upoint_x;//茄科穗苗切后上切割点x位置,毫米
- double sc_reid_sola_upoint_y;//茄科穗苗切后上切割点y位置,毫米
- double sc_reid_sola_cpoint_x;//茄科穗苗切后中切割点x位置,毫米
- double sc_reid_sola_cpoint_y;//茄科穗苗切后中切割点y位置,毫米
- double sc_reid_sola_lpoint_x;//茄科穗苗切后下切割点x位置,毫米
- double sc_reid_sola_lpoint_y;//茄科穗苗切后下切割点y位置,毫米
- double sc_cut_upoint_x;//穗苗上切割点x位置,毫米
- double sc_cut_upoint_y;//穗苗上切割点y位置,毫米
- double sc_cut_cpoint_x;//穗苗切割中点x位置,毫米
- double sc_cut_cpoint_y;//穗苗切割中点y位置,毫米
- double sc_cut_lpoint_x;//穗苗切割下点x位置,毫米
- double sc_cut_lpoint_y;//穗苗切割下点y位置,毫米
-
- ImgInfo* pp_images[5];//参考图片,只读,从前向后,没有的会被置零
-
- }PositionInfo;
- };
|