ICalibration.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef __I_CALIBRATION_H__
  2. #define __I_CALIBRATION_H__
  3. // *****************************************************************************
  4. // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
  5. // 保留所有权利
  6. // *****************************************************************************
  7. // 作者 : 陆蕴凡
  8. // 版本 : 1.0
  9. // 代码创建日期:2024/12/6
  10. // 版本更新日期:2024/12/6
  11. // 功能说明:标定算法接口
  12. // *****************************************************************************
  13. #include <vector>
  14. #include <string>
  15. #include "TypeDef.h"
  16. namespace JVision
  17. {
  18. /**
  19. * @brief 标定算法接口基类
  20. *
  21. */
  22. class JVision_API ICalibration
  23. {
  24. public:
  25. virtual ~ICalibration() = 0 {}
  26. /**
  27. * @brief 九点手眼标定
  28. *
  29. * @param[in] World_Points 机械坐标的集合 Point2D中x为机械列坐标,y为机械行坐标
  30. * @param[in] Image_Points 图像坐标的集合 Point2D中x为图像列坐标,y为图像行坐标
  31. * @param[out] Result 矩阵的标定数据
  32. *
  33. * @return ResultCode 0表示成功 其余表示失败
  34. *
  35. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  36. * @note 该接口必须在继承类中实现
  37. */
  38. virtual ResultCode HandEyeCalibration(std::vector<JVision::Point2D> WorldPoints, std::vector<JVision::Point2D> ImagePoints, std::string& Result) = 0;
  39. /**
  40. * @brief 旋转标定
  41. *
  42. * @param[in] Image_Points 机械坐标的集合 Point2D中x为图像列坐标,y为图像行坐标
  43. * @param[out] Result 输出参数,表示拟合的圆信息(世界坐标系)
  44. *
  45. * @return ResultCode 0表示成功 其余表示失败
  46. *
  47. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  48. * @note 该接口必须在继承类中实现
  49. */
  50. virtual ResultCode RotateCalibraion(std::vector<JVision::Point2D> WorldPoints, CircleResult& Result) = 0;
  51. /**
  52. * @brief 旋转坐标转换(机械坐标间转换)
  53. *
  54. * @param[in] initialPoint 机械坐标
  55. * @param[in] angle 旋转角度(相对角度,顺时针为负,逆时针为正,angle)
  56. * @param[in] RotationCenter 旋转中心(机械坐标系)
  57. * @param[out] Result 输出参数,转换后的旋转机械坐标
  58. *
  59. * @return ResultCode 0表示成功 其余表示失败
  60. *
  61. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  62. * @note 该接口必须在继承类中实现
  63. */
  64. virtual ResultCode RotateAffine(Point InitialPoint, double angle, CircleResult RotationCenter, Point& Result) = 0;
  65. /**
  66. * @brief 像素坐标转换成机械坐标
  67. *
  68. * @param[in] initialPoint 像素坐标
  69. * @param[in] HandEyeMat 手眼矩阵
  70. * @param[out] ResultWorld 输出参数,转换后的机械坐标
  71. *
  72. * @return ResultCode 0表示成功 其余表示失败
  73. *
  74. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  75. * @note 该接口必须在继承类中实现
  76. */
  77. virtual ResultCode Image2WorldAffine(Point InitialImagePoint, std::string HandEyeMat, Point& ResultWorld) = 0;
  78. /**
  79. * @brief 机械坐标转换成像素坐标
  80. *
  81. * @param[in] initialPoint 机械坐标
  82. * @param[in] HandEyeMat 手眼矩阵
  83. * @param[out] ResultImage 输出参数,转换后的像素坐标
  84. *
  85. * @return ResultCode 0表示成功 其余表示失败
  86. *
  87. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  88. * @note 该接口必须在继承类中实现
  89. */
  90. virtual ResultCode World2ImageAffine(Point InitialWorldPoint, std::string HandEyeMat, Point& ResultImage) = 0;
  91. /**
  92. * @brief 检测手眼标定的精度
  93. *
  94. * @param[in] CamCenter 相机中心坐标
  95. * @param[in] HandEye 手眼矩阵
  96. * @param[out] Accuracy 标定误差:X方向与Y方向
  97. *
  98. * @return ResultCode 0表示成功 其余表示失败
  99. *
  100. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  101. * @note 该接口必须在继承类中实现
  102. */
  103. virtual ResultCode InspectResult(Point2D CamCenter, const std::string& HandEye, Point2D& Accuracy) = 0;
  104. /**
  105. * @brief 获取标定函数的实现类指针
  106. */
  107. static ICalibration* GetCalibration();
  108. };
  109. }
  110. #endif