HPose.h 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /***********************************************************
  2. * File generated by the HALCON-Compiler hcomp version 20.11
  3. * Usage: Interface to C++
  4. *
  5. * Software by: MVTec Software GmbH, www.mvtec.com
  6. ***********************************************************/
  7. #ifndef HCPP_HPOSE
  8. #define HCPP_HPOSE
  9. namespace HalconCpp
  10. {
  11. // Represents a rigid 3D transformation with 7 parameters (3 for the rotation, 3 for the translation, 1 for the representation type).
  12. class LIntExport HPose : public HDataBase
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HPose():HDataBase() {}
  17. // Copy constructor
  18. HPose(const HPose& source) : HDataBase(source) {}
  19. // Constructor from HTuple
  20. explicit HPose(const HTuple& tuple) : HDataBase(tuple) {}
  21. // Deep copy of all data represented by this object instance
  22. HPose Clone() const;
  23. /*****************************************************************************
  24. * Operator-based class constructors
  25. *****************************************************************************/
  26. // create_pose: Create a 3D pose.
  27. explicit HPose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const HString& OrderOfTransform, const HString& OrderOfRotation, const HString& ViewOfTransform);
  28. // create_pose: Create a 3D pose.
  29. explicit HPose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const char* OrderOfTransform, const char* OrderOfRotation, const char* ViewOfTransform);
  30. #ifdef _WIN32
  31. // create_pose: Create a 3D pose.
  32. explicit HPose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const wchar_t* OrderOfTransform, const wchar_t* OrderOfRotation, const wchar_t* ViewOfTransform);
  33. #endif
  34. /*****************************************************************************
  35. * Operator overloads
  36. *****************************************************************************/
  37. // Convert to matrix
  38. operator HHomMat3D() const;
  39. /***************************************************************************
  40. * Operators *
  41. ***************************************************************************/
  42. // Compute the average of a set of poses.
  43. static HPose PoseAverage(const HPoseArray& Poses, const HTuple& Weights, const HString& Mode, const HTuple& SigmaT, const HTuple& SigmaR, HTuple* Quality);
  44. // Compute the average of a set of poses.
  45. static HPose PoseAverage(const HPoseArray& Poses, const HTuple& Weights, const HString& Mode, double SigmaT, double SigmaR, HTuple* Quality);
  46. // Compute the average of a set of poses.
  47. static HPose PoseAverage(const HPoseArray& Poses, const HTuple& Weights, const char* Mode, double SigmaT, double SigmaR, HTuple* Quality);
  48. #ifdef _WIN32
  49. // Compute the average of a set of poses.
  50. static HPose PoseAverage(const HPoseArray& Poses, const HTuple& Weights, const wchar_t* Mode, double SigmaT, double SigmaR, HTuple* Quality);
  51. #endif
  52. // Invert each pose in a tuple of 3D poses.
  53. static HPoseArray PoseInvert(const HPoseArray& Pose);
  54. // Invert each pose in a tuple of 3D poses.
  55. HPose PoseInvert() const;
  56. // Combine 3D poses given in two tuples.
  57. static HPoseArray PoseCompose(const HPoseArray& PoseLeft, const HPoseArray& PoseRight);
  58. // Combine 3D poses given in two tuples.
  59. HPose PoseCompose(const HPose& PoseRight) const;
  60. // Compute the distance values for a rectified stereo image pair using multi-scanline optimization.
  61. HImage BinocularDistanceMs(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  62. // Compute the distance values for a rectified stereo image pair using multi-scanline optimization.
  63. HImage BinocularDistanceMs(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const HString& GenParamName, const HString& GenParamValue) const;
  64. // Compute the distance values for a rectified stereo image pair using multi-scanline optimization.
  65. HImage BinocularDistanceMs(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const char* GenParamName, const char* GenParamValue) const;
  66. #ifdef _WIN32
  67. // Compute the distance values for a rectified stereo image pair using multi-scanline optimization.
  68. HImage BinocularDistanceMs(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  69. #endif
  70. // Compute the distance values for a rectified stereo image pair using multigrid methods.
  71. HImage BinocularDistanceMg(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const HString& CalculateScore, const HTuple& MGParamName, const HTuple& MGParamValue) const;
  72. // Compute the distance values for a rectified stereo image pair using multigrid methods.
  73. HImage BinocularDistanceMg(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const HString& CalculateScore, const HString& MGParamName, const HString& MGParamValue) const;
  74. // Compute the distance values for a rectified stereo image pair using multigrid methods.
  75. HImage BinocularDistanceMg(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const char* CalculateScore, const char* MGParamName, const char* MGParamValue) const;
  76. #ifdef _WIN32
  77. // Compute the distance values for a rectified stereo image pair using multigrid methods.
  78. HImage BinocularDistanceMg(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const wchar_t* CalculateScore, const wchar_t* MGParamName, const wchar_t* MGParamValue) const;
  79. #endif
  80. // Compute the fundamental matrix from the relative orientation of two cameras.
  81. HHomMat2D RelPoseToFundamentalMatrix(const HTuple& CovRelPose, const HCamPar& CamPar1, const HCamPar& CamPar2, HTuple* CovFMat) const;
  82. // Compute the relative orientation between two cameras given image point correspondences and known camera parameters and reconstruct 3D space points.
  83. HTuple VectorToRelPose(const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& Method, HTuple* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ);
  84. // Compute the relative orientation between two cameras given image point correspondences and known camera parameters and reconstruct 3D space points.
  85. HTuple VectorToRelPose(const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ);
  86. // Compute the relative orientation between two cameras given image point correspondences and known camera parameters and reconstruct 3D space points.
  87. HTuple VectorToRelPose(const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const char* Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ);
  88. #ifdef _WIN32
  89. // Compute the relative orientation between two cameras given image point correspondences and known camera parameters and reconstruct 3D space points.
  90. HTuple VectorToRelPose(const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HTuple& CovRR1, const HTuple& CovRC1, const HTuple& CovCC1, const HTuple& CovRR2, const HTuple& CovRC2, const HTuple& CovCC2, const HCamPar& CamPar1, const HCamPar& CamPar2, const wchar_t* Method, double* Error, HTuple* X, HTuple* Y, HTuple* Z, HTuple* CovXYZ);
  91. #endif
  92. // Compute the relative orientation between two cameras by automatically finding correspondences between image points.
  93. HTuple MatchRelPoseRansac(const HImage& Image1, const HImage& Image2, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& GrayMatchMethod, Hlong MaskSize, Hlong RowMove, Hlong ColMove, Hlong RowTolerance, Hlong ColTolerance, const HTuple& Rotation, const HTuple& MatchThreshold, const HString& EstimationMethod, const HTuple& DistanceThreshold, Hlong RandSeed, HTuple* Error, HTuple* Points1, HTuple* Points2);
  94. // Compute the relative orientation between two cameras by automatically finding correspondences between image points.
  95. HTuple MatchRelPoseRansac(const HImage& Image1, const HImage& Image2, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HCamPar& CamPar1, const HCamPar& CamPar2, const HString& GrayMatchMethod, Hlong MaskSize, Hlong RowMove, Hlong ColMove, Hlong RowTolerance, Hlong ColTolerance, double Rotation, Hlong MatchThreshold, const HString& EstimationMethod, double DistanceThreshold, Hlong RandSeed, double* Error, HTuple* Points1, HTuple* Points2);
  96. // Compute the relative orientation between two cameras by automatically finding correspondences between image points.
  97. HTuple MatchRelPoseRansac(const HImage& Image1, const HImage& Image2, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HCamPar& CamPar1, const HCamPar& CamPar2, const char* GrayMatchMethod, Hlong MaskSize, Hlong RowMove, Hlong ColMove, Hlong RowTolerance, Hlong ColTolerance, double Rotation, Hlong MatchThreshold, const char* EstimationMethod, double DistanceThreshold, Hlong RandSeed, double* Error, HTuple* Points1, HTuple* Points2);
  98. #ifdef _WIN32
  99. // Compute the relative orientation between two cameras by automatically finding correspondences between image points.
  100. HTuple MatchRelPoseRansac(const HImage& Image1, const HImage& Image2, const HTuple& Rows1, const HTuple& Cols1, const HTuple& Rows2, const HTuple& Cols2, const HCamPar& CamPar1, const HCamPar& CamPar2, const wchar_t* GrayMatchMethod, Hlong MaskSize, Hlong RowMove, Hlong ColMove, Hlong RowTolerance, Hlong ColTolerance, double Rotation, Hlong MatchThreshold, const wchar_t* EstimationMethod, double DistanceThreshold, Hlong RandSeed, double* Error, HTuple* Points1, HTuple* Points2);
  101. #endif
  102. // Compute the distance values for a rectified stereo image pair using correlation techniques.
  103. HImage BinocularDistance(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HString& Method, Hlong MaskWidth, Hlong MaskHeight, const HTuple& TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, const HTuple& ScoreThresh, const HTuple& Filter, const HTuple& SubDistance) const;
  104. // Compute the distance values for a rectified stereo image pair using correlation techniques.
  105. HImage BinocularDistance(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HString& Method, Hlong MaskWidth, Hlong MaskHeight, double TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, double ScoreThresh, const HString& Filter, const HString& SubDistance) const;
  106. // Compute the distance values for a rectified stereo image pair using correlation techniques.
  107. HImage BinocularDistance(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const char* Method, Hlong MaskWidth, Hlong MaskHeight, double TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, double ScoreThresh, const char* Filter, const char* SubDistance) const;
  108. #ifdef _WIN32
  109. // Compute the distance values for a rectified stereo image pair using correlation techniques.
  110. HImage BinocularDistance(const HImage& ImageRect1, const HImage& ImageRect2, HImage* Score, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const wchar_t* Method, Hlong MaskWidth, Hlong MaskHeight, double TextureThresh, Hlong MinDisparity, Hlong MaxDisparity, Hlong NumLevels, double ScoreThresh, const wchar_t* Filter, const wchar_t* SubDistance) const;
  111. #endif
  112. // Get a 3D point from the intersection of two lines of sight within a binocular camera system.
  113. void IntersectLinesOfSight(const HCamPar& CamParam1, const HCamPar& CamParam2, const HTuple& Row1, const HTuple& Col1, const HTuple& Row2, const HTuple& Col2, HTuple* X, HTuple* Y, HTuple* Z, HTuple* Dist) const;
  114. // Get a 3D point from the intersection of two lines of sight within a binocular camera system.
  115. void IntersectLinesOfSight(const HCamPar& CamParam1, const HCamPar& CamParam2, double Row1, double Col1, double Row2, double Col2, double* X, double* Y, double* Z, double* Dist) const;
  116. // Transform a disparity image into 3D points in a rectified stereo system.
  117. HImage DisparityImageToXyz(const HImage& Disparity, HImage* Y, HImage* Z, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2) const;
  118. // Transform an image point and its disparity into a 3D point in a rectified stereo system.
  119. void DisparityToPoint3d(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HTuple& Row1, const HTuple& Col1, const HTuple& Disparity, HTuple* X, HTuple* Y, HTuple* Z) const;
  120. // Transform an image point and its disparity into a 3D point in a rectified stereo system.
  121. void DisparityToPoint3d(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double Row1, double Col1, double Disparity, double* X, double* Y, double* Z) const;
  122. // Transform a disparity value into a distance value in a rectified binocular stereo system.
  123. HTuple DisparityToDistance(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HTuple& Disparity) const;
  124. // Transform a disparity value into a distance value in a rectified binocular stereo system.
  125. double DisparityToDistance(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double Disparity) const;
  126. // Transform a distance value into a disparity in a rectified stereo system.
  127. HTuple DistanceToDisparity(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, const HTuple& Distance) const;
  128. // Transform a distance value into a disparity in a rectified stereo system.
  129. double DistanceToDisparity(const HCamPar& CamParamRect1, const HCamPar& CamParamRect2, double Distance) const;
  130. // Generate transformation maps that describe the mapping of the images of a binocular camera pair to a common rectified image plane.
  131. HImage GenBinocularRectificationMap(HImage* Map2, const HCamPar& CamParam1, const HCamPar& CamParam2, double SubSampling, const HString& Method, const HString& MapType, HCamPar* CamParamRect1, HCamPar* CamParamRect2, HPose* CamPoseRect1, HPose* CamPoseRect2, HPose* RelPoseRect) const;
  132. // Generate transformation maps that describe the mapping of the images of a binocular camera pair to a common rectified image plane.
  133. HImage GenBinocularRectificationMap(HImage* Map2, const HCamPar& CamParam1, const HCamPar& CamParam2, double SubSampling, const char* Method, const char* MapType, HCamPar* CamParamRect1, HCamPar* CamParamRect2, HPose* CamPoseRect1, HPose* CamPoseRect2, HPose* RelPoseRect) const;
  134. #ifdef _WIN32
  135. // Generate transformation maps that describe the mapping of the images of a binocular camera pair to a common rectified image plane.
  136. HImage GenBinocularRectificationMap(HImage* Map2, const HCamPar& CamParam1, const HCamPar& CamParam2, double SubSampling, const wchar_t* Method, const wchar_t* MapType, HCamPar* CamParamRect1, HCamPar* CamParamRect2, HPose* CamPoseRect1, HPose* CamPoseRect2, HPose* RelPoseRect) const;
  137. #endif
  138. // Determine all camera parameters of a binocular stereo system.
  139. static HCamPar BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HCamPar& StartCamParam1, const HCamPar& StartCamParam2, const HPoseArray& NStartPose1, const HPoseArray& NStartPose2, const HTuple& EstimateParams, HCamPar* CamParam2, HPoseArray* NFinalPose1, HPoseArray* NFinalPose2, HPose* RelPose, HTuple* Errors);
  140. // Determine all camera parameters of a binocular stereo system.
  141. HCamPar BinocularCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow1, const HTuple& NCol1, const HTuple& NRow2, const HTuple& NCol2, const HCamPar& StartCamParam1, const HCamPar& StartCamParam2, const HPose& NStartPose2, const HTuple& EstimateParams, HCamPar* CamParam2, HPose* NFinalPose1, HPose* NFinalPose2, HPose* RelPose, double* Errors) const;
  142. // Find the best matches of a calibrated descriptor model in an image and return their 3D pose.
  143. static HTuple FindCalibDescriptorModel(const HImage& Image, const HDescriptorModel& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, const HTuple& MinScore, Hlong NumMatches, const HCamPar& CamParam, const HTuple& ScoreType, HPoseArray* Pose);
  144. // Find the best matches of a calibrated descriptor model in an image and return their 3D pose.
  145. double FindCalibDescriptorModel(const HImage& Image, const HDescriptorModel& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, double MinScore, Hlong NumMatches, const HCamPar& CamParam, const HString& ScoreType);
  146. // Find the best matches of a calibrated descriptor model in an image and return their 3D pose.
  147. double FindCalibDescriptorModel(const HImage& Image, const HDescriptorModel& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, double MinScore, Hlong NumMatches, const HCamPar& CamParam, const char* ScoreType);
  148. #ifdef _WIN32
  149. // Find the best matches of a calibrated descriptor model in an image and return their 3D pose.
  150. double FindCalibDescriptorModel(const HImage& Image, const HDescriptorModel& ModelID, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, double MinScore, Hlong NumMatches, const HCamPar& CamParam, const wchar_t* ScoreType);
  151. #endif
  152. // Create a descriptor model for calibrated perspective matching.
  153. HDescriptorModel CreateCalibDescriptorModel(const HImage& Template, const HCamPar& CamParam, const HString& DetectorType, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, Hlong Seed) const;
  154. // Create a descriptor model for calibrated perspective matching.
  155. HDescriptorModel CreateCalibDescriptorModel(const HImage& Template, const HCamPar& CamParam, const char* DetectorType, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, Hlong Seed) const;
  156. #ifdef _WIN32
  157. // Create a descriptor model for calibrated perspective matching.
  158. HDescriptorModel CreateCalibDescriptorModel(const HImage& Template, const HCamPar& CamParam, const wchar_t* DetectorType, const HTuple& DetectorParamName, const HTuple& DetectorParamValue, const HTuple& DescriptorParamName, const HTuple& DescriptorParamValue, Hlong Seed) const;
  159. #endif
  160. // Prepare a deformable model for planar calibrated matching from XLD contours.
  161. HDeformableModel CreatePlanarCalibDeformableModelXld(const HXLDCont& Contours, const HCamPar& CamParam, const HTuple& NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& AngleStep, double ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, const HTuple& ScaleCStep, const HTuple& Optimization, const HString& Metric, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  162. // Prepare a deformable model for planar calibrated matching from XLD contours.
  163. HDeformableModel CreatePlanarCalibDeformableModelXld(const HXLDCont& Contours, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const HString& Optimization, const HString& Metric, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  164. // Prepare a deformable model for planar calibrated matching from XLD contours.
  165. HDeformableModel CreatePlanarCalibDeformableModelXld(const HXLDCont& Contours, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const char* Optimization, const char* Metric, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  166. #ifdef _WIN32
  167. // Prepare a deformable model for planar calibrated matching from XLD contours.
  168. HDeformableModel CreatePlanarCalibDeformableModelXld(const HXLDCont& Contours, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const wchar_t* Optimization, const wchar_t* Metric, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  169. #endif
  170. // Create a deformable model for calibrated perspective matching.
  171. HDeformableModel CreatePlanarCalibDeformableModel(const HImage& Template, const HCamPar& CamParam, const HTuple& NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& AngleStep, double ScaleRMin, const HTuple& ScaleRMax, const HTuple& ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, const HTuple& ScaleCStep, const HTuple& Optimization, const HString& Metric, const HTuple& Contrast, const HTuple& MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  172. // Create a deformable model for calibrated perspective matching.
  173. HDeformableModel CreatePlanarCalibDeformableModel(const HImage& Template, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const HString& Optimization, const HString& Metric, const HTuple& Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  174. // Create a deformable model for calibrated perspective matching.
  175. HDeformableModel CreatePlanarCalibDeformableModel(const HImage& Template, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const char* Optimization, const char* Metric, const HTuple& Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  176. #ifdef _WIN32
  177. // Create a deformable model for calibrated perspective matching.
  178. HDeformableModel CreatePlanarCalibDeformableModel(const HImage& Template, const HCamPar& CamParam, Hlong NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, double AngleStep, double ScaleRMin, const HTuple& ScaleRMax, double ScaleRStep, double ScaleCMin, const HTuple& ScaleCMax, double ScaleCStep, const wchar_t* Optimization, const wchar_t* Metric, const HTuple& Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  179. #endif
  180. // Create a 3D camera pose from camera center and viewing direction.
  181. static HPoseArray CreateCamPoseLookAtPoint(const HTuple& CamPosX, const HTuple& CamPosY, const HTuple& CamPosZ, const HTuple& LookAtX, const HTuple& LookAtY, const HTuple& LookAtZ, const HTuple& RefPlaneNormal, const HTuple& CamRoll);
  182. // Create a 3D camera pose from camera center and viewing direction.
  183. void CreateCamPoseLookAtPoint(double CamPosX, double CamPosY, double CamPosZ, double LookAtX, double LookAtY, double LookAtZ, const HTuple& RefPlaneNormal, double CamRoll);
  184. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  185. HPose TransPoseShapeModel3d(const HShapeModel3D& ShapeModel3DID, const HString& Transformation) const;
  186. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  187. HPose TransPoseShapeModel3d(const HShapeModel3D& ShapeModel3DID, const char* Transformation) const;
  188. #ifdef _WIN32
  189. // Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa.
  190. HPose TransPoseShapeModel3d(const HShapeModel3D& ShapeModel3DID, const wchar_t* Transformation) const;
  191. #endif
  192. // Project the edges of a 3D shape model into image coordinates.
  193. HXLDCont ProjectShapeModel3d(const HShapeModel3D& ShapeModel3DID, const HCamPar& CamParam, const HString& HiddenSurfaceRemoval, const HTuple& MinFaceAngle) const;
  194. // Project the edges of a 3D shape model into image coordinates.
  195. HXLDCont ProjectShapeModel3d(const HShapeModel3D& ShapeModel3DID, const HCamPar& CamParam, const HString& HiddenSurfaceRemoval, double MinFaceAngle) const;
  196. // Project the edges of a 3D shape model into image coordinates.
  197. HXLDCont ProjectShapeModel3d(const HShapeModel3D& ShapeModel3DID, const HCamPar& CamParam, const char* HiddenSurfaceRemoval, double MinFaceAngle) const;
  198. #ifdef _WIN32
  199. // Project the edges of a 3D shape model into image coordinates.
  200. HXLDCont ProjectShapeModel3d(const HShapeModel3D& ShapeModel3DID, const HCamPar& CamParam, const wchar_t* HiddenSurfaceRemoval, double MinFaceAngle) const;
  201. #endif
  202. // Remove points from a 3D object model by projecting it to a virtual view and removing all points outside of a given region.
  203. static HObjectModel3DArray ReduceObjectModel3dByView(const HRegion& Region, const HObjectModel3DArray& ObjectModel3D, const HCamPar& CamParam, const HPoseArray& Pose);
  204. // Remove points from a 3D object model by projecting it to a virtual view and removing all points outside of a given region.
  205. HObjectModel3D ReduceObjectModel3dByView(const HRegion& Region, const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam) const;
  206. // Render 3D object models to get an image.
  207. static HImage RenderObjectModel3d(const HObjectModel3DArray& ObjectModel3D, const HCamPar& CamParam, const HPoseArray& Pose, const HTuple& GenParamName, const HTuple& GenParamValue);
  208. // Render 3D object models to get an image.
  209. HImage RenderObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  210. // Display 3D object models.
  211. static void DispObjectModel3d(const HWindow& WindowHandle, const HObjectModel3DArray& ObjectModel3D, const HCamPar& CamParam, const HPoseArray& Pose, const HTuple& GenParamName, const HTuple& GenParamValue);
  212. // Display 3D object models.
  213. void DispObjectModel3d(const HWindow& WindowHandle, const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  214. // Project a 3D object model into image coordinates.
  215. HXLDCont ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HTuple& GenParamName, const HTuple& GenParamValue) const;
  216. // Project a 3D object model into image coordinates.
  217. HXLDCont ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const HString& GenParamName, const HString& GenParamValue) const;
  218. // Project a 3D object model into image coordinates.
  219. HXLDCont ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const char* GenParamName, const char* GenParamValue) const;
  220. #ifdef _WIN32
  221. // Project a 3D object model into image coordinates.
  222. HXLDCont ProjectObjectModel3d(const HObjectModel3D& ObjectModel3D, const HCamPar& CamParam, const wchar_t* GenParamName, const wchar_t* GenParamValue) const;
  223. #endif
  224. // Compute the calibrated scene flow between two stereo image pairs.
  225. HObjectModel3DArray SceneFlowCalib(const HImage& ImageRect1T1, const HImage& ImageRect2T1, const HImage& ImageRect1T2, const HImage& ImageRect2T2, const HImage& Disparity, const HTuple& SmoothingFlow, const HTuple& SmoothingDisparity, const HTuple& GenParamName, const HTuple& GenParamValue, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2) const;
  226. // Compute the calibrated scene flow between two stereo image pairs.
  227. HObjectModel3D SceneFlowCalib(const HImage& ImageRect1T1, const HImage& ImageRect2T1, const HImage& ImageRect1T2, const HImage& ImageRect2T2, const HImage& Disparity, double SmoothingFlow, double SmoothingDisparity, const HString& GenParamName, const HString& GenParamValue, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2) const;
  228. // Compute the calibrated scene flow between two stereo image pairs.
  229. HObjectModel3D SceneFlowCalib(const HImage& ImageRect1T1, const HImage& ImageRect2T1, const HImage& ImageRect1T2, const HImage& ImageRect2T2, const HImage& Disparity, double SmoothingFlow, double SmoothingDisparity, const char* GenParamName, const char* GenParamValue, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2) const;
  230. #ifdef _WIN32
  231. // Compute the calibrated scene flow between two stereo image pairs.
  232. HObjectModel3D SceneFlowCalib(const HImage& ImageRect1T1, const HImage& ImageRect2T1, const HImage& ImageRect1T2, const HImage& ImageRect2T2, const HImage& Disparity, double SmoothingFlow, double SmoothingDisparity, const wchar_t* GenParamName, const wchar_t* GenParamValue, const HCamPar& CamParamRect1, const HCamPar& CamParamRect2) const;
  233. #endif
  234. // Compute an absolute pose out of point correspondences between world and image coordinates.
  235. HTuple VectorToPose(const HTuple& WorldX, const HTuple& WorldY, const HTuple& WorldZ, const HTuple& ImageRow, const HTuple& ImageColumn, const HCamPar& CameraParam, const HString& Method, const HTuple& QualityType);
  236. // Compute an absolute pose out of point correspondences between world and image coordinates.
  237. double VectorToPose(const HTuple& WorldX, const HTuple& WorldY, const HTuple& WorldZ, const HTuple& ImageRow, const HTuple& ImageColumn, const HCamPar& CameraParam, const HString& Method, const HString& QualityType);
  238. // Compute an absolute pose out of point correspondences between world and image coordinates.
  239. double VectorToPose(const HTuple& WorldX, const HTuple& WorldY, const HTuple& WorldZ, const HTuple& ImageRow, const HTuple& ImageColumn, const HCamPar& CameraParam, const char* Method, const char* QualityType);
  240. #ifdef _WIN32
  241. // Compute an absolute pose out of point correspondences between world and image coordinates.
  242. double VectorToPose(const HTuple& WorldX, const HTuple& WorldY, const HTuple& WorldZ, const HTuple& ImageRow, const HTuple& ImageColumn, const HCamPar& CameraParam, const wchar_t* Method, const wchar_t* QualityType);
  243. #endif
  244. // Generate a projection map that describes the mapping between the image plane and the plane z=0 of a world coordinate system.
  245. HImage GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HTuple& Scale, const HString& MapType) const;
  246. // Generate a projection map that describes the mapping between the image plane and the plane z=0 of a world coordinate system.
  247. HImage GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const HString& Scale, const HString& MapType) const;
  248. // Generate a projection map that describes the mapping between the image plane and the plane z=0 of a world coordinate system.
  249. HImage GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const char* Scale, const char* MapType) const;
  250. #ifdef _WIN32
  251. // Generate a projection map that describes the mapping between the image plane and the plane z=0 of a world coordinate system.
  252. HImage GenImageToWorldPlaneMap(const HCamPar& CameraParam, Hlong WidthIn, Hlong HeightIn, Hlong WidthMapped, Hlong HeightMapped, const wchar_t* Scale, const wchar_t* MapType) const;
  253. #endif
  254. // Rectify an image by transforming it into the plane z=0 of a world coordinate system.
  255. HImage ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const HTuple& Scale, const HString& Interpolation) const;
  256. // Rectify an image by transforming it into the plane z=0 of a world coordinate system.
  257. HImage ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const HString& Scale, const HString& Interpolation) const;
  258. // Rectify an image by transforming it into the plane z=0 of a world coordinate system.
  259. HImage ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const char* Scale, const char* Interpolation) const;
  260. #ifdef _WIN32
  261. // Rectify an image by transforming it into the plane z=0 of a world coordinate system.
  262. HImage ImageToWorldPlane(const HImage& Image, const HCamPar& CameraParam, Hlong Width, Hlong Height, const wchar_t* Scale, const wchar_t* Interpolation) const;
  263. #endif
  264. // Transform an XLD contour into the plane z=0 of a world coordinate system.
  265. HXLDCont ContourToWorldPlaneXld(const HXLDCont& Contours, const HTuple& CameraParam, const HTuple& Scale) const;
  266. // Transform an XLD contour into the plane z=0 of a world coordinate system.
  267. HXLDCont ContourToWorldPlaneXld(const HXLDCont& Contours, const HTuple& CameraParam, const HString& Scale) const;
  268. // Transform an XLD contour into the plane z=0 of a world coordinate system.
  269. HXLDCont ContourToWorldPlaneXld(const HXLDCont& Contours, const HTuple& CameraParam, const char* Scale) const;
  270. #ifdef _WIN32
  271. // Transform an XLD contour into the plane z=0 of a world coordinate system.
  272. HXLDCont ContourToWorldPlaneXld(const HXLDCont& Contours, const HTuple& CameraParam, const wchar_t* Scale) const;
  273. #endif
  274. // Translate the origin of a 3D pose.
  275. HPose SetOriginPose(double DX, double DY, double DZ) const;
  276. // Perform a hand-eye calibration.
  277. static HPose HandEyeCalibration(const HTuple& X, const HTuple& Y, const HTuple& Z, const HTuple& Row, const HTuple& Col, const HTuple& NumPoints, const HPoseArray& RobotPoses, const HCamPar& CameraParam, const HString& Method, const HTuple& QualityType, HPose* CalibrationPose, HTuple* Quality);
  278. // Perform a hand-eye calibration.
  279. static HPose HandEyeCalibration(const HTuple& X, const HTuple& Y, const HTuple& Z, const HTuple& Row, const HTuple& Col, const HTuple& NumPoints, const HPoseArray& RobotPoses, const HCamPar& CameraParam, const HString& Method, const HString& QualityType, HPose* CalibrationPose, double* Quality);
  280. // Perform a hand-eye calibration.
  281. static HPose HandEyeCalibration(const HTuple& X, const HTuple& Y, const HTuple& Z, const HTuple& Row, const HTuple& Col, const HTuple& NumPoints, const HPoseArray& RobotPoses, const HCamPar& CameraParam, const char* Method, const char* QualityType, HPose* CalibrationPose, double* Quality);
  282. #ifdef _WIN32
  283. // Perform a hand-eye calibration.
  284. static HPose HandEyeCalibration(const HTuple& X, const HTuple& Y, const HTuple& Z, const HTuple& Row, const HTuple& Col, const HTuple& NumPoints, const HPoseArray& RobotPoses, const HCamPar& CameraParam, const wchar_t* Method, const wchar_t* QualityType, HPose* CalibrationPose, double* Quality);
  285. #endif
  286. // Get the representation type of a 3D pose.
  287. HString GetPoseType(HString* OrderOfRotation, HString* ViewOfTransform) const;
  288. // Change the representation type of a 3D pose.
  289. HPose ConvertPoseType(const HString& OrderOfTransform, const HString& OrderOfRotation, const HString& ViewOfTransform) const;
  290. // Change the representation type of a 3D pose.
  291. HPose ConvertPoseType(const char* OrderOfTransform, const char* OrderOfRotation, const char* ViewOfTransform) const;
  292. #ifdef _WIN32
  293. // Change the representation type of a 3D pose.
  294. HPose ConvertPoseType(const wchar_t* OrderOfTransform, const wchar_t* OrderOfRotation, const wchar_t* ViewOfTransform) const;
  295. #endif
  296. // Create a 3D pose.
  297. void CreatePose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const HString& OrderOfTransform, const HString& OrderOfRotation, const HString& ViewOfTransform);
  298. // Create a 3D pose.
  299. void CreatePose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const char* OrderOfTransform, const char* OrderOfRotation, const char* ViewOfTransform);
  300. #ifdef _WIN32
  301. // Create a 3D pose.
  302. void CreatePose(double TransX, double TransY, double TransZ, double RotX, double RotY, double RotZ, const wchar_t* OrderOfTransform, const wchar_t* OrderOfRotation, const wchar_t* ViewOfTransform);
  303. #endif
  304. // Convert internal camera parameters and a 3D pose into a 3x4 projection matrix.
  305. HHomMat3D CamParPoseToHomMat3d(const HCamPar& CameraParam) const;
  306. // Convert a 3D pose into a homogeneous transformation matrix.
  307. HHomMat3D PoseToHomMat3d() const;
  308. // Deserialize a serialized pose.
  309. void DeserializePose(const HSerializedItem& SerializedItemHandle);
  310. // Serialize a pose.
  311. HSerializedItem SerializePose() const;
  312. // Read a 3D pose from a text file.
  313. void ReadPose(const HString& PoseFile);
  314. // Read a 3D pose from a text file.
  315. void ReadPose(const char* PoseFile);
  316. #ifdef _WIN32
  317. // Read a 3D pose from a text file.
  318. void ReadPose(const wchar_t* PoseFile);
  319. #endif
  320. // Write a 3D pose to a text file.
  321. void WritePose(const HString& PoseFile) const;
  322. // Write a 3D pose to a text file.
  323. void WritePose(const char* PoseFile) const;
  324. #ifdef _WIN32
  325. // Write a 3D pose to a text file.
  326. void WritePose(const wchar_t* PoseFile) const;
  327. #endif
  328. // Simulate an image with calibration plate.
  329. HImage SimCaltab(const HString& CalPlateDescr, const HCamPar& CameraParam, Hlong GrayBackground, Hlong GrayPlate, Hlong GrayMarks, double ScaleFac) const;
  330. // Simulate an image with calibration plate.
  331. HImage SimCaltab(const char* CalPlateDescr, const HCamPar& CameraParam, Hlong GrayBackground, Hlong GrayPlate, Hlong GrayMarks, double ScaleFac) const;
  332. #ifdef _WIN32
  333. // Simulate an image with calibration plate.
  334. HImage SimCaltab(const wchar_t* CalPlateDescr, const HCamPar& CameraParam, Hlong GrayBackground, Hlong GrayPlate, Hlong GrayMarks, double ScaleFac) const;
  335. #endif
  336. // Determine all camera parameters by a simultaneous minimization process.
  337. static HCamPar CameraCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow, const HTuple& NCol, const HCamPar& StartCamParam, const HPoseArray& NStartPose, const HTuple& EstimateParams, HPoseArray* NFinalPose, HTuple* Errors);
  338. // Determine all camera parameters by a simultaneous minimization process.
  339. HCamPar CameraCalibration(const HTuple& NX, const HTuple& NY, const HTuple& NZ, const HTuple& NRow, const HTuple& NCol, const HCamPar& StartCamParam, const HTuple& EstimateParams, HPose* NFinalPose, double* Errors) const;
  340. // Extract rectangularly arranged 2D calibration marks from the image and calculate initial values for the external camera parameters.
  341. HTuple FindMarksAndPose(const HImage& Image, const HRegion& CalPlateRegion, const HString& CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord);
  342. // Extract rectangularly arranged 2D calibration marks from the image and calculate initial values for the external camera parameters.
  343. HTuple FindMarksAndPose(const HImage& Image, const HRegion& CalPlateRegion, const char* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord);
  344. #ifdef _WIN32
  345. // Extract rectangularly arranged 2D calibration marks from the image and calculate initial values for the external camera parameters.
  346. HTuple FindMarksAndPose(const HImage& Image, const HRegion& CalPlateRegion, const wchar_t* CalPlateDescr, const HCamPar& StartCamParam, Hlong StartThresh, Hlong DeltaThresh, Hlong MinThresh, double Alpha, double MinContLength, double MaxDiamMarks, HTuple* CCoord);
  347. #endif
  348. // Define type, parameters, and relative pose of a camera in a camera setup model.
  349. static void SetCameraSetupCamParam(const HCameraSetupModel& CameraSetupModelID, const HTuple& CameraIdx, const HTuple& CameraType, const HCamPar& CameraParam, const HTuple& CameraPose);
  350. // Define type, parameters, and relative pose of a camera in a camera setup model.
  351. static void SetCameraSetupCamParam(const HCameraSetupModel& CameraSetupModelID, const HTuple& CameraIdx, const HString& CameraType, const HCamPar& CameraParam, const HTuple& CameraPose);
  352. // Define type, parameters, and relative pose of a camera in a camera setup model.
  353. static void SetCameraSetupCamParam(const HCameraSetupModel& CameraSetupModelID, const HTuple& CameraIdx, const char* CameraType, const HCamPar& CameraParam, const HTuple& CameraPose);
  354. #ifdef _WIN32
  355. // Define type, parameters, and relative pose of a camera in a camera setup model.
  356. static void SetCameraSetupCamParam(const HCameraSetupModel& CameraSetupModelID, const HTuple& CameraIdx, const wchar_t* CameraType, const HCamPar& CameraParam, const HTuple& CameraPose);
  357. #endif
  358. };
  359. class LIntExport HPoseArray : public HDataArray
  360. {
  361. public:
  362. HPoseArray();
  363. HPoseArray(HPose* classes, Hlong length);
  364. /* Define a default constructor to prevent compilers that support
  365. * C++11 R-Value References v3.0 declaring an implicite move
  366. * assignment/constructor. */
  367. ~HPoseArray() {}
  368. protected:
  369. virtual void CreateArray(Hlong length);
  370. virtual int GetFixedSize() const;
  371. };
  372. }
  373. #endif