// Grafting is the process of joining two plants together //(an upper portion and a lower portion) to grow as one. //The upper portion of the plant is known as the scion, //which is attached to the lower portion known as the rootstock. //rs -- rootstock, sc -- scion #pragma once #include "data_def_api.h" using namespace std; //定义GCV_DEBUG,每一步图像处理都会输出中间结果图片显示(opencv),回车后继续执行,用于测试 // #define GCV_DEBUG // export #define GCV_EXPORTS #ifdef GCV_EXPORTS #define GCV_API __declspec(dllexport) #else #define GCV_API __declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif namespace graft_cv { //1 设置log路径 GCV_API int cv_set_logpath(char*lpath); //2 设置log等级 GCV_API int cv_set_loglevel(int lev);// 0-debug, 1-info, 2-warning, 3-error //3 设置是否存储图片(存储路径在configure文件中),true--保存,false--不保存 GCV_API int cv_init_image_saver(); //4 初始化:本地配置文件初始化(yml) // 返回: 0- 正常; 1- 配置文件不存在 GCV_API int cv_init(char*conf_file); //5 初始化:通过ConfigParam结构体对象直接赋值配置参数(内存) GCV_API void cv_set_param(ConfigParam&); //6 接口退出前的释放 GCV_API int cv_release(); //7 获取当前配置文件路径,输入char*要空间足够,内部没有检测是否越界 GCV_API void cv_get_conf_file(char*); //8 保存到本地配置文件中(覆盖) GCV_API void cv_save_param(char* conf_file/*=0*/); //9 获取当前的配置参数 GCV_API void cv_get_param(ConfigParam&); //10 获取当前版本号,char*要空间足够,内部没有检测是否越界 GCV_API void get_version(char* buf); //11 砧木最优角度识别初始化,每一株均需初始化一次 // 返回: 0- 正常; 其他- 失败 GCV_API int rs_oa_init(); //12 砧木最优角度识别,追加图像,要求图像的角度按顺序,第一帧图像角度为0,最后一帧图像角度为180 // 每次追加图片,通过posinfo返回: // 1)叶展宽度posinfo.rs_oa_width; // 2) 基质宽度posinfo.rs_oa_width_base // 3) 茎分叉点y posinfo.rs_oa_stem_y_fork;//茎分叉点y,毫米 // 4) 茎可视下端y posinfo.rs_oa_clamp_y_end;//茎可视下端y,毫米 // 5)2帧图像:posinfo.pp_images[0]--砧木分割二值图像 (return image 为 true时) // posinfo.pp_images[1]--基质分割二值图像 // 返回: 0- 正常; 1- 失败 GCV_API int rs_oa_append(ImgInfo*, PositionInfo& posinfo); //13 获取砧木最优角度 // 返回posinfo.rs_oa, // posinfo.rs_oa_base // posinfo.rs_oa_stem_y_fork, // posinfo.rs_oa_clamp_y_end, // 返回: 0- 正常; 1- 失败 GCV_API int rs_oa_get_result(PositionInfo& posinfo); //14 砧木切割点识别,返回 // posinfo.rs_cut_edge_length // posinfo.rs_cut_upoint_x // posinfo.rs_cut_upoint_y // posinfo.rs_stem_diameter // posinfo.pp_images (return image 为 true时) // 返回3张图片:图0:二值图像,含茎x-range,茎分叉点右侧边缘坐标(circle中心) // 图1: 灰度图,候选角点(circle),候选框,参考点(茎分叉点右侧边缘坐标) // 图2:灰度图,上切割点,候选框,参考点,下切点(circle中心),根点(circle中心) // 返回: 0- 正常; 1- 失败 GCV_API int rs_cut_point(ImgInfo*, PositionInfo& posinfo); //15 砧木切割点切后识别,返回 // posinfo.rs_becut_upoint_x // posinfo.rs_becut_upoint_y // posinfo.pp_images (return image 为 true时) // 返回1张图片:图0:二值图像,含茎x-range,上切点(circle中心),下切点(circle中心),根点(circle中心) // // 返回: 0- 正常; 1- 失败 //GCV_API int rs_cut_point_reid(ImgInfo*, double edge_length, PositionInfo& posinfo); //16 穗苗上切割点识别,返回 // posinfo.sc_cut_upoint_x; // posinfo.sc_cut_upoint_y; // posinfo.sc_cut_cpoint_x; // posinfo.sc_cut_cpoint_y; // posinfo.pp_images (return image 为 true时) // 返回1张图片:图0:二值图像,含茎x-range,茎分叉点水平线,尖点水平线,上切点(circle中心),中切点(circle中心) // // 返回: 0- 正常; 1- 失败 GCV_API int sc_cut_point(ImgInfo*, PositionInfo& posinfo); };//namespace graft_cv #ifdef __cplusplus } #endif