ICalibration.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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] Image_Points 机械坐标的集合 Point2D中x为图像列坐标,y为图像行坐标
  55. * @param[out] Result 输出参数,表示拟合的圆信息(世界坐标系)
  56. *
  57. * @return ResultCode 0表示成功 其余表示失败
  58. *
  59. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  60. * @note 该接口必须在继承类中实现
  61. */
  62. virtual ResultCode RotateCalibrationEllipse(std::vector<JVision::Point2D> WorldPoints, EllipseResult& Result) = 0;
  63. /**
  64. * @brief 旋转坐标转换(机械坐标间转换)
  65. *
  66. * @param[in] initialPoint 机械坐标
  67. * @param[in] angle 旋转角度(相对角度,顺时针为负,逆时针为正,angle)
  68. * @param[in] RotationCenter 旋转中心(机械坐标系)
  69. * @param[out] Result 输出参数,转换后的旋转机械坐标
  70. *
  71. * @return ResultCode 0表示成功 其余表示失败
  72. *
  73. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  74. * @note 该接口必须在继承类中实现
  75. */
  76. virtual ResultCode RotateAffine(Point InitialPoint, double angle, CircleResult RotationCenter, Point& Result) = 0;
  77. /**
  78. * @brief 像素坐标转换成机械坐标
  79. *
  80. * @param[in] initialPoint 像素坐标
  81. * @param[in] HandEyeMat 手眼矩阵
  82. * @param[out] ResultWorld 输出参数,转换后的机械坐标
  83. *
  84. * @return ResultCode 0表示成功 其余表示失败
  85. *
  86. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  87. * @note 该接口必须在继承类中实现
  88. */
  89. virtual ResultCode Image2WorldAffine(Point InitialImagePoint, std::string HandEyeMat, Point& ResultWorld) = 0;
  90. /**
  91. * @brief 机械坐标转换成像素坐标
  92. *
  93. * @param[in] initialPoint 机械坐标
  94. * @param[in] HandEyeMat 手眼矩阵
  95. * @param[out] ResultImage 输出参数,转换后的像素坐标
  96. *
  97. * @return ResultCode 0表示成功 其余表示失败
  98. *
  99. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  100. * @note 该接口必须在继承类中实现
  101. */
  102. virtual ResultCode World2ImageAffine(Point InitialWorldPoint, std::string HandEyeMat, Point& ResultImage) = 0;
  103. /**
  104. * @brief 检测手眼标定的精度
  105. *
  106. * @param[in] CamCenter 相机中心坐标
  107. * @param[in] HandEye 手眼矩阵
  108. * @param[out] Accuracy 标定误差:X方向与Y方向
  109. *
  110. * @return ResultCode 0表示成功 其余表示失败
  111. *
  112. * @note 对应的错误码类型可以通过ExecuteErrorCode中接口获取失败信息
  113. * @note 该接口必须在继承类中实现
  114. */
  115. virtual ResultCode InspectResult(Point2D CamCenter, const std::string& HandEye, Point2D& Accuracy) = 0;
  116. /**
  117. * @brief 获取标定函数的实现类指针
  118. */
  119. static ICalibration* GetCalibration();
  120. };
  121. }
  122. #endif