HOperatorOverloads.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*****************************************************************************
  2. * HOperatorOverloads.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/C++
  6. * Description: C++ operator overloads for common class operations
  7. *
  8. * (c) 2010-2020 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. *****************************************************************************
  12. *
  13. *
  14. *****************************************************************************/
  15. #ifndef HCPP_OPERATOR_OVERLOADS_H
  16. #define HCPP_OPERATOR_OVERLOADS_H
  17. namespace HalconCpp
  18. {
  19. /*****************************************************************************
  20. * HImage: Gray value operations
  21. *****************************************************************************/
  22. // Add gray values
  23. LIntExport HImage operator+(const HImage& image1, const HImage& image2);
  24. // Subtract gray values
  25. LIntExport HImage operator-(const HImage& image1, const HImage& image2);
  26. // Multiply gray values
  27. LIntExport HImage operator*(const HImage& image1, const HImage& image2);
  28. // Shift gray values
  29. LIntExport HImage operator+(const HImage& image, double add);
  30. // Shift gray values
  31. LIntExport HImage operator-(const HImage& image, double sub);
  32. // Scale gray values
  33. LIntExport HImage operator*(const HImage& image, double mult);
  34. // Scale gray values
  35. LIntExport HImage operator/(const HImage& image, double div);
  36. // Shift gray values
  37. LIntExport HImage operator+(double add, const HImage& image);
  38. // Scale gray values
  39. LIntExport HImage operator*(double mult, const HImage& image);
  40. /*****************************************************************************
  41. * HImage: Segmentation
  42. *****************************************************************************/
  43. // Dynamic Threshold
  44. LIntExport HRegion operator>=(const HImage& image1, const HImage& image2);
  45. // Dynamic Threshold
  46. LIntExport HRegion operator<=(const HImage& image1, const HImage& image2);
  47. // Fixed Threshold
  48. LIntExport HRegion operator>=(const HImage& image, double threshold);
  49. // Fixed Threshold
  50. LIntExport HRegion operator<=(const HImage& image, double threshold);
  51. // Fixed Threshold
  52. LIntExport HRegion operator>=(double threshold, const HImage& image);
  53. // Fixed Threshold
  54. LIntExport HRegion operator<=(double threshold, const HImage& image);
  55. /*****************************************************************************
  56. * HImage: Miscellaneous
  57. *****************************************************************************/
  58. // Reduce domain of image
  59. LIntExport HImage operator&(const HImage& image, const HRegion& region);
  60. /*****************************************************************************
  61. * HRegion: Sets *
  62. *****************************************************************************/
  63. // Intersection of regions
  64. LIntExport HRegion operator&(const HRegion& region1, const HRegion& region2);
  65. // Union of regions
  66. LIntExport HRegion operator|(const HRegion& region1, const HRegion& region2);
  67. // Difference of regions
  68. LIntExport HRegion operator/(const HRegion& region1, const HRegion& region2);
  69. // Intersection of region with image domain
  70. LIntExport HRegion operator&(const HRegion& region, const HImage& image);
  71. // Test if one region is a subset of the other
  72. LIntExport bool operator>=(const HRegion& region1, const HRegion& region2);
  73. // Test if one region is a subset of the other
  74. LIntExport bool operator<=(const HRegion& region1, const HRegion& region2);
  75. /*****************************************************************************
  76. * HRegion: Morphology *
  77. *****************************************************************************/
  78. // Minkowski addition of regions
  79. LIntExport HRegion operator+(const HRegion& region1, const HRegion& region2);
  80. // Minkowski substraction of regions
  81. LIntExport HRegion operator-(const HRegion& region1, const HRegion& region2);
  82. // Dilation of region by specified radius
  83. LIntExport HRegion operator+(const HRegion& region, double radius);
  84. // Erosion of region by specified radius
  85. LIntExport HRegion operator-(const HRegion& region, double radius);
  86. // Scaling of region by specified factor
  87. LIntExport HRegion operator*(const HRegion& region, double factor);
  88. // Dilation of region by specified radius
  89. LIntExport HRegion operator+(double radius, const HRegion& region);
  90. // Scaling of region by specified radius
  91. LIntExport HRegion operator*(double factor, const HRegion& region);
  92. /*****************************************************************************
  93. * HFunction1D
  94. *****************************************************************************/
  95. // Add a constant offset to the function's Y values
  96. LIntExport HFunction1D operator+(const HFunction1D& function, double add);
  97. // Add a constant offset to the function's Y values
  98. LIntExport HFunction1D operator+(double add, const HFunction1D& function);
  99. // Subtract a constant offset from the function's Y values
  100. LIntExport HFunction1D operator-(const HFunction1D& function, double sub);
  101. // Scale the function's Y values</summary>
  102. LIntExport HFunction1D operator*(const HFunction1D& function, double factor);
  103. // Scale the function's Y values</summary>
  104. LIntExport HFunction1D operator*(double factor, const HFunction1D& function);
  105. // Scale the function's Y values</summary>
  106. LIntExport HFunction1D operator/(const HFunction1D& function, double div);
  107. // Compose two functions (not a pointwise multiplication)</summary>
  108. LIntExport HFunction1D operator*(const HFunction1D& function1,
  109. const HFunction1D& function2);
  110. /*****************************************************************************
  111. * HMatrix
  112. *****************************************************************************/
  113. // Add two matrices
  114. LIntExport HMatrix operator+(const HMatrix& matrix1, const HMatrix& matrix2);
  115. // Subtract two matrices
  116. LIntExport HMatrix operator-(const HMatrix& matrix1, const HMatrix& matrix2);
  117. // Matrix multiplication
  118. LIntExport HMatrix operator*(const HMatrix& matrix1, const HMatrix& matrix2);
  119. // Scale matrix
  120. LIntExport HMatrix operator*(const HMatrix& matrix, double factor);
  121. // Scale matrix
  122. LIntExport HMatrix operator*(double factor, const HMatrix& matrix);
  123. // Solve linear system matrix2 * x = matrix1
  124. LIntExport HMatrix operator/(const HMatrix& matrix1, const HMatrix& matrix2);
  125. /*****************************************************************************
  126. * HQuaternion
  127. *****************************************************************************/
  128. // Compose two quaternions
  129. LIntExport HQuaternion operator*(const HQuaternion& left,
  130. const HQuaternion& right);
  131. /*****************************************************************************
  132. * HDualQuaternion
  133. *****************************************************************************/
  134. // Compose two dual quaternions
  135. LIntExport HDualQuaternion operator*(const HDualQuaternion& left,
  136. const HDualQuaternion& right);
  137. }
  138. #endif