HConst.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*****************************************************************************
  2. * HConst.h
  3. *****************************************************************************
  4. *
  5. * Project: HALCON/libhalcon
  6. * Description: Definition of constants
  7. *
  8. * (c) 1996-2020 by MVTec Software GmbH
  9. * www.mvtec.com
  10. *
  11. *****************************************************************************/
  12. #ifndef HCONST_H
  13. #define HCONST_H
  14. /*****************************************************************************/
  15. /*****************************************************************************/
  16. /* General constants for the HALCON library */
  17. /*****************************************************************************/
  18. /*****************************************************************************/
  19. /* Data Base */
  20. #define H_UNDEFINED UNDEF_KEY /* Ctype.h, CORE*.c do not change */
  21. /*****************************************************************************/
  22. /* Max. values for the library */
  23. /*****************************************************************************/
  24. #if !defined(HC_LARGE_IMAGES)
  25. #define LD_MAX_FORMAT 15
  26. #else
  27. #define LD_MAX_FORMAT 30
  28. #endif
  29. #define MAX_FORMAT (1<<LD_MAX_FORMAT)
  30. #define RL_LENGTH 1 /* Only for typedef */
  31. #define DEF_RL_LENGTH 50000 /* initial value for CurrentRL */
  32. #define OBJ_PER_PROC 5000 /* Typical # of objects per param. */
  33. #define FILE_TRANS_SIZE 1024*16 /* max. # of byte per read call */
  34. #define MAX_FILES 20 /* max. # of open files */
  35. #define MAX_EDGE_LENGTH1 101 /* max. filter size */
  36. #define MAX_CLUSTER 1024 /* LearnNDim,ClassNDim */
  37. #define MAX_CONVOL 50000 /* IPConvol.c (> 10000!) */
  38. #define MAX_IMAGE_DIR (16*MAX_STRING) /* length of the image dir */
  39. #define MAX_GRAPHIC_COLOR 64/* max. number of graphics colors in LUT */
  40. #define MAX_COLOR_NAME_LENGTH 40 /* max. length of a color name */
  41. /*****************************************************************************/
  42. /* Environment variables of HALCON */
  43. /*****************************************************************************/
  44. #define HALCONROOT "HALCONROOT" /* Environment variable */
  45. #define HALCONIMAGES "HALCONIMAGES" /* Environment variable */
  46. #define HALCONHELP "HALCONHELP" /* Environment variable */
  47. #define HALCONSPY "HALCONSPY" /* Environment variable */
  48. #define HALCONEXTENSIONS "HALCONEXTENSIONS" /* Environment variable */
  49. #define HALCONEXAMPLES "HALCONEXAMPLES" /* Environment variable */
  50. /*****************************************************************************/
  51. /* Core Interface and operator implementation */
  52. /*****************************************************************************/
  53. #define MAX_INP_OBJ_PAR 9 /* max # input object parameters */
  54. #define MAX_OUTP_OBJ_PAR 9 /* max # output object parameters */
  55. #define MAX_INP_CTRL_PAR 20 /* max # inpput control parameters */
  56. #define MAX_OUTP_CTRL_PAR 20 /* max # output control parameters */
  57. #define MAX_CHAPTER 2 /* max # chapters / operator */
  58. #define MAX_CHAPTER_PROC 300 /* max # operators / chapter */
  59. #define MAX_KEY_NAME 5 /* old */
  60. #define KEY_NAME_LENGTH 20 /* old */
  61. #define MAX_BUFFER 10 /* old */
  62. /* Shortcut for object access */
  63. #define REGION 0 /* object component: region */
  64. #define CHORD 0 /* object component: region (old) */
  65. #define IMAGE1 1 /* object component: 1st image */
  66. #define IMAGE2 2 /* object component: 2nd image */
  67. #define IMAGE3 3 /* object component: 3rd image */
  68. #define IMAGE4 4 /* object component: 4th image */
  69. #define IMAGE5 5 /* object component: 5th image */
  70. #define IMAGE6 6 /* object component: 6th image */
  71. #define IMAGE7 7 /* object component: 7th image */
  72. #define IMAGE8 8 /* object component: 8th image */
  73. #define REGION_ID 1
  74. #define IMAGE_ID 2
  75. #define OBJECT_ID 3
  76. #define TUPLE_ID 4
  77. #define XLD_CONTOUR_ID 5
  78. #define XLD_POLYGON_ID 6
  79. #define XLD_PARALLEL_ID 7
  80. #define XLD_MOD_PARALLEL_ID 8
  81. #define XLD_EXT_PARALLEL_ID 9
  82. #define MIN_XLD_ID XLD_CONTOUR_ID
  83. #define MAX_XLD_ID XLD_EXT_PARALLEL_ID
  84. #define STD_FREE HFree
  85. /*****************************************************************************/
  86. /* File extensions */
  87. /*****************************************************************************/
  88. #define TRAINF_EXT "trf" /* OCR training file */
  89. #define OCR_EXT "fnt" /* OCR */
  90. #define OCR_BOX_EXT "obc" /* OCR box classifier */
  91. #define OCR_MLP_EXT "omc" /* OCR MLP classifier */
  92. #define OCR_SVM_EXT "osc" /* OCR SVM classifier */
  93. #define OCR_KNN_EXT "onc" /* OCR kNN classifier */
  94. #define OCR_KNN_EXT_LEGACY "okc" /* OCR kNN classifier (legacy) */
  95. #define OCR_CNN_EXT "occ" /* OCR CNN classifier */
  96. #define OCV_EXT "ocv" /* OCV */
  97. #define PS_EXTENSION "ps" /* Postscript */
  98. #define TIFF_EXTENSION "tiff" /* TIFF */
  99. #define EXP_EXTENSION "exp" /* Extension image description */
  100. #define IMAGE_EXTENSION "ima" /* Extension HALCON image */
  101. #define REGION_EXTENSION "reg" /* Extension region file */
  102. #define FILTER_EXTENSION "fil" /* Extension convol filters */
  103. #define LUT_EXTENSION "lut" /* Extension LUT */
  104. #define GREYSE_EXT "gse" /* Extension gray struct element */
  105. #define BMP_EXTENSION "bmp" /* Extension Windows-BMP */
  106. #define DEEP_LEARNING_EXTENSION "hdl" /* Extension deep networks */
  107. #define DEEP_OCR_EXT "hdo" /* Extension ocr deep networks */
  108. /*****************************************************************************/
  109. /* Mathematical constants */
  110. /*****************************************************************************/
  111. #ifndef PI
  112. #ifdef M_PI
  113. #define PI M_PI
  114. #else
  115. #define PI 3.14159265358979323846
  116. #endif
  117. #endif
  118. #ifndef PI_2
  119. #define PI_2 (PI / 2.0)
  120. #endif
  121. #ifndef PI_4
  122. #define PI_4 (PI / 4.0)
  123. #endif
  124. /*****************************************************************************/
  125. /* Thread handling */
  126. /*****************************************************************************/
  127. #define GLOBAL_ID NULL /* 'global' operator handle */
  128. #define DEFAULT_AGENTS_NR 4 /* default # for agents */
  129. /* controlling the access to global/local context variables (see HInstance.c)*/
  130. #define GV_WRITE_INFO 0 /* Flag: write global context var.*/
  131. #define GV_READ_INFO 1 /* Flag: read global context var. */
  132. #define GV_INIT_INFO 2 /* Flag: init. global context var.*/
  133. #define GV_GET_ADRESS 3 /* Flag: get address of var. */
  134. #define GV_REALLOC_A 4 /* Flag: realloc an array */
  135. #define GV_LOCK 5 /* Flag: lock a mutex variable */
  136. #define GV_UNLOCK 6 /* Flag: unlock a mutex variable */
  137. #define GV_BOR_INFO 7 /* Flag: bitwise OR with variable */
  138. #define GV_BAND_INFO 8 /* Flag: bitwise AND with variable*/
  139. #define GV_WRITE_REF 9 /* Flag: write in reference var.; */
  140. /* (forces changes in reference version) */
  141. #define GV_READ_REF 10 /* Flag: read from reference var. */
  142. /*****************************************************************************/
  143. /* H_SYS_INFO_READ_ONLY */
  144. /*****************************************************************************/
  145. #define CLOCK_MODE_PROCESSOR_TIME 0 /* clock mode */
  146. #define CLOCK_MODE_ELAPSED_TIME 1
  147. #define CLOCK_MODE_PERFORMANCE_COUNTER 2
  148. #define CLOCK_MODE_MULTIMEDIA_TIMER 3
  149. #define CLOCK_MODE_PROCESS_TIME 4
  150. #define OCR_TRAINFILE_VERSION1_0 1 /* file version when writing OCR */
  151. #define OCR_TRAINFILE_VERSION2_0 2 /* trainf */
  152. #define OCR_TRAINFILE_VERSION3_0 3 /* trainf + UINT2 images */
  153. #define H_ENCODING_NATIVE 1 /* local8bit character encoding */
  154. #define H_ENCODING_UTF8 2 /* UTF-8 character encoding */
  155. #define H_ENCODING_HLIB 3 /* encoding that is used by hlib */
  156. #define H_ENCODING_ASCII 4 /* promise that a passed string is
  157. * pure ASCII */
  158. #define H_ENCODING_SYSTEM 5 /* promise that a passed string is
  159. * in system encoding: which is the
  160. * locale under Linux, utf8 on Mac,
  161. * and for Windows not needed */
  162. #define H_ENCODING_AUTO 6 /* generic mode for detecting the
  163. * encoding automatically */
  164. #define H_ENCODING_LATIN1 7 /* promise that a passed string is
  165. pure latin-1 */
  166. #define TIMER_MODE_ELAPSED_TIME 0
  167. #define TIMER_MODE_MULTIMEDIA_TIMER 1
  168. #define TIMER_MODE_PERFORMANCE_COUNTER 2
  169. #endif