HFunction1D.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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_HFUNCTION1D
  8. #define HCPP_HFUNCTION1D
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a 1d function.
  12. class LIntExport HFunction1D : public HDataBase
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HFunction1D():HDataBase() {}
  17. // Copy constructor
  18. HFunction1D(const HFunction1D& source) : HDataBase(source) {}
  19. /*****************************************************************************
  20. * Operator-based class constructors
  21. *****************************************************************************/
  22. // create_funct_1d_array: Create a function from a sequence of y values.
  23. explicit HFunction1D(const HTuple& YValues);
  24. // create_funct_1d_array: Create a function from a sequence of y values.
  25. explicit HFunction1D(double YValues);
  26. // create_funct_1d_pairs: Create a function from a set of (x,y) pairs.
  27. explicit HFunction1D(const HTuple& XValues, const HTuple& YValues);
  28. // create_funct_1d_pairs: Create a function from a set of (x,y) pairs.
  29. explicit HFunction1D(double XValues, double YValues);
  30. /*****************************************************************************
  31. * Operator overloads (non-member overloads reside in HOperatorOverloads.h) *
  32. *****************************************************************************/
  33. // Negate function
  34. HFunction1D operator - () const;
  35. // Invert function
  36. HFunction1D operator ! () const;
  37. /***************************************************************************
  38. * Operators *
  39. ***************************************************************************/
  40. // Plot a function using gnuplot.
  41. void GnuplotPlotFunct1d(const HGnuplot& GnuplotFileID) const;
  42. // Compose two functions.
  43. HFunction1D ComposeFunct1d(const HFunction1D& Function2, const HString& Border) const;
  44. // Compose two functions.
  45. HFunction1D ComposeFunct1d(const HFunction1D& Function2, const char* Border) const;
  46. #ifdef _WIN32
  47. // Compose two functions.
  48. HFunction1D ComposeFunct1d(const HFunction1D& Function2, const wchar_t* Border) const;
  49. #endif
  50. // Calculate the inverse of a function.
  51. HFunction1D InvertFunct1d() const;
  52. // Calculate the derivatives of a function.
  53. HFunction1D DerivateFunct1d(const HString& Mode) const;
  54. // Calculate the derivatives of a function.
  55. HFunction1D DerivateFunct1d(const char* Mode) const;
  56. #ifdef _WIN32
  57. // Calculate the derivatives of a function.
  58. HFunction1D DerivateFunct1d(const wchar_t* Mode) const;
  59. #endif
  60. // Calculate the local minimum and maximum points of a function.
  61. void LocalMinMaxFunct1d(const HString& Mode, const HString& Interpolation, HTuple* Min, HTuple* Max) const;
  62. // Calculate the local minimum and maximum points of a function.
  63. void LocalMinMaxFunct1d(const char* Mode, const char* Interpolation, HTuple* Min, HTuple* Max) const;
  64. #ifdef _WIN32
  65. // Calculate the local minimum and maximum points of a function.
  66. void LocalMinMaxFunct1d(const wchar_t* Mode, const wchar_t* Interpolation, HTuple* Min, HTuple* Max) const;
  67. #endif
  68. // Calculate the zero crossings of a function.
  69. HTuple ZeroCrossingsFunct1d() const;
  70. // Multiplication and addition of the y values.
  71. HFunction1D ScaleYFunct1d(double Mult, double Add) const;
  72. // Negation of the y values.
  73. HFunction1D NegateFunct1d() const;
  74. // Absolute value of the y values.
  75. HFunction1D AbsFunct1d() const;
  76. // Return the value of a function at an arbitrary position.
  77. HTuple GetYValueFunct1d(const HTuple& X, const HString& Border) const;
  78. // Return the value of a function at an arbitrary position.
  79. double GetYValueFunct1d(double X, const HString& Border) const;
  80. // Return the value of a function at an arbitrary position.
  81. double GetYValueFunct1d(double X, const char* Border) const;
  82. #ifdef _WIN32
  83. // Return the value of a function at an arbitrary position.
  84. double GetYValueFunct1d(double X, const wchar_t* Border) const;
  85. #endif
  86. // Access a function value using the index of the control points.
  87. void GetPairFunct1d(const HTuple& Index, HTuple* X, HTuple* Y) const;
  88. // Access a function value using the index of the control points.
  89. void GetPairFunct1d(Hlong Index, double* X, double* Y) const;
  90. // Number of control points of the function.
  91. Hlong NumPointsFunct1d() const;
  92. // Smallest and largest y value of the function.
  93. void YRangeFunct1d(double* YMin, double* YMax) const;
  94. // Smallest and largest x value of the function.
  95. void XRangeFunct1d(double* XMin, double* XMax) const;
  96. // Access to the x/y values of a function.
  97. void Funct1dToPairs(HTuple* XValues, HTuple* YValues) const;
  98. // Sample a function equidistantly in an interval.
  99. HFunction1D SampleFunct1d(const HTuple& XMin, const HTuple& XMax, const HTuple& XDist, const HString& Border) const;
  100. // Sample a function equidistantly in an interval.
  101. HFunction1D SampleFunct1d(double XMin, double XMax, double XDist, const HString& Border) const;
  102. // Sample a function equidistantly in an interval.
  103. HFunction1D SampleFunct1d(double XMin, double XMax, double XDist, const char* Border) const;
  104. #ifdef _WIN32
  105. // Sample a function equidistantly in an interval.
  106. HFunction1D SampleFunct1d(double XMin, double XMax, double XDist, const wchar_t* Border) const;
  107. #endif
  108. // Transform a function using given transformation parameters.
  109. HFunction1D TransformFunct1d(const HTuple& Params) const;
  110. // Calculate transformation parameters between two functions.
  111. HTuple MatchFunct1dTrans(const HFunction1D& Function2, const HString& Border, const HTuple& ParamsConst, const HTuple& UseParams, double* ChiSquare, HTuple* Covar) const;
  112. // Calculate transformation parameters between two functions.
  113. HTuple MatchFunct1dTrans(const HFunction1D& Function2, const char* Border, const HTuple& ParamsConst, const HTuple& UseParams, double* ChiSquare, HTuple* Covar) const;
  114. #ifdef _WIN32
  115. // Calculate transformation parameters between two functions.
  116. HTuple MatchFunct1dTrans(const HFunction1D& Function2, const wchar_t* Border, const HTuple& ParamsConst, const HTuple& UseParams, double* ChiSquare, HTuple* Covar) const;
  117. #endif
  118. // Compute the distance of two functions.
  119. HTuple DistanceFunct1d(const HFunction1D& Function2, const HTuple& Mode, const HTuple& Sigma) const;
  120. // Compute the distance of two functions.
  121. HTuple DistanceFunct1d(const HFunction1D& Function2, const HString& Mode, double Sigma) const;
  122. // Compute the distance of two functions.
  123. HTuple DistanceFunct1d(const HFunction1D& Function2, const char* Mode, double Sigma) const;
  124. #ifdef _WIN32
  125. // Compute the distance of two functions.
  126. HTuple DistanceFunct1d(const HFunction1D& Function2, const wchar_t* Mode, double Sigma) const;
  127. #endif
  128. // Smooth an equidistant 1D function with a Gaussian function.
  129. HFunction1D SmoothFunct1dGauss(double Sigma) const;
  130. // Compute the positive and negative areas of a function.
  131. double IntegrateFunct1d(HTuple* Negative) const;
  132. // Read a function from a file.
  133. void ReadFunct1d(const HString& FileName);
  134. // Read a function from a file.
  135. void ReadFunct1d(const char* FileName);
  136. #ifdef _WIN32
  137. // Read a function from a file.
  138. void ReadFunct1d(const wchar_t* FileName);
  139. #endif
  140. // Write a function to a file.
  141. void WriteFunct1d(const HString& FileName) const;
  142. // Write a function to a file.
  143. void WriteFunct1d(const char* FileName) const;
  144. #ifdef _WIN32
  145. // Write a function to a file.
  146. void WriteFunct1d(const wchar_t* FileName) const;
  147. #endif
  148. // Create a function from a sequence of y values.
  149. void CreateFunct1dArray(const HTuple& YValues);
  150. // Create a function from a sequence of y values.
  151. void CreateFunct1dArray(double YValues);
  152. // Create a function from a set of (x,y) pairs.
  153. void CreateFunct1dPairs(const HTuple& XValues, const HTuple& YValues);
  154. // Create a function from a set of (x,y) pairs.
  155. void CreateFunct1dPairs(double XValues, double YValues);
  156. // Smooth an equidistant 1D function by averaging its values.
  157. HFunction1D SmoothFunct1dMean(Hlong SmoothSize, Hlong Iterations) const;
  158. };
  159. }
  160. #endif