graft_cv_api.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // Grafting is the process of joining two plants together
  2. //(an upper portion and a lower portion) to grow as one.
  3. //The upper portion of the plant is known as the scion,
  4. //which is attached to the lower portion known as the rootstock.
  5. //rs -- rootstock, sc -- scion
  6. #pragma once
  7. #include "data_def_api.h"
  8. using namespace std;
  9. //定义GCV_DEBUG,每一步图像处理都会输出中间结果图片显示(opencv),回车后继续执行,用于测试
  10. // #define GCV_DEBUG
  11. // export
  12. #define GCV_EXPORTS
  13. #ifdef GCV_EXPORTS
  14. #define GCV_API __declspec(dllexport)
  15. #else
  16. #define GCV_API __declspec(dllimport)
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22. namespace graft_cv
  23. {
  24. //1 设置log路径
  25. GCV_API int cv_set_logpath(char*lpath);
  26. //2 设置log等级
  27. GCV_API int cv_set_loglevel(int lev);// 0-debug, 1-info, 2-warning, 3-error
  28. //3 设置是否存储图片(存储路径在configure文件中),true--保存,false--不保存
  29. GCV_API int cv_init_image_saver();
  30. //4 初始化:本地配置文件初始化(yml)
  31. // 返回: 0- 正常; 1- 配置文件不存在
  32. GCV_API int cv_init(char*conf_file);
  33. //5 初始化:通过ConfigParam结构体对象直接赋值配置参数(内存)
  34. GCV_API void cv_set_param(ConfigParam&);
  35. GCV_API int cv_set_param_from_file(char*conf_file);
  36. //6 接口退出前的释放
  37. GCV_API int cv_release();
  38. //7 获取当前配置文件路径,输入char*要空间足够,内部没有检测是否越界
  39. GCV_API void cv_get_conf_file(char*);
  40. //8 保存到本地配置文件中(覆盖)
  41. GCV_API void cv_save_param(char* conf_file/*=0*/);
  42. //9 获取当前的配置参数
  43. GCV_API void cv_get_param(ConfigParam&);
  44. //10 获取当前版本号,char*要空间足够,内部没有检测是否越界
  45. GCV_API void get_version(char* buf);
  46. //11 茄科上苗,基于3d点云,找到抓取位置, 砧木
  47. //
  48. // 输入: points --- 输入, 指向点云的指针,点云为3值一组,结构:[pt0.x, pt0.y, pt0.z, pt1.x, pt1.y,pt1.z], 有时是4值一组(视采集设备数据情况)
  49. // pixel_size --- 输入,一个点云的维度(一般3或4)
  50. // pt_size-------- 输入, 点云数量,上例中数量为2
  51. // posinfo ------- 输出
  52. // double rs_grab_x; //砧木上苗抓取位置x,毫米
  53. // double rs_grab_y; //砧木上苗抓取位置y,毫米
  54. // double rs_grab_z; //砧木上苗抓取位置z,毫米
  55. // double rs_fork_x; //砧木上苗茎节位置x,毫米
  56. // double rs_fork_y; //砧木上苗茎节位置y,毫米
  57. // double rs_fork_z; //砧木上苗茎节位置z,毫米
  58. // double rs_width; //茎的宽度(直径),毫米
  59. // double rs_tortuosity; //弯曲度,离茎中心轴线最大距离,毫米
  60. // double rs_count; //当前第一排共有多少株
  61. // ImgInfo* pp_images[5]; //返回的处理结果图片
  62. //
  63. // fn ------------ 输入, points指向0,且fn可用时,读取文件中的数据(用于测试),仅支持ply格式
  64. //
  65. // 返回: 0- 正常; 其他- 失败
  66. GCV_API int sola_grab_point_rs(float* points, int pixel_size, int pt_size, PositionInfo& posinfo, const char* fn = 0);
  67. //12 茄科上苗,基于3d点云,找到抓取位置, 穗苗
  68. //
  69. // 输入: points --- 输入, 指向点云的指针,点云为3值一组,结构:[pt0.x, pt0.y, pt0.z, pt1.x, pt1.y,pt1.z], 有时是4值一组(视采集设备数据情况)
  70. // pixel_size --- 输入,一个点云的维度(一般3或4)
  71. // pt_size-------- 输入, 点云数量,上例中数量为2
  72. // posinfo ------- 输出
  73. // double sc_grab_x; //穗苗上苗抓取位置x,毫米
  74. // double sc_grab_y; //穗苗上苗抓取位置y,毫米
  75. // double sc_grab_z; //穗苗上苗抓取位置z,毫米
  76. // double sc_width; //茎的宽度(直径),毫米
  77. // double sc_tortuosity; //弯曲度,离茎中心轴线最大距离,毫米
  78. // double sc_count; //当前第一排共有多少株
  79. // ImgInfo* pp_images[5]; //返回的处理结果图片
  80. //
  81. // fn ------------ 输入, points指向0,且fn可用时,读取文件中的数据(用于测试),仅支持ply格式
  82. //
  83. // 返回: 0- 正常; 其他- 失败
  84. GCV_API int sola_grab_point_sc(float* points, int pixel_size, int pt_size, PositionInfo& posinfo, const char* fn = 0);
  85. //13 3d点云棋盘格标定功能,通过输入的点云(棋盘格点云),识别点云上的交叉点,并输出交叉点坐标
  86. GCV_API int chessboard_calibration(float* points, int pixel_size, int pt_size, PositionInfo& posinfo, const char* fn = 0);
  87. };//namespace graft_cv
  88. #ifdef __cplusplus
  89. }
  90. #endif