HRegion.h 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678
  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_HREGION
  8. #define HCPP_HREGION
  9. namespace HalconCpp
  10. {
  11. // Represents an instance of a region object(-array).
  12. class LIntExport HRegion : public HObject
  13. {
  14. public:
  15. // Create an uninitialized instance
  16. HRegion():HObject() {}
  17. // Copy constructor
  18. HRegion(const HRegion& source) : HObject(source) {}
  19. // Copy constructor
  20. HRegion(const HObject& object);
  21. // Create HRegion from object id. For copy=false takes
  22. // over management of input key. Type of key must match!
  23. explicit HRegion(Hkey key, bool copy=true);
  24. // Access of object tuple element
  25. const HRegion operator [] (Hlong index) const;
  26. // Deep copy of all data represented by this object instance
  27. HRegion Clone() const;
  28. /*****************************************************************************
  29. * Operator-based class constructors
  30. *****************************************************************************/
  31. // gen_rectangle1: Create a rectangle parallel to the coordinate axes.
  32. explicit HRegion(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2);
  33. // gen_rectangle1: Create a rectangle parallel to the coordinate axes.
  34. explicit HRegion(double Row1, double Column1, double Row2, double Column2);
  35. // gen_ellipse_sector: Create an ellipse sector.
  36. explicit HRegion(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Radius1, const HTuple& Radius2, const HTuple& StartAngle, const HTuple& EndAngle);
  37. // gen_ellipse_sector: Create an ellipse sector.
  38. explicit HRegion(double Row, double Column, double Phi, double Radius1, double Radius2, double StartAngle, double EndAngle);
  39. // gen_circle_sector: Create a circle sector.
  40. explicit HRegion(const HTuple& Row, const HTuple& Column, const HTuple& Radius, const HTuple& StartAngle, const HTuple& EndAngle);
  41. // gen_circle_sector: Create a circle sector.
  42. explicit HRegion(double Row, double Column, double Radius, double StartAngle, double EndAngle);
  43. // gen_circle: Create a circle.
  44. explicit HRegion(const HTuple& Row, const HTuple& Column, const HTuple& Radius);
  45. // gen_circle: Create a circle.
  46. explicit HRegion(double Row, double Column, double Radius);
  47. /*****************************************************************************
  48. * Conversions from XLD to region
  49. *****************************************************************************/
  50. // Create a filled region from an XLD contour
  51. HRegion(const HXLDCont& xld);
  52. // Create a filled region from an XLD polygon
  53. HRegion(const HXLDPoly& xld);
  54. /*****************************************************************************
  55. * Operator overloads (non-member overloads reside in HOperatorOverloads.h)
  56. *****************************************************************************/
  57. // Complement (not necessarily finite!)
  58. HRegion operator ! () const;
  59. // Negate the region
  60. HRegion operator - () const;
  61. // Convert region to xld representing the region border
  62. operator HXLDCont() const;
  63. /*****************************************************************************
  64. * Non-generic convenience members
  65. *****************************************************************************/
  66. // The area of the region
  67. HTuple Area() const;
  68. // The center row of the region
  69. HTuple Row() const;
  70. // The center column of the region
  71. HTuple Column() const;
  72. /***************************************************************************
  73. * Operators *
  74. ***************************************************************************/
  75. // Generate XLD contours from regions.
  76. HXLDCont GenContourRegionXld(const HString& Mode) const;
  77. // Generate XLD contours from regions.
  78. HXLDCont GenContourRegionXld(const char* Mode) const;
  79. #ifdef _WIN32
  80. // Generate XLD contours from regions.
  81. HXLDCont GenContourRegionXld(const wchar_t* Mode) const;
  82. #endif
  83. // Convert a skeleton into XLD contours.
  84. HXLDCont GenContoursSkeletonXld(Hlong Length, const HString& Mode) const;
  85. // Convert a skeleton into XLD contours.
  86. HXLDCont GenContoursSkeletonXld(Hlong Length, const char* Mode) const;
  87. #ifdef _WIN32
  88. // Convert a skeleton into XLD contours.
  89. HXLDCont GenContoursSkeletonXld(Hlong Length, const wchar_t* Mode) const;
  90. #endif
  91. // Receive regions over a socket connection.
  92. void ReceiveRegion(const HSocket& Socket);
  93. // Send regions over a socket connection.
  94. void SendRegion(const HSocket& Socket) const;
  95. // Create a model to perform 3D-measurements using the sheet-of-light technique.
  96. HSheetOfLightModel CreateSheetOfLightModel(const HTuple& GenParamName, const HTuple& GenParamValue) const;
  97. // Create a model to perform 3D-measurements using the sheet-of-light technique.
  98. HSheetOfLightModel CreateSheetOfLightModel(const HString& GenParamName, Hlong GenParamValue) const;
  99. // Create a model to perform 3D-measurements using the sheet-of-light technique.
  100. HSheetOfLightModel CreateSheetOfLightModel(const char* GenParamName, Hlong GenParamValue) const;
  101. #ifdef _WIN32
  102. // Create a model to perform 3D-measurements using the sheet-of-light technique.
  103. HSheetOfLightModel CreateSheetOfLightModel(const wchar_t* GenParamName, Hlong GenParamValue) const;
  104. #endif
  105. // Selects characters from a given region.
  106. HRegion SelectCharacters(const HString& DotPrint, const HString& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const HString& Punctuation, const HString& DiacriticMarks, const HString& PartitionMethod, const HString& PartitionLines, const HString& FragmentDistance, const HString& ConnectFragments, Hlong ClutterSizeMax, const HString& StopAfter) const;
  107. // Selects characters from a given region.
  108. HRegion SelectCharacters(const char* DotPrint, const char* StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const char* Punctuation, const char* DiacriticMarks, const char* PartitionMethod, const char* PartitionLines, const char* FragmentDistance, const char* ConnectFragments, Hlong ClutterSizeMax, const char* StopAfter) const;
  109. #ifdef _WIN32
  110. // Selects characters from a given region.
  111. HRegion SelectCharacters(const wchar_t* DotPrint, const wchar_t* StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, const wchar_t* Punctuation, const wchar_t* DiacriticMarks, const wchar_t* PartitionMethod, const wchar_t* PartitionLines, const wchar_t* FragmentDistance, const wchar_t* ConnectFragments, Hlong ClutterSizeMax, const wchar_t* StopAfter) const;
  112. #endif
  113. // Segments characters in a given region of an image.
  114. HImage SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const HString& Method, const HString& EliminateLines, const HString& DotPrint, const HString& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, HTuple* UsedThreshold) const;
  115. // Segments characters in a given region of an image.
  116. HImage SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const HString& Method, const HString& EliminateLines, const HString& DotPrint, const HString& StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, Hlong* UsedThreshold) const;
  117. // Segments characters in a given region of an image.
  118. HImage SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const char* Method, const char* EliminateLines, const char* DotPrint, const char* StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, Hlong* UsedThreshold) const;
  119. #ifdef _WIN32
  120. // Segments characters in a given region of an image.
  121. HImage SegmentCharacters(const HImage& Image, HRegion* RegionForeground, const wchar_t* Method, const wchar_t* EliminateLines, const wchar_t* DotPrint, const wchar_t* StrokeWidth, const HTuple& CharWidth, const HTuple& CharHeight, Hlong ThresholdOffset, Hlong Contrast, Hlong* UsedThreshold) const;
  122. #endif
  123. // Determines the slant of characters of a text line or paragraph.
  124. HTuple TextLineSlant(const HImage& Image, Hlong CharHeight, double SlantFrom, double SlantTo) const;
  125. // Determines the orientation of a text line or paragraph.
  126. HTuple TextLineOrientation(const HImage& Image, Hlong CharHeight, double OrientationFrom, double OrientationTo) const;
  127. // Construct classes for class_ndim_norm.
  128. HTuple LearnNdimNorm(const HRegion& Background, const HImage& Image, const HString& Metric, const HTuple& Distance, const HTuple& MinNumberPercent, HTuple* Center, double* Quality) const;
  129. // Construct classes for class_ndim_norm.
  130. HTuple LearnNdimNorm(const HRegion& Background, const HImage& Image, const HString& Metric, double Distance, double MinNumberPercent, HTuple* Center, double* Quality) const;
  131. // Construct classes for class_ndim_norm.
  132. HTuple LearnNdimNorm(const HRegion& Background, const HImage& Image, const char* Metric, double Distance, double MinNumberPercent, HTuple* Center, double* Quality) const;
  133. #ifdef _WIN32
  134. // Construct classes for class_ndim_norm.
  135. HTuple LearnNdimNorm(const HRegion& Background, const HImage& Image, const wchar_t* Metric, double Distance, double MinNumberPercent, HTuple* Center, double* Quality) const;
  136. #endif
  137. // Train a classificator using a multi-channel image.
  138. void LearnNdimBox(const HRegion& Background, const HImage& MultiChannelImage, const HClassBox& ClassifHandle) const;
  139. // Transform a region in polar coordinates back to Cartesian coordinates.
  140. HRegion PolarTransRegionInv(const HTuple& Row, const HTuple& Column, double AngleStart, double AngleEnd, const HTuple& RadiusStart, const HTuple& RadiusEnd, Hlong WidthIn, Hlong HeightIn, Hlong Width, Hlong Height, const HString& Interpolation) const;
  141. // Transform a region in polar coordinates back to Cartesian coordinates.
  142. HRegion PolarTransRegionInv(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong WidthIn, Hlong HeightIn, Hlong Width, Hlong Height, const HString& Interpolation) const;
  143. // Transform a region in polar coordinates back to Cartesian coordinates.
  144. HRegion PolarTransRegionInv(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong WidthIn, Hlong HeightIn, Hlong Width, Hlong Height, const char* Interpolation) const;
  145. #ifdef _WIN32
  146. // Transform a region in polar coordinates back to Cartesian coordinates.
  147. HRegion PolarTransRegionInv(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong WidthIn, Hlong HeightIn, Hlong Width, Hlong Height, const wchar_t* Interpolation) const;
  148. #endif
  149. // Transform a region within an annular arc to polar coordinates.
  150. HRegion PolarTransRegion(const HTuple& Row, const HTuple& Column, double AngleStart, double AngleEnd, const HTuple& RadiusStart, const HTuple& RadiusEnd, Hlong Width, Hlong Height, const HString& Interpolation) const;
  151. // Transform a region within an annular arc to polar coordinates.
  152. HRegion PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const HString& Interpolation) const;
  153. // Transform a region within an annular arc to polar coordinates.
  154. HRegion PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const char* Interpolation) const;
  155. #ifdef _WIN32
  156. // Transform a region within an annular arc to polar coordinates.
  157. HRegion PolarTransRegion(double Row, double Column, double AngleStart, double AngleEnd, double RadiusStart, double RadiusEnd, Hlong Width, Hlong Height, const wchar_t* Interpolation) const;
  158. #endif
  159. // Merge regions from line scan images.
  160. HRegion MergeRegionsLineScan(const HRegion& PrevRegions, HRegion* PrevMergedRegions, Hlong ImageHeight, const HString& MergeBorder, Hlong MaxImagesRegion) const;
  161. // Merge regions from line scan images.
  162. HRegion MergeRegionsLineScan(const HRegion& PrevRegions, HRegion* PrevMergedRegions, Hlong ImageHeight, const char* MergeBorder, Hlong MaxImagesRegion) const;
  163. #ifdef _WIN32
  164. // Merge regions from line scan images.
  165. HRegion MergeRegionsLineScan(const HRegion& PrevRegions, HRegion* PrevMergedRegions, Hlong ImageHeight, const wchar_t* MergeBorder, Hlong MaxImagesRegion) const;
  166. #endif
  167. // Partition a region into rectangles of approximately equal size.
  168. HRegion PartitionRectangle(double Width, double Height) const;
  169. // Partition a region horizontally at positions of small vertical extent.
  170. HRegion PartitionDynamic(double Distance, double Percent) const;
  171. // Convert regions to a label image.
  172. HImage RegionToLabel(const HString& Type, Hlong Width, Hlong Height) const;
  173. // Convert regions to a label image.
  174. HImage RegionToLabel(const char* Type, Hlong Width, Hlong Height) const;
  175. #ifdef _WIN32
  176. // Convert regions to a label image.
  177. HImage RegionToLabel(const wchar_t* Type, Hlong Width, Hlong Height) const;
  178. #endif
  179. // Convert a region into a binary byte-image.
  180. HImage RegionToBin(Hlong ForegroundGray, Hlong BackgroundGray, Hlong Width, Hlong Height) const;
  181. // Return the union of two regions.
  182. HRegion Union2(const HRegion& Region2) const;
  183. // Return the union of all input regions.
  184. HRegion Union1() const;
  185. // Compute the closest-point transformation of a region.
  186. HImage ClosestPointTransform(HImage* ClosestPoints, const HString& Metric, const HString& Foreground, const HString& ClosestPointMode, Hlong Width, Hlong Height) const;
  187. // Compute the closest-point transformation of a region.
  188. HImage ClosestPointTransform(HImage* ClosestPoints, const char* Metric, const char* Foreground, const char* ClosestPointMode, Hlong Width, Hlong Height) const;
  189. #ifdef _WIN32
  190. // Compute the closest-point transformation of a region.
  191. HImage ClosestPointTransform(HImage* ClosestPoints, const wchar_t* Metric, const wchar_t* Foreground, const wchar_t* ClosestPointMode, Hlong Width, Hlong Height) const;
  192. #endif
  193. // Compute the distance transformation of a region.
  194. HImage DistanceTransform(const HString& Metric, const HString& Foreground, Hlong Width, Hlong Height) const;
  195. // Compute the distance transformation of a region.
  196. HImage DistanceTransform(const char* Metric, const char* Foreground, Hlong Width, Hlong Height) const;
  197. #ifdef _WIN32
  198. // Compute the distance transformation of a region.
  199. HImage DistanceTransform(const wchar_t* Metric, const wchar_t* Foreground, Hlong Width, Hlong Height) const;
  200. #endif
  201. // Compute the skeleton of a region.
  202. HRegion Skeleton() const;
  203. // Apply a projective transformation to a region.
  204. HRegion ProjectiveTransRegion(const HHomMat2D& HomMat2D, const HString& Interpolation) const;
  205. // Apply a projective transformation to a region.
  206. HRegion ProjectiveTransRegion(const HHomMat2D& HomMat2D, const char* Interpolation) const;
  207. #ifdef _WIN32
  208. // Apply a projective transformation to a region.
  209. HRegion ProjectiveTransRegion(const HHomMat2D& HomMat2D, const wchar_t* Interpolation) const;
  210. #endif
  211. // Apply an arbitrary affine 2D transformation to regions.
  212. HRegion AffineTransRegion(const HHomMat2D& HomMat2D, const HString& Interpolate) const;
  213. // Apply an arbitrary affine 2D transformation to regions.
  214. HRegion AffineTransRegion(const HHomMat2D& HomMat2D, const char* Interpolate) const;
  215. #ifdef _WIN32
  216. // Apply an arbitrary affine 2D transformation to regions.
  217. HRegion AffineTransRegion(const HHomMat2D& HomMat2D, const wchar_t* Interpolate) const;
  218. #endif
  219. // Reflect a region about an axis.
  220. HRegion MirrorRegion(const HString& Mode, Hlong WidthHeight) const;
  221. // Reflect a region about an axis.
  222. HRegion MirrorRegion(const char* Mode, Hlong WidthHeight) const;
  223. #ifdef _WIN32
  224. // Reflect a region about an axis.
  225. HRegion MirrorRegion(const wchar_t* Mode, Hlong WidthHeight) const;
  226. #endif
  227. // Zoom a region.
  228. HRegion ZoomRegion(double ScaleWidth, double ScaleHeight) const;
  229. // Translate a region.
  230. HRegion MoveRegion(Hlong Row, Hlong Column) const;
  231. // Find junctions and end points in a skeleton.
  232. HRegion JunctionsSkeleton(HRegion* JuncPoints) const;
  233. // Calculate the intersection of two regions.
  234. HRegion Intersection(const HRegion& Region2) const;
  235. // Partition the image plane using given regions.
  236. HRegion Interjacent(const HString& Mode) const;
  237. // Partition the image plane using given regions.
  238. HRegion Interjacent(const char* Mode) const;
  239. #ifdef _WIN32
  240. // Partition the image plane using given regions.
  241. HRegion Interjacent(const wchar_t* Mode) const;
  242. #endif
  243. // Fill up holes in regions.
  244. HRegion FillUp() const;
  245. // Fill up holes in regions having given shape features.
  246. HRegion FillUpShape(const HString& Feature, const HTuple& Min, const HTuple& Max) const;
  247. // Fill up holes in regions having given shape features.
  248. HRegion FillUpShape(const HString& Feature, double Min, double Max) const;
  249. // Fill up holes in regions having given shape features.
  250. HRegion FillUpShape(const char* Feature, double Min, double Max) const;
  251. #ifdef _WIN32
  252. // Fill up holes in regions having given shape features.
  253. HRegion FillUpShape(const wchar_t* Feature, double Min, double Max) const;
  254. #endif
  255. // Fill gaps between regions or split overlapping regions.
  256. HRegion ExpandRegion(const HRegion& ForbiddenArea, const HTuple& Iterations, const HString& Mode) const;
  257. // Fill gaps between regions or split overlapping regions.
  258. HRegion ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const HString& Mode) const;
  259. // Fill gaps between regions or split overlapping regions.
  260. HRegion ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const char* Mode) const;
  261. #ifdef _WIN32
  262. // Fill gaps between regions or split overlapping regions.
  263. HRegion ExpandRegion(const HRegion& ForbiddenArea, Hlong Iterations, const wchar_t* Mode) const;
  264. #endif
  265. // Clip a region relative to its smallest surrounding rectangle.
  266. HRegion ClipRegionRel(Hlong Top, Hlong Bottom, Hlong Left, Hlong Right) const;
  267. // Clip a region to a rectangle.
  268. HRegion ClipRegion(Hlong Row1, Hlong Column1, Hlong Row2, Hlong Column2) const;
  269. // Rank operator for regions.
  270. HRegion RankRegion(Hlong Width, Hlong Height, Hlong Number) const;
  271. // Compute connected components of a region.
  272. HRegion Connection() const;
  273. // Calculate the symmetric difference of two regions.
  274. HRegion SymmDifference(const HRegion& Region2) const;
  275. // Calculate the difference of two regions.
  276. HRegion Difference(const HRegion& Sub) const;
  277. // Return the complement of a region.
  278. HRegion Complement() const;
  279. // Determine the connected components of the background of given regions.
  280. HRegion BackgroundSeg() const;
  281. // Generate a region having a given Hamming distance.
  282. HRegion HammingChangeRegion(Hlong Width, Hlong Height, Hlong Distance) const;
  283. // Remove noise from a region.
  284. HRegion RemoveNoiseRegion(const HString& Type) const;
  285. // Remove noise from a region.
  286. HRegion RemoveNoiseRegion(const char* Type) const;
  287. #ifdef _WIN32
  288. // Remove noise from a region.
  289. HRegion RemoveNoiseRegion(const wchar_t* Type) const;
  290. #endif
  291. // Transform the shape of a region.
  292. HRegion ShapeTrans(const HString& Type) const;
  293. // Transform the shape of a region.
  294. HRegion ShapeTrans(const char* Type) const;
  295. #ifdef _WIN32
  296. // Transform the shape of a region.
  297. HRegion ShapeTrans(const wchar_t* Type) const;
  298. #endif
  299. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  300. HRegion ExpandGray(const HImage& Image, const HRegion& ForbiddenArea, const HTuple& Iterations, const HString& Mode, const HTuple& Threshold) const;
  301. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  302. HRegion ExpandGray(const HImage& Image, const HRegion& ForbiddenArea, const HString& Iterations, const HString& Mode, Hlong Threshold) const;
  303. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  304. HRegion ExpandGray(const HImage& Image, const HRegion& ForbiddenArea, const char* Iterations, const char* Mode, Hlong Threshold) const;
  305. #ifdef _WIN32
  306. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  307. HRegion ExpandGray(const HImage& Image, const HRegion& ForbiddenArea, const wchar_t* Iterations, const wchar_t* Mode, Hlong Threshold) const;
  308. #endif
  309. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  310. HRegion ExpandGrayRef(const HImage& Image, const HRegion& ForbiddenArea, const HTuple& Iterations, const HString& Mode, const HTuple& RefGray, const HTuple& Threshold) const;
  311. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  312. HRegion ExpandGrayRef(const HImage& Image, const HRegion& ForbiddenArea, const HString& Iterations, const HString& Mode, Hlong RefGray, Hlong Threshold) const;
  313. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  314. HRegion ExpandGrayRef(const HImage& Image, const HRegion& ForbiddenArea, const char* Iterations, const char* Mode, Hlong RefGray, Hlong Threshold) const;
  315. #ifdef _WIN32
  316. // Fill gaps between regions (depending on gray value or color) or split overlapping regions.
  317. HRegion ExpandGrayRef(const HImage& Image, const HRegion& ForbiddenArea, const wchar_t* Iterations, const wchar_t* Mode, Hlong RefGray, Hlong Threshold) const;
  318. #endif
  319. // Split lines represented by one pixel wide, non-branching lines.
  320. void SplitSkeletonLines(Hlong MaxDistance, HTuple* BeginRow, HTuple* BeginCol, HTuple* EndRow, HTuple* EndCol) const;
  321. // Split lines represented by one pixel wide, non-branching regions.
  322. HRegion SplitSkeletonRegion(Hlong MaxDistance) const;
  323. // Convert a histogram into a region.
  324. void GenRegionHisto(const HTuple& Histogram, Hlong Row, Hlong Column, Hlong Scale);
  325. // Eliminate runs of a given length.
  326. HRegion EliminateRuns(Hlong ElimShorter, Hlong ElimLonger) const;
  327. // Calculate the difference of two object tuples.
  328. HRegion ObjDiff(const HRegion& ObjectsSub) const;
  329. // Paint regions into an image.
  330. HImage PaintRegion(const HImage& Image, const HTuple& Grayval, const HString& Type) const;
  331. // Paint regions into an image.
  332. HImage PaintRegion(const HImage& Image, double Grayval, const HString& Type) const;
  333. // Paint regions into an image.
  334. HImage PaintRegion(const HImage& Image, double Grayval, const char* Type) const;
  335. #ifdef _WIN32
  336. // Paint regions into an image.
  337. HImage PaintRegion(const HImage& Image, double Grayval, const wchar_t* Type) const;
  338. #endif
  339. // Overpaint regions in an image.
  340. void OverpaintRegion(const HImage& Image, const HTuple& Grayval, const HString& Type) const;
  341. // Overpaint regions in an image.
  342. void OverpaintRegion(const HImage& Image, double Grayval, const HString& Type) const;
  343. // Overpaint regions in an image.
  344. void OverpaintRegion(const HImage& Image, double Grayval, const char* Type) const;
  345. #ifdef _WIN32
  346. // Overpaint regions in an image.
  347. void OverpaintRegion(const HImage& Image, double Grayval, const wchar_t* Type) const;
  348. #endif
  349. // Copy an iconic object in the HALCON database.
  350. HRegion CopyObj(Hlong Index, Hlong NumObj) const;
  351. // Concatenate two iconic object tuples.
  352. HRegion ConcatObj(const HRegion& Objects2) const;
  353. // Select objects from an object tuple.
  354. HRegion SelectObj(const HTuple& Index) const;
  355. // Select objects from an object tuple.
  356. HRegion SelectObj(Hlong Index) const;
  357. // Compare iconic objects regarding equality.
  358. Hlong CompareObj(const HRegion& Objects2, const HTuple& Epsilon) const;
  359. // Compare iconic objects regarding equality.
  360. Hlong CompareObj(const HRegion& Objects2, double Epsilon) const;
  361. // Test whether a region is contained in another region.
  362. HTuple TestSubsetRegion(const HRegion& Region2) const;
  363. // Test whether the regions of two objects are identical.
  364. Hlong TestEqualRegion(const HRegion& Regions2) const;
  365. // Compare image objects regarding equality.
  366. Hlong TestEqualObj(const HRegion& Objects2) const;
  367. // Store a polygon as a "filled" region.
  368. void GenRegionPolygonFilled(const HTuple& Rows, const HTuple& Columns);
  369. // Store a polygon as a region.
  370. void GenRegionPolygon(const HTuple& Rows, const HTuple& Columns);
  371. // Store individual pixels as image region.
  372. void GenRegionPoints(const HTuple& Rows, const HTuple& Columns);
  373. // Store individual pixels as image region.
  374. void GenRegionPoints(Hlong Rows, Hlong Columns);
  375. // Create a region from a runlength coding.
  376. void GenRegionRuns(const HTuple& Row, const HTuple& ColumnBegin, const HTuple& ColumnEnd);
  377. // Create a region from a runlength coding.
  378. void GenRegionRuns(Hlong Row, Hlong ColumnBegin, Hlong ColumnEnd);
  379. // Create a rectangle of any orientation.
  380. void GenRectangle2(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Length1, const HTuple& Length2);
  381. // Create a rectangle of any orientation.
  382. void GenRectangle2(double Row, double Column, double Phi, double Length1, double Length2);
  383. // Create a rectangle parallel to the coordinate axes.
  384. void GenRectangle1(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2);
  385. // Create a rectangle parallel to the coordinate axes.
  386. void GenRectangle1(double Row1, double Column1, double Row2, double Column2);
  387. // Create a random region.
  388. void GenRandomRegion(Hlong Width, Hlong Height);
  389. // Create an ellipse sector.
  390. void GenEllipseSector(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Radius1, const HTuple& Radius2, const HTuple& StartAngle, const HTuple& EndAngle);
  391. // Create an ellipse sector.
  392. void GenEllipseSector(double Row, double Column, double Phi, double Radius1, double Radius2, double StartAngle, double EndAngle);
  393. // Create an ellipse.
  394. void GenEllipse(const HTuple& Row, const HTuple& Column, const HTuple& Phi, const HTuple& Radius1, const HTuple& Radius2);
  395. // Create an ellipse.
  396. void GenEllipse(double Row, double Column, double Phi, double Radius1, double Radius2);
  397. // Create a circle sector.
  398. void GenCircleSector(const HTuple& Row, const HTuple& Column, const HTuple& Radius, const HTuple& StartAngle, const HTuple& EndAngle);
  399. // Create a circle sector.
  400. void GenCircleSector(double Row, double Column, double Radius, double StartAngle, double EndAngle);
  401. // Create a circle.
  402. void GenCircle(const HTuple& Row, const HTuple& Column, const HTuple& Radius);
  403. // Create a circle.
  404. void GenCircle(double Row, double Column, double Radius);
  405. // Create a checkered region.
  406. void GenCheckerRegion(Hlong WidthRegion, Hlong HeightRegion, Hlong WidthPattern, Hlong HeightPattern);
  407. // Create a region from lines or pixels.
  408. void GenGridRegion(const HTuple& RowSteps, const HTuple& ColumnSteps, const HString& Type, Hlong Width, Hlong Height);
  409. // Create a region from lines or pixels.
  410. void GenGridRegion(Hlong RowSteps, Hlong ColumnSteps, const HString& Type, Hlong Width, Hlong Height);
  411. // Create a region from lines or pixels.
  412. void GenGridRegion(Hlong RowSteps, Hlong ColumnSteps, const char* Type, Hlong Width, Hlong Height);
  413. #ifdef _WIN32
  414. // Create a region from lines or pixels.
  415. void GenGridRegion(Hlong RowSteps, Hlong ColumnSteps, const wchar_t* Type, Hlong Width, Hlong Height);
  416. #endif
  417. // Create random regions like circles, rectangles and ellipses.
  418. void GenRandomRegions(const HString& Type, const HTuple& WidthMin, const HTuple& WidthMax, const HTuple& HeightMin, const HTuple& HeightMax, const HTuple& PhiMin, const HTuple& PhiMax, Hlong NumRegions, Hlong Width, Hlong Height);
  419. // Create random regions like circles, rectangles and ellipses.
  420. void GenRandomRegions(const HString& Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height);
  421. // Create random regions like circles, rectangles and ellipses.
  422. void GenRandomRegions(const char* Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height);
  423. #ifdef _WIN32
  424. // Create random regions like circles, rectangles and ellipses.
  425. void GenRandomRegions(const wchar_t* Type, double WidthMin, double WidthMax, double HeightMin, double HeightMax, double PhiMin, double PhiMax, Hlong NumRegions, Hlong Width, Hlong Height);
  426. #endif
  427. // Store input lines described in Hesse normal form as regions.
  428. void GenRegionHline(const HTuple& Orientation, const HTuple& Distance);
  429. // Store input lines described in Hesse normal form as regions.
  430. void GenRegionHline(double Orientation, double Distance);
  431. // Store input lines as regions.
  432. void GenRegionLine(const HTuple& BeginRow, const HTuple& BeginCol, const HTuple& EndRow, const HTuple& EndCol);
  433. // Store input lines as regions.
  434. void GenRegionLine(Hlong BeginRow, Hlong BeginCol, Hlong EndRow, Hlong EndCol);
  435. // Create an empty region.
  436. void GenEmptyRegion();
  437. // Access the thickness of a region along the main axis.
  438. HTuple GetRegionThickness(HTuple* Histogramm) const;
  439. // Polygon approximation of a region.
  440. void GetRegionPolygon(const HTuple& Tolerance, HTuple* Rows, HTuple* Columns) const;
  441. // Polygon approximation of a region.
  442. void GetRegionPolygon(double Tolerance, HTuple* Rows, HTuple* Columns) const;
  443. // Access the pixels of a region.
  444. void GetRegionPoints(HTuple* Rows, HTuple* Columns) const;
  445. // Access the contour of an object.
  446. void GetRegionContour(HTuple* Rows, HTuple* Columns) const;
  447. // Access the runlength coding of a region.
  448. void GetRegionRuns(HTuple* Row, HTuple* ColumnBegin, HTuple* ColumnEnd) const;
  449. // Contour of an object as chain code.
  450. void GetRegionChain(Hlong* Row, Hlong* Column, HTuple* Chain) const;
  451. // Access convex hull as contour.
  452. void GetRegionConvex(HTuple* Rows, HTuple* Columns) const;
  453. // Classify a related group of characters with an OCR classifier.
  454. HTuple DoOcrWordKnn(const HImage& Image, const HOCRKnn& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, HTuple* Confidence, HString* Word, double* Score) const;
  455. // Classify a related group of characters with an OCR classifier.
  456. HString DoOcrWordKnn(const HImage& Image, const HOCRKnn& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  457. // Classify a related group of characters with an OCR classifier.
  458. HString DoOcrWordKnn(const HImage& Image, const HOCRKnn& OCRHandle, const char* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  459. #ifdef _WIN32
  460. // Classify a related group of characters with an OCR classifier.
  461. HString DoOcrWordKnn(const HImage& Image, const HOCRKnn& OCRHandle, const wchar_t* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  462. #endif
  463. // Classify multiple characters with an k-NN classifier.
  464. HTuple DoOcrMultiClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, HTuple* Confidence) const;
  465. // Classify multiple characters with an k-NN classifier.
  466. HString DoOcrMultiClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, double* Confidence) const;
  467. // Classify a single character with an OCR classifier.
  468. HTuple DoOcrSingleClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, const HTuple& NumClasses, const HTuple& NumNeighbors, HTuple* Confidence) const;
  469. // Classify a single character with an OCR classifier.
  470. HString DoOcrSingleClassKnn(const HImage& Image, const HOCRKnn& OCRHandle, const HTuple& NumClasses, const HTuple& NumNeighbors, double* Confidence) const;
  471. // Classify a related group of characters with an OCR classifier.
  472. HTuple DoOcrWordSvm(const HImage& Image, const HOCRSvm& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, HString* Word, double* Score) const;
  473. // Classify a related group of characters with an OCR classifier.
  474. HTuple DoOcrWordSvm(const HImage& Image, const HOCRSvm& OCRHandle, const char* Expression, Hlong NumAlternatives, Hlong NumCorrections, HString* Word, double* Score) const;
  475. #ifdef _WIN32
  476. // Classify a related group of characters with an OCR classifier.
  477. HTuple DoOcrWordSvm(const HImage& Image, const HOCRSvm& OCRHandle, const wchar_t* Expression, Hlong NumAlternatives, Hlong NumCorrections, HString* Word, double* Score) const;
  478. #endif
  479. // Classify multiple characters with an SVM-based OCR classifier.
  480. HTuple DoOcrMultiClassSvm(const HImage& Image, const HOCRSvm& OCRHandle) const;
  481. // Classify a single character with an SVM-based OCR classifier.
  482. HTuple DoOcrSingleClassSvm(const HImage& Image, const HOCRSvm& OCRHandle, const HTuple& Num) const;
  483. // Classify a related group of characters with an OCR classifier.
  484. HTuple DoOcrWordMlp(const HImage& Image, const HOCRMlp& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, HTuple* Confidence, HString* Word, double* Score) const;
  485. // Classify a related group of characters with an OCR classifier.
  486. HString DoOcrWordMlp(const HImage& Image, const HOCRMlp& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  487. // Classify a related group of characters with an OCR classifier.
  488. HString DoOcrWordMlp(const HImage& Image, const HOCRMlp& OCRHandle, const char* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  489. #ifdef _WIN32
  490. // Classify a related group of characters with an OCR classifier.
  491. HString DoOcrWordMlp(const HImage& Image, const HOCRMlp& OCRHandle, const wchar_t* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  492. #endif
  493. // Classify multiple characters with an OCR classifier.
  494. HTuple DoOcrMultiClassMlp(const HImage& Image, const HOCRMlp& OCRHandle, HTuple* Confidence) const;
  495. // Classify multiple characters with an OCR classifier.
  496. HString DoOcrMultiClassMlp(const HImage& Image, const HOCRMlp& OCRHandle, double* Confidence) const;
  497. // Classify a single character with an OCR classifier.
  498. HTuple DoOcrSingleClassMlp(const HImage& Image, const HOCRMlp& OCRHandle, const HTuple& Num, HTuple* Confidence) const;
  499. // Classify a single character with an OCR classifier.
  500. HString DoOcrSingleClassMlp(const HImage& Image, const HOCRMlp& OCRHandle, const HTuple& Num, double* Confidence) const;
  501. // Classify one character.
  502. HTuple DoOcrSingle(const HImage& Image, const HOCRBox& OcrHandle, HTuple* Confidences) const;
  503. // Classify characters.
  504. HTuple DoOcrMulti(const HImage& Image, const HOCRBox& OcrHandle, HTuple* Confidence) const;
  505. // Classify characters.
  506. HString DoOcrMulti(const HImage& Image, const HOCRBox& OcrHandle, double* Confidence) const;
  507. // Train an OCR classifier by the input of regions.
  508. double TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HTuple& Class) const;
  509. // Train an OCR classifier by the input of regions.
  510. double TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HString& Class) const;
  511. // Train an OCR classifier by the input of regions.
  512. double TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const char* Class) const;
  513. #ifdef _WIN32
  514. // Train an OCR classifier by the input of regions.
  515. double TraindOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const wchar_t* Class) const;
  516. #endif
  517. // Protection of training data.
  518. static void ProtectOcrTrainf(const HString& TrainingFile, const HTuple& Password, const HString& TrainingFileProtected);
  519. // Protection of training data.
  520. static void ProtectOcrTrainf(const HString& TrainingFile, const HString& Password, const HString& TrainingFileProtected);
  521. // Protection of training data.
  522. static void ProtectOcrTrainf(const char* TrainingFile, const char* Password, const char* TrainingFileProtected);
  523. #ifdef _WIN32
  524. // Protection of training data.
  525. static void ProtectOcrTrainf(const wchar_t* TrainingFile, const wchar_t* Password, const wchar_t* TrainingFileProtected);
  526. #endif
  527. // Storing of training characters into a file.
  528. void WriteOcrTrainf(const HImage& Image, const HTuple& Class, const HString& TrainingFile) const;
  529. // Storing of training characters into a file.
  530. void WriteOcrTrainf(const HImage& Image, const HString& Class, const HString& TrainingFile) const;
  531. // Storing of training characters into a file.
  532. void WriteOcrTrainf(const HImage& Image, const char* Class, const char* TrainingFile) const;
  533. #ifdef _WIN32
  534. // Storing of training characters into a file.
  535. void WriteOcrTrainf(const HImage& Image, const wchar_t* Class, const wchar_t* TrainingFile) const;
  536. #endif
  537. // Sorting of regions with respect to their relative position.
  538. HRegion SortRegion(const HTuple& SortMode, const HString& Order, const HString& RowOrCol) const;
  539. // Sorting of regions with respect to their relative position.
  540. HRegion SortRegion(const HTuple& SortMode, const char* Order, const char* RowOrCol) const;
  541. #ifdef _WIN32
  542. // Sorting of regions with respect to their relative position.
  543. HRegion SortRegion(const HTuple& SortMode, const wchar_t* Order, const wchar_t* RowOrCol) const;
  544. #endif
  545. // Test an OCR classifier.
  546. HTuple TestdOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HTuple& Class) const;
  547. // Test an OCR classifier.
  548. double TestdOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const HString& Class) const;
  549. // Test an OCR classifier.
  550. double TestdOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const char* Class) const;
  551. #ifdef _WIN32
  552. // Test an OCR classifier.
  553. double TestdOcrClassBox(const HImage& Image, const HOCRBox& OcrHandle, const wchar_t* Class) const;
  554. #endif
  555. // Add characters to a training file.
  556. void AppendOcrTrainf(const HImage& Image, const HTuple& Class, const HString& TrainingFile) const;
  557. // Add characters to a training file.
  558. void AppendOcrTrainf(const HImage& Image, const HString& Class, const HString& TrainingFile) const;
  559. // Add characters to a training file.
  560. void AppendOcrTrainf(const HImage& Image, const char* Class, const char* TrainingFile) const;
  561. #ifdef _WIN32
  562. // Add characters to a training file.
  563. void AppendOcrTrainf(const HImage& Image, const wchar_t* Class, const wchar_t* TrainingFile) const;
  564. #endif
  565. // Prune the branches of a region.
  566. HRegion Pruning(Hlong Length) const;
  567. // Reduce a region to its boundary.
  568. HRegion Boundary(const HString& BoundaryType) const;
  569. // Reduce a region to its boundary.
  570. HRegion Boundary(const char* BoundaryType) const;
  571. #ifdef _WIN32
  572. // Reduce a region to its boundary.
  573. HRegion Boundary(const wchar_t* BoundaryType) const;
  574. #endif
  575. // Perform a closing after an opening with multiple structuring elements.
  576. HRegion Fitting(const HRegion& StructElements) const;
  577. // Generate standard structuring elements.
  578. void GenStructElements(const HString& Type, Hlong Row, Hlong Column);
  579. // Generate standard structuring elements.
  580. void GenStructElements(const char* Type, Hlong Row, Hlong Column);
  581. #ifdef _WIN32
  582. // Generate standard structuring elements.
  583. void GenStructElements(const wchar_t* Type, Hlong Row, Hlong Column);
  584. #endif
  585. // Reflect a region about a point.
  586. HRegion TransposeRegion(Hlong Row, Hlong Column) const;
  587. // Remove the result of a hit-or-miss operation from a region (sequential).
  588. HRegion ThinningSeq(const HString& GolayElement, const HTuple& Iterations) const;
  589. // Remove the result of a hit-or-miss operation from a region (sequential).
  590. HRegion ThinningSeq(const HString& GolayElement, Hlong Iterations) const;
  591. // Remove the result of a hit-or-miss operation from a region (sequential).
  592. HRegion ThinningSeq(const char* GolayElement, Hlong Iterations) const;
  593. #ifdef _WIN32
  594. // Remove the result of a hit-or-miss operation from a region (sequential).
  595. HRegion ThinningSeq(const wchar_t* GolayElement, Hlong Iterations) const;
  596. #endif
  597. // Remove the result of a hit-or-miss operation from a region (using a Golay structuring element).
  598. HRegion ThinningGolay(const HString& GolayElement, Hlong Rotation) const;
  599. // Remove the result of a hit-or-miss operation from a region (using a Golay structuring element).
  600. HRegion ThinningGolay(const char* GolayElement, Hlong Rotation) const;
  601. #ifdef _WIN32
  602. // Remove the result of a hit-or-miss operation from a region (using a Golay structuring element).
  603. HRegion ThinningGolay(const wchar_t* GolayElement, Hlong Rotation) const;
  604. #endif
  605. // Remove the result of a hit-or-miss operation from a region.
  606. HRegion Thinning(const HRegion& StructElement1, const HRegion& StructElement2, Hlong Row, Hlong Column, Hlong Iterations) const;
  607. // Add the result of a hit-or-miss operation to a region (sequential).
  608. HRegion ThickeningSeq(const HString& GolayElement, Hlong Iterations) const;
  609. // Add the result of a hit-or-miss operation to a region (sequential).
  610. HRegion ThickeningSeq(const char* GolayElement, Hlong Iterations) const;
  611. #ifdef _WIN32
  612. // Add the result of a hit-or-miss operation to a region (sequential).
  613. HRegion ThickeningSeq(const wchar_t* GolayElement, Hlong Iterations) const;
  614. #endif
  615. // Add the result of a hit-or-miss operation to a region (using a Golay structuring element).
  616. HRegion ThickeningGolay(const HString& GolayElement, Hlong Rotation) const;
  617. // Add the result of a hit-or-miss operation to a region (using a Golay structuring element).
  618. HRegion ThickeningGolay(const char* GolayElement, Hlong Rotation) const;
  619. #ifdef _WIN32
  620. // Add the result of a hit-or-miss operation to a region (using a Golay structuring element).
  621. HRegion ThickeningGolay(const wchar_t* GolayElement, Hlong Rotation) const;
  622. #endif
  623. // Add the result of a hit-or-miss operation to a region.
  624. HRegion Thickening(const HRegion& StructElement1, const HRegion& StructElement2, Hlong Row, Hlong Column, Hlong Iterations) const;
  625. // Hit-or-miss operation for regions using the Golay alphabet (sequential).
  626. HRegion HitOrMissSeq(const HString& GolayElement) const;
  627. // Hit-or-miss operation for regions using the Golay alphabet (sequential).
  628. HRegion HitOrMissSeq(const char* GolayElement) const;
  629. #ifdef _WIN32
  630. // Hit-or-miss operation for regions using the Golay alphabet (sequential).
  631. HRegion HitOrMissSeq(const wchar_t* GolayElement) const;
  632. #endif
  633. // Hit-or-miss operation for regions using the Golay alphabet.
  634. HRegion HitOrMissGolay(const HString& GolayElement, Hlong Rotation) const;
  635. // Hit-or-miss operation for regions using the Golay alphabet.
  636. HRegion HitOrMissGolay(const char* GolayElement, Hlong Rotation) const;
  637. #ifdef _WIN32
  638. // Hit-or-miss operation for regions using the Golay alphabet.
  639. HRegion HitOrMissGolay(const wchar_t* GolayElement, Hlong Rotation) const;
  640. #endif
  641. // Hit-or-miss operation for regions.
  642. HRegion HitOrMiss(const HRegion& StructElement1, const HRegion& StructElement2, Hlong Row, Hlong Column) const;
  643. // Generate the structuring elements of the Golay alphabet.
  644. HRegion GolayElements(const HString& GolayElement, Hlong Rotation, Hlong Row, Hlong Column);
  645. // Generate the structuring elements of the Golay alphabet.
  646. HRegion GolayElements(const char* GolayElement, Hlong Rotation, Hlong Row, Hlong Column);
  647. #ifdef _WIN32
  648. // Generate the structuring elements of the Golay alphabet.
  649. HRegion GolayElements(const wchar_t* GolayElement, Hlong Rotation, Hlong Row, Hlong Column);
  650. #endif
  651. // Thinning of a region.
  652. HRegion MorphSkiz(const HTuple& Iterations1, const HTuple& Iterations2) const;
  653. // Thinning of a region.
  654. HRegion MorphSkiz(Hlong Iterations1, Hlong Iterations2) const;
  655. // Compute the morphological skeleton of a region.
  656. HRegion MorphSkeleton() const;
  657. // Compute the union of bottom_hat and top_hat.
  658. HRegion MorphHat(const HRegion& StructElement) const;
  659. // Compute the bottom hat of regions.
  660. HRegion BottomHat(const HRegion& StructElement) const;
  661. // Compute the top hat of regions.
  662. HRegion TopHat(const HRegion& StructElement) const;
  663. // Erode a region (using a reference point).
  664. HRegion MinkowskiSub2(const HRegion& StructElement, Hlong Row, Hlong Column, Hlong Iterations) const;
  665. // Erode a region.
  666. HRegion MinkowskiSub1(const HRegion& StructElement, Hlong Iterations) const;
  667. // Dilate a region (using a reference point).
  668. HRegion MinkowskiAdd2(const HRegion& StructElement, Hlong Row, Hlong Column, Hlong Iterations) const;
  669. // Perform a Minkowski addition on a region.
  670. HRegion MinkowskiAdd1(const HRegion& StructElement, Hlong Iterations) const;
  671. // Close a region with a rectangular structuring element.
  672. HRegion ClosingRectangle1(Hlong Width, Hlong Height) const;
  673. // Close a region with an element from the Golay alphabet.
  674. HRegion ClosingGolay(const HString& GolayElement, Hlong Rotation) const;
  675. // Close a region with an element from the Golay alphabet.
  676. HRegion ClosingGolay(const char* GolayElement, Hlong Rotation) const;
  677. #ifdef _WIN32
  678. // Close a region with an element from the Golay alphabet.
  679. HRegion ClosingGolay(const wchar_t* GolayElement, Hlong Rotation) const;
  680. #endif
  681. // Close a region with a circular structuring element.
  682. HRegion ClosingCircle(const HTuple& Radius) const;
  683. // Close a region with a circular structuring element.
  684. HRegion ClosingCircle(double Radius) const;
  685. // Close a region.
  686. HRegion Closing(const HRegion& StructElement) const;
  687. // Separate overlapping regions.
  688. HRegion OpeningSeg(const HRegion& StructElement) const;
  689. // Open a region with an element from the Golay alphabet.
  690. HRegion OpeningGolay(const HString& GolayElement, Hlong Rotation) const;
  691. // Open a region with an element from the Golay alphabet.
  692. HRegion OpeningGolay(const char* GolayElement, Hlong Rotation) const;
  693. #ifdef _WIN32
  694. // Open a region with an element from the Golay alphabet.
  695. HRegion OpeningGolay(const wchar_t* GolayElement, Hlong Rotation) const;
  696. #endif
  697. // Open a region with a rectangular structuring element.
  698. HRegion OpeningRectangle1(Hlong Width, Hlong Height) const;
  699. // Open a region with a circular structuring element.
  700. HRegion OpeningCircle(const HTuple& Radius) const;
  701. // Open a region with a circular structuring element.
  702. HRegion OpeningCircle(double Radius) const;
  703. // Open a region.
  704. HRegion Opening(const HRegion& StructElement) const;
  705. // Erode a region sequentially.
  706. HRegion ErosionSeq(const HString& GolayElement, Hlong Iterations) const;
  707. // Erode a region sequentially.
  708. HRegion ErosionSeq(const char* GolayElement, Hlong Iterations) const;
  709. #ifdef _WIN32
  710. // Erode a region sequentially.
  711. HRegion ErosionSeq(const wchar_t* GolayElement, Hlong Iterations) const;
  712. #endif
  713. // Erode a region with an element from the Golay alphabet.
  714. HRegion ErosionGolay(const HString& GolayElement, Hlong Iterations, Hlong Rotation) const;
  715. // Erode a region with an element from the Golay alphabet.
  716. HRegion ErosionGolay(const char* GolayElement, Hlong Iterations, Hlong Rotation) const;
  717. #ifdef _WIN32
  718. // Erode a region with an element from the Golay alphabet.
  719. HRegion ErosionGolay(const wchar_t* GolayElement, Hlong Iterations, Hlong Rotation) const;
  720. #endif
  721. // Erode a region with a rectangular structuring element.
  722. HRegion ErosionRectangle1(Hlong Width, Hlong Height) const;
  723. // Erode a region with a circular structuring element.
  724. HRegion ErosionCircle(const HTuple& Radius) const;
  725. // Erode a region with a circular structuring element.
  726. HRegion ErosionCircle(double Radius) const;
  727. // Erode a region (using a reference point).
  728. HRegion Erosion2(const HRegion& StructElement, Hlong Row, Hlong Column, Hlong Iterations) const;
  729. // Erode a region.
  730. HRegion Erosion1(const HRegion& StructElement, Hlong Iterations) const;
  731. // Dilate a region sequentially.
  732. HRegion DilationSeq(const HString& GolayElement, Hlong Iterations) const;
  733. // Dilate a region sequentially.
  734. HRegion DilationSeq(const char* GolayElement, Hlong Iterations) const;
  735. #ifdef _WIN32
  736. // Dilate a region sequentially.
  737. HRegion DilationSeq(const wchar_t* GolayElement, Hlong Iterations) const;
  738. #endif
  739. // Dilate a region with an element from the Golay alphabet.
  740. HRegion DilationGolay(const HString& GolayElement, Hlong Iterations, Hlong Rotation) const;
  741. // Dilate a region with an element from the Golay alphabet.
  742. HRegion DilationGolay(const char* GolayElement, Hlong Iterations, Hlong Rotation) const;
  743. #ifdef _WIN32
  744. // Dilate a region with an element from the Golay alphabet.
  745. HRegion DilationGolay(const wchar_t* GolayElement, Hlong Iterations, Hlong Rotation) const;
  746. #endif
  747. // Dilate a region with a rectangular structuring element.
  748. HRegion DilationRectangle1(Hlong Width, Hlong Height) const;
  749. // Dilate a region with a circular structuring element.
  750. HRegion DilationCircle(const HTuple& Radius) const;
  751. // Dilate a region with a circular structuring element.
  752. HRegion DilationCircle(double Radius) const;
  753. // Dilate a region (using a reference point).
  754. HRegion Dilation2(const HRegion& StructElement, Hlong Row, Hlong Column, Hlong Iterations) const;
  755. // Dilate a region.
  756. HRegion Dilation1(const HRegion& StructElement, Hlong Iterations) const;
  757. // Add gray values to regions.
  758. HImage AddChannels(const HImage& Image) const;
  759. // centers of circles for a specific radius.
  760. HRegion HoughCircles(const HTuple& Radius, const HTuple& Percent, const HTuple& Mode) const;
  761. // centers of circles for a specific radius.
  762. HRegion HoughCircles(Hlong Radius, Hlong Percent, Hlong Mode) const;
  763. // Return the Hough-Transform for circles with a given radius.
  764. HImage HoughCircleTrans(const HTuple& Radius) const;
  765. // Return the Hough-Transform for circles with a given radius.
  766. HImage HoughCircleTrans(Hlong Radius) const;
  767. // Detect lines in edge images with the help of the Hough transform and returns it in HNF.
  768. HTuple HoughLines(Hlong AngleResolution, Hlong Threshold, Hlong AngleGap, Hlong DistGap, HTuple* Dist) const;
  769. // Produce the Hough transform for lines within regions.
  770. HImage HoughLineTrans(Hlong AngleResolution) const;
  771. // Select those lines from a set of lines (in HNF) which fit best into a region.
  772. HRegion SelectMatchingLines(const HTuple& AngleIn, const HTuple& DistIn, Hlong LineWidth, Hlong Thresh, HTuple* AngleOut, HTuple* DistOut) const;
  773. // Select those lines from a set of lines (in HNF) which fit best into a region.
  774. HRegion SelectMatchingLines(double AngleIn, double DistIn, Hlong LineWidth, Hlong Thresh, double* AngleOut, double* DistOut) const;
  775. // Query the icon for region output
  776. void GetIcon(const HWindow& WindowHandle);
  777. // Icon definition for region output.
  778. void SetIcon(const HWindow& WindowHandle) const;
  779. // Displays regions in a window.
  780. void DispRegion(const HWindow& WindowHandle) const;
  781. // Interactive movement of a region with restriction of positions.
  782. HRegion DragRegion3(const HRegion& MaskRegion, const HWindow& WindowHandle, Hlong Row, Hlong Column) const;
  783. // Interactive movement of a region with fixpoint specification.
  784. HRegion DragRegion2(const HWindow& WindowHandle, Hlong Row, Hlong Column) const;
  785. // Interactive moving of a region.
  786. HRegion DragRegion1(const HWindow& WindowHandle) const;
  787. // Interactive drawing of a closed region.
  788. void DrawRegion(const HWindow& WindowHandle);
  789. // Interactive drawing of a polygon row.
  790. void DrawPolygon(const HWindow& WindowHandle);
  791. // Calculate the distance between a line segment and one region.
  792. void DistanceSr(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax) const;
  793. // Calculate the distance between a line segment and one region.
  794. void DistanceSr(double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax) const;
  795. // Calculate the distance between a line and a region.
  796. void DistanceLr(const HTuple& Row1, const HTuple& Column1, const HTuple& Row2, const HTuple& Column2, HTuple* DistanceMin, HTuple* DistanceMax) const;
  797. // Calculate the distance between a line and a region.
  798. void DistanceLr(double Row1, double Column1, double Row2, double Column2, double* DistanceMin, double* DistanceMax) const;
  799. // Calculate the distance between a point and a region.
  800. void DistancePr(const HTuple& Row, const HTuple& Column, HTuple* DistanceMin, HTuple* DistanceMax) const;
  801. // Calculate the distance between a point and a region.
  802. void DistancePr(double Row, double Column, double* DistanceMin, double* DistanceMax) const;
  803. // Determine the noise distribution of an image.
  804. HTuple NoiseDistributionMean(const HImage& Image, Hlong FilterSize) const;
  805. // Determine the fuzzy entropy of regions.
  806. HTuple FuzzyEntropy(const HImage& Image, Hlong Apar, Hlong Cpar) const;
  807. // Calculate the fuzzy perimeter of a region.
  808. HTuple FuzzyPerimeter(const HImage& Image, Hlong Apar, Hlong Cpar) const;
  809. // Paint regions with their average gray value.
  810. HImage RegionToMean(const HImage& Image) const;
  811. // Close edge gaps using the edge amplitude image.
  812. HRegion CloseEdgesLength(const HImage& Gradient, Hlong MinAmplitude, Hlong MaxGapLength) const;
  813. // Close edge gaps using the edge amplitude image.
  814. HRegion CloseEdges(const HImage& EdgeImage, Hlong MinAmplitude) const;
  815. // Deserialize a serialized region.
  816. void DeserializeRegion(const HSerializedItem& SerializedItemHandle);
  817. // Serialize a region.
  818. HSerializedItem SerializeRegion() const;
  819. // Write regions to a file.
  820. void WriteRegion(const HString& FileName) const;
  821. // Write regions to a file.
  822. void WriteRegion(const char* FileName) const;
  823. #ifdef _WIN32
  824. // Write regions to a file.
  825. void WriteRegion(const wchar_t* FileName) const;
  826. #endif
  827. // Read binary images or HALCON regions.
  828. void ReadRegion(const HString& FileName);
  829. // Read binary images or HALCON regions.
  830. void ReadRegion(const char* FileName);
  831. #ifdef _WIN32
  832. // Read binary images or HALCON regions.
  833. void ReadRegion(const wchar_t* FileName);
  834. #endif
  835. // Geometric moments of regions.
  836. HTuple MomentsRegionCentralInvar(HTuple* PSI2, HTuple* PSI3, HTuple* PSI4) const;
  837. // Geometric moments of regions.
  838. double MomentsRegionCentralInvar(double* PSI2, double* PSI3, double* PSI4) const;
  839. // Geometric moments of regions.
  840. HTuple MomentsRegionCentral(HTuple* I2, HTuple* I3, HTuple* I4) const;
  841. // Geometric moments of regions.
  842. double MomentsRegionCentral(double* I2, double* I3, double* I4) const;
  843. // Geometric moments of regions.
  844. HTuple MomentsRegion3rdInvar(HTuple* M12, HTuple* M03, HTuple* M30) const;
  845. // Geometric moments of regions.
  846. double MomentsRegion3rdInvar(double* M12, double* M03, double* M30) const;
  847. // Geometric moments of regions.
  848. HTuple MomentsRegion3rd(HTuple* M12, HTuple* M03, HTuple* M30) const;
  849. // Geometric moments of regions.
  850. double MomentsRegion3rd(double* M12, double* M03, double* M30) const;
  851. // Smallest surrounding rectangle with any orientation.
  852. void SmallestRectangle2(HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2) const;
  853. // Smallest surrounding rectangle with any orientation.
  854. void SmallestRectangle2(double* Row, double* Column, double* Phi, double* Length1, double* Length2) const;
  855. // Surrounding rectangle parallel to the coordinate axes.
  856. void SmallestRectangle1(HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2) const;
  857. // Surrounding rectangle parallel to the coordinate axes.
  858. void SmallestRectangle1(Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2) const;
  859. // Smallest surrounding circle of a region.
  860. void SmallestCircle(HTuple* Row, HTuple* Column, HTuple* Radius) const;
  861. // Smallest surrounding circle of a region.
  862. void SmallestCircle(double* Row, double* Column, double* Radius) const;
  863. // Choose regions having a certain relation to each other.
  864. HRegion SelectShapeProto(const HRegion& Pattern, const HTuple& Feature, const HTuple& Min, const HTuple& Max) const;
  865. // Choose regions having a certain relation to each other.
  866. HRegion SelectShapeProto(const HRegion& Pattern, const HString& Feature, double Min, double Max) const;
  867. // Choose regions having a certain relation to each other.
  868. HRegion SelectShapeProto(const HRegion& Pattern, const char* Feature, double Min, double Max) const;
  869. #ifdef _WIN32
  870. // Choose regions having a certain relation to each other.
  871. HRegion SelectShapeProto(const HRegion& Pattern, const wchar_t* Feature, double Min, double Max) const;
  872. #endif
  873. // Calculate shape features of regions.
  874. HTuple RegionFeatures(const HTuple& Features) const;
  875. // Calculate shape features of regions.
  876. double RegionFeatures(const HString& Features) const;
  877. // Calculate shape features of regions.
  878. double RegionFeatures(const char* Features) const;
  879. #ifdef _WIN32
  880. // Calculate shape features of regions.
  881. double RegionFeatures(const wchar_t* Features) const;
  882. #endif
  883. // Choose regions with the aid of shape features.
  884. HRegion SelectShape(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const;
  885. // Choose regions with the aid of shape features.
  886. HRegion SelectShape(const HString& Features, const HString& Operation, double Min, double Max) const;
  887. // Choose regions with the aid of shape features.
  888. HRegion SelectShape(const char* Features, const char* Operation, double Min, double Max) const;
  889. #ifdef _WIN32
  890. // Choose regions with the aid of shape features.
  891. HRegion SelectShape(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const;
  892. #endif
  893. // Characteristic values for runlength coding of regions.
  894. HTuple RunlengthFeatures(HTuple* KFactor, HTuple* LFactor, HTuple* MeanLength, HTuple* Bytes) const;
  895. // Characteristic values for runlength coding of regions.
  896. Hlong RunlengthFeatures(double* KFactor, double* LFactor, double* MeanLength, Hlong* Bytes) const;
  897. // Search direct neighbors.
  898. HTuple FindNeighbors(const HRegion& Regions2, Hlong MaxDistance, HTuple* RegionIndex2) const;
  899. // Geometric moments of regions.
  900. HTuple MomentsRegion2ndRelInvar(HTuple* PHI2) const;
  901. // Geometric moments of regions.
  902. double MomentsRegion2ndRelInvar(double* PHI2) const;
  903. // Geometric moments of regions.
  904. HTuple MomentsRegion2ndInvar(HTuple* M20, HTuple* M02) const;
  905. // Geometric moments of regions.
  906. double MomentsRegion2ndInvar(double* M20, double* M02) const;
  907. // Calculate the geometric moments of regions.
  908. HTuple MomentsRegion2nd(HTuple* M20, HTuple* M02, HTuple* Ia, HTuple* Ib) const;
  909. // Calculate the geometric moments of regions.
  910. double MomentsRegion2nd(double* M20, double* M02, double* Ia, double* Ib) const;
  911. // Minimum distance between the contour pixels of two regions each.
  912. HTuple DistanceRrMin(const HRegion& Regions2, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2) const;
  913. // Minimum distance between the contour pixels of two regions each.
  914. double DistanceRrMin(const HRegion& Regions2, Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2) const;
  915. // Minimum distance between two regions with the help of dilation.
  916. HTuple DistanceRrMinDil(const HRegion& Regions2) const;
  917. // Maximal distance between two boundary points of a region.
  918. void DiameterRegion(HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2, HTuple* Diameter) const;
  919. // Maximal distance between two boundary points of a region.
  920. void DiameterRegion(Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2, double* Diameter) const;
  921. // Test if the region contains a given point.
  922. Hlong TestRegionPoint(const HTuple& Row, const HTuple& Column) const;
  923. // Test if the region contains a given point.
  924. Hlong TestRegionPoint(Hlong Row, Hlong Column) const;
  925. // Index of all regions containing a given pixel.
  926. HTuple GetRegionIndex(Hlong Row, Hlong Column) const;
  927. // Choose all regions containing a given pixel.
  928. HRegion SelectRegionPoint(Hlong Row, Hlong Column) const;
  929. // Select regions of a given shape.
  930. HRegion SelectShapeStd(const HString& Shape, double Percent) const;
  931. // Select regions of a given shape.
  932. HRegion SelectShapeStd(const char* Shape, double Percent) const;
  933. #ifdef _WIN32
  934. // Select regions of a given shape.
  935. HRegion SelectShapeStd(const wchar_t* Shape, double Percent) const;
  936. #endif
  937. // Hamming distance between two regions using normalization.
  938. HTuple HammingDistanceNorm(const HRegion& Regions2, const HTuple& Norm, HTuple* Similarity) const;
  939. // Hamming distance between two regions using normalization.
  940. Hlong HammingDistanceNorm(const HRegion& Regions2, const HString& Norm, double* Similarity) const;
  941. // Hamming distance between two regions using normalization.
  942. Hlong HammingDistanceNorm(const HRegion& Regions2, const char* Norm, double* Similarity) const;
  943. #ifdef _WIN32
  944. // Hamming distance between two regions using normalization.
  945. Hlong HammingDistanceNorm(const HRegion& Regions2, const wchar_t* Norm, double* Similarity) const;
  946. #endif
  947. // Hamming distance between two regions.
  948. HTuple HammingDistance(const HRegion& Regions2, HTuple* Similarity) const;
  949. // Hamming distance between two regions.
  950. Hlong HammingDistance(const HRegion& Regions2, double* Similarity) const;
  951. // Shape features derived from the ellipse parameters.
  952. HTuple Eccentricity(HTuple* Bulkiness, HTuple* StructureFactor) const;
  953. // Shape features derived from the ellipse parameters.
  954. double Eccentricity(double* Bulkiness, double* StructureFactor) const;
  955. // Calculate the Euler number.
  956. HTuple EulerNumber() const;
  957. // Orientation of a region.
  958. HTuple OrientationRegion() const;
  959. // Calculate the parameters of the equivalent ellipse.
  960. HTuple EllipticAxis(HTuple* Rb, HTuple* Phi) const;
  961. // Calculate the parameters of the equivalent ellipse.
  962. double EllipticAxis(double* Rb, double* Phi) const;
  963. // Pose relation of regions.
  964. HTuple SelectRegionSpatial(const HRegion& Regions2, const HString& Direction, HTuple* RegionIndex2) const;
  965. // Pose relation of regions.
  966. HTuple SelectRegionSpatial(const HRegion& Regions2, const char* Direction, HTuple* RegionIndex2) const;
  967. #ifdef _WIN32
  968. // Pose relation of regions.
  969. HTuple SelectRegionSpatial(const HRegion& Regions2, const wchar_t* Direction, HTuple* RegionIndex2) const;
  970. #endif
  971. // Pose relation of regions with regard to
  972. HTuple SpatialRelation(const HRegion& Regions2, Hlong Percent, HTuple* RegionIndex2, HTuple* Relation1, HTuple* Relation2) const;
  973. // Shape factor for the convexity of a region.
  974. HTuple Convexity() const;
  975. // Contour length of a region.
  976. HTuple Contlength() const;
  977. // Number of connection components and holes
  978. HTuple ConnectAndHoles(HTuple* NumHoles) const;
  979. // Number of connection components and holes
  980. Hlong ConnectAndHoles(Hlong* NumHoles) const;
  981. // Shape factor for the rectangularity of a region.
  982. HTuple Rectangularity() const;
  983. // Shape factor for the compactness of a region.
  984. HTuple Compactness() const;
  985. // Shape factor for the circularity (similarity to a circle) of a region.
  986. HTuple Circularity() const;
  987. // Compute the area of holes of regions.
  988. HTuple AreaHoles() const;
  989. // Area and center of regions.
  990. HTuple AreaCenter(HTuple* Row, HTuple* Column) const;
  991. // Area and center of regions.
  992. Hlong AreaCenter(double* Row, double* Column) const;
  993. // Distribution of runs needed for runlength encoding of a region.
  994. HTuple RunlengthDistribution(HTuple* Background) const;
  995. // Shape factors from contour.
  996. HTuple Roundness(HTuple* Sigma, HTuple* Roundness, HTuple* Sides) const;
  997. // Shape factors from contour.
  998. double Roundness(double* Sigma, double* Roundness, double* Sides) const;
  999. // Largest inner rectangle of a region.
  1000. void InnerRectangle1(HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2) const;
  1001. // Largest inner rectangle of a region.
  1002. void InnerRectangle1(Hlong* Row1, Hlong* Column1, Hlong* Row2, Hlong* Column2) const;
  1003. // Largest inner circle of a region.
  1004. void InnerCircle(HTuple* Row, HTuple* Column, HTuple* Radius) const;
  1005. // Largest inner circle of a region.
  1006. void InnerCircle(double* Row, double* Column, double* Radius) const;
  1007. // Calculate gray value moments and approximation by a first order surface (plane).
  1008. HTuple FitSurfaceFirstOrder(const HImage& Image, const HString& Algorithm, Hlong Iterations, double ClippingFactor, HTuple* Beta, HTuple* Gamma) const;
  1009. // Calculate gray value moments and approximation by a first order surface (plane).
  1010. double FitSurfaceFirstOrder(const HImage& Image, const HString& Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma) const;
  1011. // Calculate gray value moments and approximation by a first order surface (plane).
  1012. double FitSurfaceFirstOrder(const HImage& Image, const char* Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma) const;
  1013. #ifdef _WIN32
  1014. // Calculate gray value moments and approximation by a first order surface (plane).
  1015. double FitSurfaceFirstOrder(const HImage& Image, const wchar_t* Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma) const;
  1016. #endif
  1017. // Calculate gray value moments and approximation by a second order surface.
  1018. HTuple FitSurfaceSecondOrder(const HImage& Image, const HString& Algorithm, Hlong Iterations, double ClippingFactor, HTuple* Beta, HTuple* Gamma, HTuple* Delta, HTuple* Epsilon, HTuple* Zeta) const;
  1019. // Calculate gray value moments and approximation by a second order surface.
  1020. double FitSurfaceSecondOrder(const HImage& Image, const HString& Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma, double* Delta, double* Epsilon, double* Zeta) const;
  1021. // Calculate gray value moments and approximation by a second order surface.
  1022. double FitSurfaceSecondOrder(const HImage& Image, const char* Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma, double* Delta, double* Epsilon, double* Zeta) const;
  1023. #ifdef _WIN32
  1024. // Calculate gray value moments and approximation by a second order surface.
  1025. double FitSurfaceSecondOrder(const HImage& Image, const wchar_t* Algorithm, Hlong Iterations, double ClippingFactor, double* Beta, double* Gamma, double* Delta, double* Epsilon, double* Zeta) const;
  1026. #endif
  1027. // Determine a histogram of features along all threshold values.
  1028. HTuple ShapeHistoPoint(const HImage& Image, const HString& Feature, Hlong Row, Hlong Column, HTuple* RelativeHisto) const;
  1029. // Determine a histogram of features along all threshold values.
  1030. HTuple ShapeHistoPoint(const HImage& Image, const char* Feature, Hlong Row, Hlong Column, HTuple* RelativeHisto) const;
  1031. #ifdef _WIN32
  1032. // Determine a histogram of features along all threshold values.
  1033. HTuple ShapeHistoPoint(const HImage& Image, const wchar_t* Feature, Hlong Row, Hlong Column, HTuple* RelativeHisto) const;
  1034. #endif
  1035. // Determine a histogram of features along all threshold values.
  1036. HTuple ShapeHistoAll(const HImage& Image, const HString& Feature, HTuple* RelativeHisto) const;
  1037. // Determine a histogram of features along all threshold values.
  1038. HTuple ShapeHistoAll(const HImage& Image, const char* Feature, HTuple* RelativeHisto) const;
  1039. #ifdef _WIN32
  1040. // Determine a histogram of features along all threshold values.
  1041. HTuple ShapeHistoAll(const HImage& Image, const wchar_t* Feature, HTuple* RelativeHisto) const;
  1042. #endif
  1043. // Calculates gray value features for a set of regions.
  1044. HTuple GrayFeatures(const HImage& Image, const HTuple& Features) const;
  1045. // Calculates gray value features for a set of regions.
  1046. double GrayFeatures(const HImage& Image, const HString& Features) const;
  1047. // Calculates gray value features for a set of regions.
  1048. double GrayFeatures(const HImage& Image, const char* Features) const;
  1049. #ifdef _WIN32
  1050. // Calculates gray value features for a set of regions.
  1051. double GrayFeatures(const HImage& Image, const wchar_t* Features) const;
  1052. #endif
  1053. // Select regions based on gray value features.
  1054. HRegion SelectGray(const HImage& Image, const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const;
  1055. // Select regions based on gray value features.
  1056. HRegion SelectGray(const HImage& Image, const HString& Features, const HString& Operation, double Min, double Max) const;
  1057. // Select regions based on gray value features.
  1058. HRegion SelectGray(const HImage& Image, const char* Features, const char* Operation, double Min, double Max) const;
  1059. #ifdef _WIN32
  1060. // Select regions based on gray value features.
  1061. HRegion SelectGray(const HImage& Image, const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const;
  1062. #endif
  1063. // Determine the minimum and maximum gray values within regions.
  1064. void MinMaxGray(const HImage& Image, const HTuple& Percent, HTuple* Min, HTuple* Max, HTuple* Range) const;
  1065. // Determine the minimum and maximum gray values within regions.
  1066. void MinMaxGray(const HImage& Image, double Percent, double* Min, double* Max, double* Range) const;
  1067. // Calculate the mean and deviation of gray values.
  1068. HTuple Intensity(const HImage& Image, HTuple* Deviation) const;
  1069. // Calculate the mean and deviation of gray values.
  1070. double Intensity(const HImage& Image, double* Deviation) const;
  1071. // Calculate the gray value distribution of a single channel image within a certain gray value range.
  1072. HTuple GrayHistoRange(const HImage& Image, const HTuple& Min, const HTuple& Max, Hlong NumBins, double* BinSize) const;
  1073. // Calculate the gray value distribution of a single channel image within a certain gray value range.
  1074. Hlong GrayHistoRange(const HImage& Image, double Min, double Max, Hlong NumBins, double* BinSize) const;
  1075. // Calculate the histogram of two-channel gray value images.
  1076. HImage Histo2dim(const HImage& ImageCol, const HImage& ImageRow) const;
  1077. // Calculate the gray value distribution.
  1078. HTuple GrayHistoAbs(const HImage& Image, const HTuple& Quantization) const;
  1079. // Calculate the gray value distribution.
  1080. HTuple GrayHistoAbs(const HImage& Image, double Quantization) const;
  1081. // Calculate the gray value distribution.
  1082. HTuple GrayHisto(const HImage& Image, HTuple* RelativeHisto) const;
  1083. // Determine the entropy and anisotropy of images.
  1084. HTuple EntropyGray(const HImage& Image, HTuple* Anisotropy) const;
  1085. // Determine the entropy and anisotropy of images.
  1086. double EntropyGray(const HImage& Image, double* Anisotropy) const;
  1087. // Calculate a co-occurrence matrix and derive gray value features thereof.
  1088. HTuple CoocFeatureImage(const HImage& Image, Hlong LdGray, const HTuple& Direction, HTuple* Correlation, HTuple* Homogeneity, HTuple* Contrast) const;
  1089. // Calculate a co-occurrence matrix and derive gray value features thereof.
  1090. double CoocFeatureImage(const HImage& Image, Hlong LdGray, Hlong Direction, double* Correlation, double* Homogeneity, double* Contrast) const;
  1091. // Calculate the co-occurrence matrix of a region in an image.
  1092. HImage GenCoocMatrix(const HImage& Image, Hlong LdGray, Hlong Direction) const;
  1093. // Calculate gray value moments and approximation by a plane.
  1094. void MomentsGrayPlane(const HImage& Image, HTuple* MRow, HTuple* MCol, HTuple* Alpha, HTuple* Beta, HTuple* Mean) const;
  1095. // Calculate gray value moments and approximation by a plane.
  1096. void MomentsGrayPlane(const HImage& Image, double* MRow, double* MCol, double* Alpha, double* Beta, double* Mean) const;
  1097. // Calculate the deviation of the gray values from the approximating image plane.
  1098. HTuple PlaneDeviation(const HImage& Image) const;
  1099. // Compute the orientation and major axes of a region in a gray value image.
  1100. HTuple EllipticAxisGray(const HImage& Image, HTuple* Rb, HTuple* Phi) const;
  1101. // Compute the orientation and major axes of a region in a gray value image.
  1102. double EllipticAxisGray(const HImage& Image, double* Rb, double* Phi) const;
  1103. // Compute the area and center of gravity of a region in a gray value image.
  1104. HTuple AreaCenterGray(const HImage& Image, HTuple* Row, HTuple* Column) const;
  1105. // Compute the area and center of gravity of a region in a gray value image.
  1106. double AreaCenterGray(const HImage& Image, double* Row, double* Column) const;
  1107. // Calculate horizontal and vertical gray-value projections.
  1108. HTuple GrayProjections(const HImage& Image, const HString& Mode, HTuple* VertProjection) const;
  1109. // Calculate horizontal and vertical gray-value projections.
  1110. HTuple GrayProjections(const HImage& Image, const char* Mode, HTuple* VertProjection) const;
  1111. #ifdef _WIN32
  1112. // Calculate horizontal and vertical gray-value projections.
  1113. HTuple GrayProjections(const HImage& Image, const wchar_t* Mode, HTuple* VertProjection) const;
  1114. #endif
  1115. // Asynchronous grab of images and preprocessed image data from the specified image acquisition device.
  1116. HImage GrabDataAsync(HXLDCont* Contours, const HFramegrabber& AcqHandle, double MaxDelay, HTuple* Data);
  1117. // Asynchronous grab of images and preprocessed image data from the specified image acquisition device.
  1118. HImage GrabDataAsync(HXLDCont* Contours, const HFramegrabber& AcqHandle, double MaxDelay, HString* Data);
  1119. // Synchronous grab of images and preprocessed image data from the specified image acquisition device.
  1120. HImage GrabData(HXLDCont* Contours, const HFramegrabber& AcqHandle, HTuple* Data);
  1121. // Synchronous grab of images and preprocessed image data from the specified image acquisition device.
  1122. HImage GrabData(HXLDCont* Contours, const HFramegrabber& AcqHandle, HString* Data);
  1123. // Classify multiple characters with an CNN-based OCR classifier.
  1124. HTuple DoOcrMultiClassCnn(const HImage& Image, const HOCRCnn& OCRHandle, HTuple* Confidence) const;
  1125. // Classify multiple characters with an CNN-based OCR classifier.
  1126. HString DoOcrMultiClassCnn(const HImage& Image, const HOCRCnn& OCRHandle, double* Confidence) const;
  1127. // Classify a single character with an CNN-based OCR classifier.
  1128. HTuple DoOcrSingleClassCnn(const HImage& Image, const HOCRCnn& OCRHandle, const HTuple& Num, HTuple* Confidence) const;
  1129. // Classify a single character with an CNN-based OCR classifier.
  1130. HString DoOcrSingleClassCnn(const HImage& Image, const HOCRCnn& OCRHandle, const HTuple& Num, double* Confidence) const;
  1131. // Classify a related group of characters with an CNN-based OCR classifier.
  1132. HTuple DoOcrWordCnn(const HImage& Image, const HOCRCnn& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, HTuple* Confidence, HString* Word, double* Score) const;
  1133. // Classify a related group of characters with an CNN-based OCR classifier.
  1134. HString DoOcrWordCnn(const HImage& Image, const HOCRCnn& OCRHandle, const HString& Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  1135. // Classify a related group of characters with an CNN-based OCR classifier.
  1136. HString DoOcrWordCnn(const HImage& Image, const HOCRCnn& OCRHandle, const char* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  1137. #ifdef _WIN32
  1138. // Classify a related group of characters with an CNN-based OCR classifier.
  1139. HString DoOcrWordCnn(const HImage& Image, const HOCRCnn& OCRHandle, const wchar_t* Expression, Hlong NumAlternatives, Hlong NumCorrections, double* Confidence, HString* Word, double* Score) const;
  1140. #endif
  1141. // Compute the width, height, and aspect ratio of the surrounding rectangle parallel to the coordinate axes.
  1142. HTuple HeightWidthRatio(HTuple* Width, HTuple* Ratio) const;
  1143. // Compute the width, height, and aspect ratio of the surrounding rectangle parallel to the coordinate axes.
  1144. Hlong HeightWidthRatio(Hlong* Width, double* Ratio) const;
  1145. // Insert objects into an iconic object tuple.
  1146. HRegion InsertObj(const HRegion& ObjectsInsert, Hlong Index) const;
  1147. // Remove objects from an iconic object tuple.
  1148. HRegion RemoveObj(const HTuple& Index) const;
  1149. // Remove objects from an iconic object tuple.
  1150. HRegion RemoveObj(Hlong Index) const;
  1151. // Replaces one or more elements of an iconic object tuple.
  1152. HRegion ReplaceObj(const HRegion& ObjectsReplace, const HTuple& Index) const;
  1153. // Replaces one or more elements of an iconic object tuple.
  1154. HRegion ReplaceObj(const HRegion& ObjectsReplace, Hlong Index) const;
  1155. private:
  1156. // Verify matching semantic type ('region')!
  1157. void AssertObjectClass();
  1158. };
  1159. }
  1160. #endif