HObjectModel3D.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*****************************************************************************
  2. * HObjectModel3D.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/libhalcon
  6. * Description: Creation and management of 3D object models
  7. *
  8. * (c) 2016-2020 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. *****************************************************************************
  12. */
  13. #ifndef HOBJECTMODEL3D_H
  14. #define HOBJECTMODEL3D_H
  15. #if defined(__cplusplus)
  16. extern "C" {
  17. #endif
  18. /* Creates a new 3D object model with the given handle. */
  19. extern HLibExport Herror HOM3DCreate(Hproc_handle proc_handle,
  20. INT4_8* object_model);
  21. /* Frees the given 3D object model handle. Note that this function should
  22. * usually only be called in case of errors during object model creation. Once
  23. * a handle has been returned to the user, it should be freed outside using the
  24. * operator clear_object_model_3d */
  25. extern HLibExport Herror HOM3DFree(Hproc_handle proc_handle,
  26. INT4_8 object_model);
  27. /* Add points to a 3D object model. The points are NOT initialized and must be
  28. * filled by the caller. The point coordinates are expected in [mm]. */
  29. extern HLibExport Herror HOM3DAddPoints(Hproc_handle proc_handle,
  30. INT4_8 object_model, int num_points,
  31. float** x, float** y, float** z);
  32. /* Add points and a 2D mapping to a 3D object model. The points and the mapping
  33. * are NOT initialized and must be filled by the caller. The point coordinates
  34. * are expected in [mm]. */
  35. extern HLibExport Herror HOM3DAddPointsAndMapping(
  36. Hproc_handle proc_handle, INT4_8 object_model, int num_points, float** x,
  37. float** y, float** z, HIMGDIM w, HIMGDIM h, HIMGCOOR** br, HIMGCOOR** bc);
  38. /* Add points from non-interleaved XYZ images. The region defines which points
  39. * are valid. The points are copied into the 3D object model. The values are
  40. * interpreted as [mm]. */
  41. extern HLibExport Herror HOM3DAddPointsFromImagesRegion(
  42. Hproc_handle proc_handle, INT4_8 object_model, Hrlregion* region,
  43. HIMGDIM w, HIMGDIM h, float* x, float* y, float* z);
  44. /* Add points from non-interleaved XYZ images. Points where the z value is
  45. * identical to the given 'invalid' value are ignored and not added to the 3D
  46. * object model. The points are copied into the 3D object model. The values are
  47. * interpreted as [mm]. */
  48. extern HLibExport Herror HOM3DAddPointsFromImagesInvalid(
  49. Hproc_handle proc_handle, INT4_8 object_model, float invalid, HIMGDIM w,
  50. HIMGDIM h, float* x, float* y, float* z);
  51. /* Add 2D mappings to a 3D object model. The mappings are NOT initialized and
  52. * must be filled by the caller. The object model must already contain points,
  53. * and the number of points must be identical to the number of mappings. */
  54. extern HLibExport Herror HOM3DAddMapping(Hproc_handle proc_handle,
  55. INT4_8 object_model, int num_mappings,
  56. HIMGDIM w, HIMGDIM h, HIMGCOOR** br,
  57. HIMGCOOR** bc);
  58. /* Add normal vectors to a 3D object model. The normals are NOT initialized and
  59. * must be filled by the caller. The object model must already contain points,
  60. * and the number of points must be identical to the number of normals. */
  61. extern HLibExport Herror HOM3DAddNormals(Hproc_handle proc_handle,
  62. INT4_8 object_model, int num_normals,
  63. float** nx, float** ny, float** nz);
  64. /* Add triangles to a 3D object model. The triangles are NOT initialized and
  65. * must be filled by the caller. The 3D obejct model must already contain
  66. * points. The triangle array has a length of 3*num_triangles, each triangle
  67. * is represented by three consecutive vertex indices. */
  68. extern HLibExport Herror HOM3DAddTriangles(Hproc_handle proc_handle,
  69. INT4_8 object_model,
  70. int num_triangles,
  71. int32_t** triangles);
  72. /* Add a user-defined attribute, which contains one double value per 3D
  73. * point. The length of the returned array (user_attrib) equals the number
  74. * of contained 3D points.
  75. * NOTE that the name of the attribute must start with an ampersand. For
  76. * example, "&intensity", "&score", "&red" are valid names. */
  77. extern HLibExport Herror HOM3DAddUserAttrib(Hproc_handle proc_handle,
  78. INT4_8 object_model,
  79. const char* name,
  80. double** user_attrib);
  81. /* Returns the list of points contained in the given 3D object model.
  82. * The point coordinates are returned in [mm]. */
  83. extern HLibExport Herror HOM3DGetPoints(INT4_8 object_model, int* num_points,
  84. float** x, float** y, float** z);
  85. /* Returns the 2D mappings contained in the given 3D object model */
  86. extern HLibExport Herror HOM3DGetMapping(INT4_8 object_model, int* num_points,
  87. HIMGDIM* w, HIMGDIM* h, HIMGCOOR** br,
  88. HIMGCOOR** bc);
  89. /* Returns the point normal vectors contained in the given 3D object model */
  90. extern HLibExport Herror HOM3DGetNormals(INT4_8 object_model, int* num_points,
  91. float** nx, float** ny, float** nz);
  92. /* Returns the triangles contained in the given 3D object model */
  93. extern HLibExport Herror HOM3DGetTriangles(INT4_8 object_model,
  94. int* num_triangles,
  95. int** triangles);
  96. /* Returns a user-defined attribute, which contains one double value per 3D
  97. * point. The length of the returned array (user_attrib) equals the number
  98. * of contained 3D points. */
  99. extern HLibExport Herror HOM3DGetUserAttrib(INT4_8 object_model,
  100. int* num_points, const char* name,
  101. double** user_attrib);
  102. #if defined(__cplusplus)
  103. }
  104. #endif
  105. #endif /* ifndef HOBJECTMODEL3D_H */