CVUI库与CV2库——设计UI新思路(五)

OpenCV类常数部分改自河许人的CV2类,如果更新内容无法正常调用,请将源码覆盖至CV2.ahk中。图像裁剪部分参考dbgba重写。

***已知局限:打包成exe时需使用AHK_H版编译器。

9.4更新:CV2库新增setBorderless函数用于窗口无边框化,新增大量相关常数。CVUI库优化text显示效果,范例4提供了防止内存泄漏的图像复制写法。修复了一系列问题。

9.3+更新:修复CVUI的一些问题,现在它支持多线程使用。经过优化后,现在用CVUI创建界面占用内存约在10m左右稳定。更新CVUI拖拽截图示例。****紧急修复image函数内存泄漏问题。更新CV2库,现在支持Mat指定ROI替换。****优化Mat指定区域赋值体验,优化CVUIimage函数显示效果。目前问题:加载过大图像将占用较多内存。

9.3更新:修复CV2库一些兼容性问题,完成CVUI交互底层实现。****紧急修复内存泄漏问题。

9.2更新:完善了鼠标互动模块函数,增强了稳定性。新增二维码解码器与SVM相关函数(效率目前来看较低,后续会改进at函数)。实现了纯CV2开发CVUI库,参考:https://github.com/1024210879/cvui

本期压缩包(最新版暂未上传,需要体验的可以粘贴源码。)

cv2 v1.0.5(含CVUI库)

提取码:mono复制
解压码:无

CV2库 v1.0.5源码

  1. ; Author: Mono
  2. ; Version: v1.0.5
  3. ; Time: 2022.09.04
  4. ; 如果出现Not Register报错,单独执行一次
  5. ; DirPath := IniRead("OpenCV.ini", "WorkDir", "Dir")
  6. ; Dllcall("SetDllDirectory", "Str", A_ScriptDir "\" DirPath)
  7. ; DllCall("autoit_opencv_com455.dll\DllInstall", "Int", 1, "WStr", A_IsAdmin = 0 ? "user" : "", "cdecl")
  8. ; Load Dll
  9. DirPath := IniRead("OpenCV.ini", "WorkDir", "Dir")
  10. Dllcall("SetDllDirectory", "Str", A_ScriptDir "\" DirPath)
  11. hOpencv := DllCall("LoadLibrary", "Str", "openworld455.dll", "Ptr")
  12. hOpencvCom := DllCall("LoadLibrary", "Str", "autoit_opencv_com455.dll", "Ptr")
  13. hOpencvffmCom := DllCall("LoadLibrary", "Str", "openvideoio_ffmpeg455_64.dll", "Ptr")
  14. Try
  15. ComObject("OpenCV.CV")
  16. Catch
  17. DllCall("autoit_opencv_com455.dll\DllInstall", "Int", 1, "WStr", A_IsAdmin = 0 ? "user" : "", "cdecl")
  18. Dllcall("SetDllDirectory", "Str", A_ScriptDir)
  19. Class OpenCV
  20. {
  21. Static CV_PI := 3.1415926535897932384626433832795
  22. Static CV_2PI := 6.283185307179586476925286766559
  23. Static LOG2 := 0.69314718055994530941723212145818
  24. Static HAL_ERROR_OK := 0
  25. Static HAL_ERROR_NOT_IMPLEMENTED := 1
  26. Static HAL_ERROR_UNKNOWN := -1
  27. Static CN_MAX := 512
  28. Static CN_SHIFT := 3
  29. Static DEPTH_MAX := 1 << OpenCV.CN_SHIFT
  30. Static CV_8U := 0
  31. Static CV_8S := 1
  32. Static CV_16U := 2
  33. Static CV_16S := 3
  34. Static CV_32S := 4
  35. Static CV_32F := 5
  36. Static CV_64F := 6
  37. Static CV_16F := 7
  38. Static MAT_DEPTH_MASK := OpenCV.DEPTH_MAX - 1
  39. Static CV_8UC1 := OpenCV.MAKETYPE(OpenCV.CV_8U, 1)
  40. Static CV_8UC2 := OpenCV.MAKETYPE(OpenCV.CV_8U, 2)
  41. Static CV_8UC3 := OpenCV.MAKETYPE(OpenCV.CV_8U, 3)
  42. Static CV_8UC4 := OpenCV.MAKETYPE(OpenCV.CV_8U, 4)
  43. Static CV_8SC1 := OpenCV.MAKETYPE(OpenCV.CV_8S, 1)
  44. Static CV_8SC2 := OpenCV.MAKETYPE(OpenCV.CV_8S, 2)
  45. Static CV_8SC3 := OpenCV.MAKETYPE(OpenCV.CV_8S, 3)
  46. Static CV_8SC4 := OpenCV.MAKETYPE(OpenCV.CV_8S, 4)
  47. Static CV_16UC1 := OpenCV.MAKETYPE(OpenCV.CV_16U, 1)
  48. Static CV_16UC2 := OpenCV.MAKETYPE(OpenCV.CV_16U, 2)
  49. Static CV_16UC3 := OpenCV.MAKETYPE(OpenCV.CV_16U, 3)
  50. Static CV_16UC4 := OpenCV.MAKETYPE(OpenCV.CV_16U, 4)
  51. Static CV_16SC1 := OpenCV.MAKETYPE(OpenCV.CV_16S, 1)
  52. Static CV_16SC2 := OpenCV.MAKETYPE(OpenCV.CV_16S, 2)
  53. Static CV_16SC3 := OpenCV.MAKETYPE(OpenCV.CV_16S, 3)
  54. Static CV_16SC4 := OpenCV.MAKETYPE(OpenCV.CV_16S, 4)
  55. Static CV_32SC1 := OpenCV.MAKETYPE(OpenCV.CV_32S, 1)
  56. Static CV_32SC2 := OpenCV.MAKETYPE(OpenCV.CV_32S, 2)
  57. Static CV_32SC3 := OpenCV.MAKETYPE(OpenCV.CV_32S, 3)
  58. Static CV_32SC4 := OpenCV.MAKETYPE(OpenCV.CV_32S, 4)
  59. Static CV_32FC1 := OpenCV.MAKETYPE(OpenCV.CV_32F, 1)
  60. Static CV_32FC2 := OpenCV.MAKETYPE(OpenCV.CV_32F, 2)
  61. Static CV_32FC3 := OpenCV.MAKETYPE(OpenCV.CV_32F, 3)
  62. Static CV_32FC4 := OpenCV.MAKETYPE(OpenCV.CV_32F, 4)
  63. Static CV_64FC1 := OpenCV.MAKETYPE(OpenCV.CV_64F, 1)
  64. Static CV_64FC2 := OpenCV.MAKETYPE(OpenCV.CV_64F, 2)
  65. Static CV_64FC3 := OpenCV.MAKETYPE(OpenCV.CV_64F, 3)
  66. Static CV_64FC4 := OpenCV.MAKETYPE(OpenCV.CV_64F, 4)
  67. Static CV_16FC1 := OpenCV.MAKETYPE(OpenCV.CV_16F, 1)
  68. Static CV_16FC2 := OpenCV.MAKETYPE(OpenCV.CV_16F, 2)
  69. Static CV_16FC3 := OpenCV.MAKETYPE(OpenCV.CV_16F, 3)
  70. Static CV_16FC4 := OpenCV.MAKETYPE(OpenCV.CV_16F, 4)
  71. Static HAL_CMP_EQ := 0
  72. Static HAL_CMP_GT := 1
  73. Static HAL_CMP_GE := 2
  74. Static HAL_CMP_LT := 3
  75. Static HAL_CMP_LE := 4
  76. Static HAL_CMP_NE := 5
  77. Static HAL_BORDER_CONSTANT := 0
  78. Static HAL_BORDER_REPLICATE := 1
  79. Static HAL_BORDER_REFLECT := 2
  80. Static HAL_BORDER_WRAP := 3
  81. Static HAL_BORDER_REFLECT_101 := 4
  82. Static HAL_BORDER_TRANSPARENT := 5
  83. Static HAL_BORDER_ISOLATED := 16
  84. Static HAL_DFT_INVERSE := 1
  85. Static HAL_DFT_SCALE := 2
  86. Static HAL_DFT_ROWS := 4
  87. Static HAL_DFT_COMPLEX_OUTPUT := 16
  88. Static HAL_DFT_REAL_OUTPUT := 32
  89. Static HAL_DFT_TWO_STAGE := 64
  90. Static HAL_DFT_STAGE_COLS := 128
  91. Static HAL_DFT_IS_CONTINUOUS := 512
  92. Static HAL_DFT_IS_INPLACE := 1024
  93. Static HAL_SVD_NO_UV := 1
  94. Static HAL_SVD_SHORT_UV := 2
  95. Static HAL_SVD_MODIFY_A := 4
  96. Static HAL_SVD_FULL_UV := 8
  97. Static HAL_GEMM_1_T := 1
  98. Static HAL_GEMM_2_T := 2
  99. Static HAL_GEMM_3_T := 4
  100. Static MAT_CN_MASK := ((OpenCV.CN_MAX - 1) << OpenCV.CN_SHIFT)
  101. Static MAT_TYPE_MASK := OpenCV.DEPTH_MAX * OpenCV.CN_MAX - 1
  102. Static MAT_CONT_FLAG_SHIFT := 14
  103. Static MAT_CONT_FLAG := (1 << OpenCV.MAT_CONT_FLAG_SHIFT)
  104. Static SUBMAT_FLAG_SHIFT := 15
  105. Static SUBMAT_FLAG := (1 << OpenCV.SUBMAT_FLAG_SHIFT)
  106. Static MAT_DEPTH(flags)
  107. {
  108. Return flags & OpenCV.MAT_DEPTH_MASK
  109. }
  110. Static MAKETYPE(depth, cn)
  111. {
  112. Return OpenCV.MAT_DEPTH(depth) + (((cn)-1) << OpenCV.CN_SHIFT)
  113. }
  114. Static CV_8UC(Number)
  115. {
  116. Return OpenCV.MAKETYPE(OpenCV.CV_8U, Number)
  117. }
  118. Static CV_8SC(Number)
  119. {
  120. Return OpenCV.MAKETYPE(OpenCV.CV_8S, Number)
  121. }
  122. Static CV_16UC(Number)
  123. {
  124. Return OpenCV.MAKETYPE(OpenCV.CV_16U, Number)
  125. }
  126. Static CV_16SC(Number)
  127. {
  128. Return OpenCV.MAKETYPE(OpenCV.CV_16S, Number)
  129. }
  130. Static CV_32SC(Number)
  131. {
  132. Return OpenCV.MAKETYPE(OpenCV.CV_32S, Number)
  133. }
  134. Static CV_32FC(Number)
  135. {
  136. Return OpenCV.MAKETYPE(OpenCV.CV_32F, Number)
  137. }
  138. Static CV_64FC(Number)
  139. {
  140. Return OpenCV.MAKETYPE(OpenCV.CV_64F, Number)
  141. }
  142. Static CV_16FC(Number)
  143. {
  144. Return OpenCV.MAKETYPE(OpenCV.CV_16F, Number)
  145. }
  146. Static MAT_CN(flags)
  147. {
  148. Return ((((flags) & OpenCV.MAT_CN_MASK) >> OpenCV.CN_SHIFT) + 1)
  149. }
  150. Static MAT_TYPE(flags)
  151. {
  152. Return flags & OpenCV.MAT_TYPE_MASK
  153. }
  154. Static IS_MAT_CONT(flags)
  155. {
  156. Return flags & OpenCV.MAT_CONT_FLAG
  157. }
  158. Static IS_SUBMAT(flags)
  159. {
  160. Return flags & OpenCV.SUBMAT_FLAG
  161. }
  162. Static SORT_EVERY_ROW := 0
  163. Static SORT_EVERY_COLUMN := 1
  164. Static SORT_ASCENDING := 0
  165. Static SORT_DESCENDING := 16
  166. ; CovarFlags
  167. Static COVAR_SCRAMBLED := 0
  168. Static COVAR_NORMAL := 1
  169. Static COVAR_USE_AVG := 2
  170. Static COVAR_SCALE := 4
  171. Static COVAR_ROWS := 8
  172. Static COVAR_COLS := 16
  173. ; KmeansFlags
  174. Static KMEANS_RANDOM_CENTERS := 0
  175. Static KMEANS_PP_CENTERS := 2
  176. Static KMEANS_USE_INITIAL_LABELS := 1
  177. ; ReduceTypes
  178. Static REDUCE_SUM := 0
  179. Static REDUCE_AVG := 1
  180. Static REDUCE_MAX := 2
  181. Static REDUCE_MIN := 3
  182. ; RotateFlags
  183. Static ROTATE_90_CLOCKWISE := 0
  184. Static ROTATE_180 := 1
  185. Static ROTATE_90_COUNTERCLOCKWISE := 2
  186. ; Flags
  187. Static PCA_DATA_AS_ROW := 0
  188. Static PCA_DATA_AS_COL := 1
  189. Static PCA_USE_AVG := 2
  190. ; Flags
  191. Static SVD_MODIFY_A := 1
  192. Static SVD_NO_UV := 2
  193. Static SVD_FULL_UV := 4
  194. ; anonymous
  195. Static RNG_UNIFORM := 0
  196. Static RNG_NORMAL := 1
  197. ; FormatType
  198. Static FORMATTER_FMT_DEFAULT := 0
  199. Static FORMATTER_FMT_MATLAB := 1
  200. Static FORMATTER_FMT_CSV := 2
  201. Static FORMATTER_FMT_PYTHON := 3
  202. Static FORMATTER_FMT_NUMPY := 4
  203. Static FORMATTER_FMT_C := 5
  204. ; Param
  205. Static PARAM_INT := 0
  206. Static PARAM_BOOLEAN := 1
  207. Static PARAM_REAL := 2
  208. Static PARAM_STRING := 3
  209. Static PARAM_MAT := 4
  210. Static PARAM_MAT_VECTOR := 5
  211. Static PARAM_ALGORITHM := 6
  212. Static PARAM_FLOAT := 7
  213. Static PARAM_UNSIGNED_INT := 8
  214. Static PARAM_UINT64 := 9
  215. Static PARAM_UCHAR := 11
  216. Static PARAM_SCALAR := 12
  217. ; Code
  218. Static ERROR_StsOk := 0
  219. Static ERROR_StsBackTrace := -1
  220. Static ERROR_StsError := -2
  221. Static ERROR_StsInternal := -3
  222. Static ERROR_StsNoMem := -4
  223. Static ERROR_StsBadArg := -5
  224. Static ERROR_StsBadFunc := -6
  225. Static ERROR_StsNoConv := -7
  226. Static ERROR_StsAutoTrace := -8
  227. Static ERROR_HeaderIsNull := -9
  228. Static ERROR_BadImageSize := -10
  229. Static ERROR_BadOffset := -11
  230. Static ERROR_BadDataPtr := -12
  231. Static ERROR_BadStep := -13
  232. Static ERROR_BadModelOrChSeq := -14
  233. Static ERROR_BadNumChannels := -15
  234. Static ERROR_BadNumChannel1U := -16
  235. Static ERROR_BadDepth := -17
  236. Static ERROR_BadAlphaChannel := -18
  237. Static ERROR_BadOrder := -19
  238. Static ERROR_BadOrigin := -20
  239. Static ERROR_BadAlign := -21
  240. Static ERROR_BadCallBack := -22
  241. Static ERROR_BadTileSize := -23
  242. Static ERROR_BadCOI := -24
  243. Static ERROR_BadROISize := -25
  244. Static ERROR_MaskIsTiled := -26
  245. Static ERROR_StsNullPtr := -27
  246. Static ERROR_StsVecLengthErr := -28
  247. Static ERROR_StsFilterStructContentErr := -29
  248. Static ERROR_StsKernelStructContentErr := -30
  249. Static ERROR_StsFilterOffsetErr := -31
  250. Static ERROR_StsBadSize := -201
  251. Static ERROR_StsDivByZero := -202
  252. Static ERROR_StsInplaceNotSupported := -203
  253. Static ERROR_StsObjectNotFound := -204
  254. Static ERROR_StsUnmatchedFormats := -205
  255. Static ERROR_StsBadFlag := -206
  256. Static ERROR_StsBadPoint := -207
  257. Static ERROR_StsBadMask := -208
  258. Static ERROR_StsUnmatchedSizes := -209
  259. Static ERROR_StsUnsupportedFormat := -210
  260. Static ERROR_StsOutOfRange := -211
  261. Static ERROR_StsParseError := -212
  262. Static ERROR_StsNotImplemented := -213
  263. Static ERROR_StsBadMemBlock := -214
  264. Static ERROR_StsAssert := -215
  265. Static ERROR_GpuNotSupported := -216
  266. Static ERROR_GpuApiCallError := -217
  267. Static ERROR_OpenGlNotSupported := -218
  268. Static ERROR_OpenGlApiCallError := -219
  269. Static ERROR_OpenCLApiCallError := -220
  270. Static ERROR_OpenCLDoubleNotSupported := -221
  271. Static ERROR_OpenCLInitError := -222
  272. Static ERROR_OpenCLNoAMDBlasFft := -223
  273. ; DecompTypes
  274. Static DECOMP_LU := 0
  275. Static DECOMP_SVD := 1
  276. Static DECOMP_EIG := 2
  277. Static DECOMP_CHOLESKY := 3
  278. Static DECOMP_QR := 4
  279. Static DECOMP_NORMAL := 16
  280. ; NormTypes
  281. Static NORM_INF := 1
  282. Static NORM_L1 := 2
  283. Static NORM_L2 := 4
  284. Static NORM_L2SQR := 5
  285. Static NORM_HAMMING := 6
  286. Static NORM_HAMMING2 := 7
  287. Static NORM_TYPE_MASK := 7
  288. Static NORM_RELATIVE := 8
  289. Static NORM_MINMAX := 32
  290. ; CmpTypes
  291. Static CMP_EQ := 0
  292. Static CMP_GT := 1
  293. Static CMP_GE := 2
  294. Static CMP_LT := 3
  295. Static CMP_LE := 4
  296. Static CMP_NE := 5
  297. ; GemmFlags
  298. Static GEMM_1_T := 1
  299. Static GEMM_2_T := 2
  300. Static GEMM_3_T := 4
  301. ; DftFlags
  302. Static DFT_INVERSE := 1
  303. Static DFT_SCALE := 2
  304. Static DFT_ROWS := 4
  305. Static DFT_COMPLEX_OUTPUT := 16
  306. Static DFT_REAL_OUTPUT := 32
  307. Static DFT_COMPLEX_INPUT := 64
  308. Static DCT_INVERSE := OpenCV.DFT_INVERSE
  309. Static DCT_ROWS := OpenCV.DFT_ROWS
  310. ; BorderTypes
  311. Static BORDER_CONSTANT := 0
  312. Static BORDER_REPLICATE := 1
  313. Static BORDER_REFLECT := 2
  314. Static BORDER_WRAP := 3
  315. Static BORDER_REFLECT_101 := 4
  316. Static BORDER_TRANSPARENT := 5
  317. Static BORDER_REFLECT101 := OpenCV.BORDER_REFLECT_101
  318. Static BORDER_DEFAULT := OpenCV.BORDER_REFLECT_101
  319. Static BORDER_ISOLATED := 16
  320. ; TestOp
  321. Static DETAIL_TEST_CUSTOM := 0
  322. Static DETAIL_TEST_EQ := 1
  323. Static DETAIL_TEST_NE := 2
  324. Static DETAIL_TEST_LE := 3
  325. Static DETAIL_TEST_LT := 4
  326. Static DETAIL_TEST_GE := 5
  327. Static DETAIL_TEST_GT := 6
  328. ; AllocType
  329. Static CUDA_HOST_MEM_PAGE_LOCKED := 1
  330. Static CUDA_HOST_MEM_SHARED := 2
  331. Static CUDA_HOST_MEM_WRITE_COMBINED := 4
  332. ; CreateFlags
  333. Static CUDA_EVENT_DEFAULT := 0x00
  334. Static CUDA_EVENT_BLOCKING_SYNC := 0x01
  335. Static CUDA_EVENT_DISABLE_TIMING := 0x02
  336. Static CUDA_EVENT_INTERPROCESS := 0x04
  337. ; FeatureSet
  338. Static CUDA_FEATURE_SET_COMPUTE_10 := 10
  339. Static CUDA_FEATURE_SET_COMPUTE_11 := 11
  340. Static CUDA_FEATURE_SET_COMPUTE_12 := 12
  341. Static CUDA_FEATURE_SET_COMPUTE_13 := 13
  342. Static CUDA_FEATURE_SET_COMPUTE_20 := 20
  343. Static CUDA_FEATURE_SET_COMPUTE_21 := 21
  344. Static CUDA_FEATURE_SET_COMPUTE_30 := 30
  345. Static CUDA_FEATURE_SET_COMPUTE_32 := 32
  346. Static CUDA_FEATURE_SET_COMPUTE_35 := 35
  347. Static CUDA_FEATURE_SET_COMPUTE_50 := 50
  348. Static CUDA_GLOBAL_ATOMICS := OpenCV.CUDA_FEATURE_SET_COMPUTE_11
  349. Static CUDA_SHARED_ATOMICS := OpenCV.CUDA_FEATURE_SET_COMPUTE_12
  350. Static CUDA_NATIVE_DOUBLE := OpenCV.CUDA_FEATURE_SET_COMPUTE_13
  351. Static CUDA_WARP_SHUFFLE_FUNCTIONS := OpenCV.CUDA_FEATURE_SET_COMPUTE_30
  352. Static CUDA_DYNAMIC_PARALLELISM := OpenCV.CUDA_FEATURE_SET_COMPUTE_35
  353. ; ComputeMode
  354. Static CUDA_DEVICE_INFO_ComputeModeDefault := 0
  355. Static CUDA_DEVICE_INFO_ComputeModeExclusive := 1
  356. Static CUDA_DEVICE_INFO_ComputeModeProhibited := 2
  357. Static CUDA_DEVICE_INFO_ComputeModeExclusiveProcess := 3
  358. ; AccessFlag
  359. Static ACCESS_READ := BitShift(1, -24)
  360. Static ACCESS_WRITE := BitShift(1, -25)
  361. Static ACCESS_RW := BitShift(3, -24)
  362. Static ACCESS_MASK := OpenCV.ACCESS_RW
  363. Static ACCESS_FAST := BitShift(1, -26)
  364. ; KindFlag
  365. Static _INPUT_ARRAY_KIND_SHIFT := 16
  366. Static _INPUT_ARRAY_FIXED_TYPE := BitShift(0x8000, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  367. Static _INPUT_ARRAY_FIXED_SIZE := BitShift(0x4000, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  368. Static _INPUT_ARRAY_KIND_MASK := BitShift(31, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  369. Static _INPUT_ARRAY_NONE := BitShift(0, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  370. Static _INPUT_ARRAY_MAT := BitShift(1, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  371. Static _INPUT_ARRAY_MATX := BitShift(2, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  372. Static _INPUT_ARRAY_STD_VECTOR := BitShift(3, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  373. Static _INPUT_ARRAY_STD_VECTOR_VECTOR := BitShift(4, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  374. Static _INPUT_ARRAY_STD_VECTOR_MAT := BitShift(5, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  375. Static _INPUT_ARRAY_EXPR := BitShift(6, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  376. Static _INPUT_ARRAY_OPENGL_BUFFER := BitShift(7, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  377. Static _INPUT_ARRAY_CUDA_HOST_MEM := BitShift(8, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  378. Static _INPUT_ARRAY_CUDA_GPU_MAT := BitShift(9, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  379. Static _INPUT_ARRAY_UMAT := BitShift(10, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  380. Static _INPUT_ARRAY_STD_VECTOR_UMAT := BitShift(11, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  381. Static _INPUT_ARRAY_STD_BOOL_VECTOR := BitShift(12, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  382. Static _INPUT_ARRAY_STD_VECTOR_CUDA_GPU_MAT := BitShift(13, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  383. Static _INPUT_ARRAY_STD_ARRAY := BitShift(14, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  384. Static _INPUT_ARRAY_STD_ARRAY_MAT := BitShift(15, -OpenCV._INPUT_ARRAY_KIND_SHIFT)
  385. ; DepthMask
  386. Static _OUTPUT_ARRAY_DEPTH_MASK_8U := BitShift(1, -OpenCV.CV_8U)
  387. Static _OUTPUT_ARRAY_DEPTH_MASK_8S := BitShift(1, -OpenCV.CV_8S)
  388. Static _OUTPUT_ARRAY_DEPTH_MASK_16U := BitShift(1, -OpenCV.CV_16U)
  389. Static _OUTPUT_ARRAY_DEPTH_MASK_16S := BitShift(1, -OpenCV.CV_16S)
  390. Static _OUTPUT_ARRAY_DEPTH_MASK_32S := BitShift(1, -OpenCV.CV_32S)
  391. Static _OUTPUT_ARRAY_DEPTH_MASK_32F := BitShift(1, -OpenCV.CV_32F)
  392. Static _OUTPUT_ARRAY_DEPTH_MASK_64F := BitShift(1, -OpenCV.CV_64F)
  393. Static _OUTPUT_ARRAY_DEPTH_MASK_16F := BitShift(1, -OpenCV.CV_16F)
  394. Static _OUTPUT_ARRAY_DEPTH_MASK_ALL := (BitShift(OpenCV._OUTPUT_ARRAY_DEPTH_MASK_64F, -1)) - 1
  395. Static _OUTPUT_ARRAY_DEPTH_MASK_ALL_BUT_8S := BitAND(OpenCV._OUTPUT_ARRAY_DEPTH_MASK_ALL, BitNOT(OpenCV._OUTPUT_ARRAY_DEPTH_MASK_8S))
  396. Static _OUTPUT_ARRAY_DEPTH_MASK_ALL_16F := (BitShift(OpenCV._OUTPUT_ARRAY_DEPTH_MASK_16F, -1)) - 1
  397. Static _OUTPUT_ARRAY_DEPTH_MASK_FLT := OpenCV._OUTPUT_ARRAY_DEPTH_MASK_32F + OpenCV._OUTPUT_ARRAY_DEPTH_MASK_64F
  398. ; UMatUsageFlags
  399. Static USAGE_DEFAULT := 0
  400. Static USAGE_ALLOCATE_HOST_MEMORY := BitShift(1, -0)
  401. Static USAGE_ALLOCATE_DEVICE_MEMORY := BitShift(1, -1)
  402. Static USAGE_ALLOCATE_SHARED_MEMORY := BitShift(1, -2)
  403. Static __UMAT_USAGE_FLAGS_32BIT := 0x7fffffff
  404. ; MemoryFlag
  405. Static UMAT_DATA_COPY_ON_MAP := 1
  406. Static UMAT_DATA_HOST_COPY_OBSOLETE := 2
  407. Static UMAT_DATA_DEVICE_COPY_OBSOLETE := 4
  408. Static UMAT_DATA_TEMP_UMAT := 8
  409. Static UMAT_DATA_TEMP_COPIED_UMAT := 24
  410. Static UMAT_DATA_USER_ALLOCATED := 32
  411. Static UMAT_DATA_DEVICE_MEM_MAPPED := 64
  412. Static UMAT_DATA_ASYNC_CLEANUP := 128
  413. ; anonymous
  414. Static MAT_MAGIC_VAL := 0x42FF0000
  415. Static MAT_AUTO_STEP := 0
  416. Static MAT_CONTINUOUS_FLAG := OpenCV.MAT_CONT_FLAG
  417. Static MAT_SUBMATRIX_FLAG := OpenCV.SUBMAT_FLAG
  418. Static MAT_MAGIC_MASK := 0xFFFF0000
  419. ; anonymous
  420. Static UMAT_MAGIC_VAL := 0x42FF0000
  421. Static UMAT_AUTO_STEP := 0
  422. Static UMAT_CONTINUOUS_FLAG := OpenCV.MAT_CONT_FLAG
  423. Static UMAT_SUBMATRIX_FLAG := OpenCV.SUBMAT_FLAG
  424. Static UMAT_MAGIC_MASK := 0xFFFF0000
  425. Static UMAT_TYPE_MASK := 0x00000FFF
  426. Static UMAT_DEPTH_MASK := 7
  427. ; anonymous
  428. Static SPARSE_MAT_MAGIC_VAL := 0x42FD0000
  429. Static SPARSE_MAT_MAX_DIM := 32
  430. Static SPARSE_MAT_HASH_SCALE := 0x5bd1e995
  431. Static SPARSE_MAT_HASH_BIT := 0x80000000
  432. ; anonymous
  433. Static OCL_DEVICE_TYPE_DEFAULT := (BitShift(1, -0))
  434. Static OCL_DEVICE_TYPE_CPU := (BitShift(1, -1))
  435. Static OCL_DEVICE_TYPE_GPU := (BitShift(1, -2))
  436. Static OCL_DEVICE_TYPE_ACCELERATOR := (BitShift(1, -3))
  437. Static OCL_DEVICE_TYPE_DGPU := OpenCV.OCL_DEVICE_TYPE_GPU + (BitShift(1, -16))
  438. Static OCL_DEVICE_TYPE_IGPU := OpenCV.OCL_DEVICE_TYPE_GPU + (BitShift(1, -17))
  439. Static OCL_DEVICE_TYPE_ALL := 0xFFFFFFFF
  440. Static OCL_DEVICE_FP_DENORM := (BitShift(1, -0))
  441. Static OCL_DEVICE_FP_INF_NAN := (BitShift(1, -1))
  442. Static OCL_DEVICE_FP_ROUND_TO_NEAREST := (BitShift(1, -2))
  443. Static OCL_DEVICE_FP_ROUND_TO_ZERO := (BitShift(1, -3))
  444. Static OCL_DEVICE_FP_ROUND_TO_INF := (BitShift(1, -4))
  445. Static OCL_DEVICE_FP_FMA := (BitShift(1, -5))
  446. Static OCL_DEVICE_FP_SOFT_FLOAT := (BitShift(1, -6))
  447. Static OCL_DEVICE_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT := (BitShift(1, -7))
  448. Static OCL_DEVICE_EXEC_KERNEL := (BitShift(1, -0))
  449. Static OCL_DEVICE_EXEC_NATIVE_KERNEL := (BitShift(1, -1))
  450. Static OCL_DEVICE_NO_CACHE := 0
  451. Static OCL_DEVICE_READ_ONLY_CACHE := 1
  452. Static OCL_DEVICE_READ_WRITE_CACHE := 2
  453. Static OCL_DEVICE_NO_LOCAL_MEM := 0
  454. Static OCL_DEVICE_LOCAL_IS_LOCAL := 1
  455. Static OCL_DEVICE_LOCAL_IS_GLOBAL := 2
  456. Static OCL_DEVICE_UNKNOWN_VENDOR := 0
  457. Static OCL_DEVICE_VENDOR_AMD := 1
  458. Static OCL_DEVICE_VENDOR_INTEL := 2
  459. Static OCL_DEVICE_VENDOR_NVIDIA := 3
  460. ; anonymous
  461. Static OCL_KERNEL_ARG_LOCAL := 1
  462. Static OCL_KERNEL_ARG_READ_ONLY := 2
  463. Static OCL_KERNEL_ARG_WRITE_ONLY := 4
  464. Static OCL_KERNEL_ARG_READ_WRITE := 6
  465. Static OCL_KERNEL_ARG_CONSTANT := 8
  466. Static OCL_KERNEL_ARG_PTR_ONLY := 16
  467. Static OCL_KERNEL_ARG_NO_SIZE := 256
  468. ; OclVectorStrategy
  469. Static OCL_OCL_VECTOR_OWN := 0
  470. Static OCL_OCL_VECTOR_MAX := 1
  471. Static OCL_OCL_VECTOR_DEFAULT := OpenCV.OCL_OCL_VECTOR_OWN
  472. ; Target
  473. Static OGL_BUFFER_ARRAY_BUFFER := 0x8892
  474. Static OGL_BUFFER_ELEMENT_ARRAY_BUFFER := 0x8893
  475. Static OGL_BUFFER_PIXEL_PACK_BUFFER := 0x88EB
  476. Static OGL_BUFFER_PIXEL_UNPACK_BUFFER := 0x88EC
  477. ; Access
  478. Static OGL_BUFFER_READ_ONLY := 0x88B8
  479. Static OGL_BUFFER_WRITE_ONLY := 0x88B9
  480. Static OGL_BUFFER_READ_WRITE := 0x88BA
  481. ; Format
  482. Static OGL_TEXTURE2D_NONE := 0
  483. Static OGL_TEXTURE2D_DEPTH_COMPONENT := 0x1902
  484. Static OGL_TEXTURE2D_RGB := 0x1907
  485. Static OGL_TEXTURE2D_RGBA := 0x1908
  486. ; RenderModes
  487. Static OGL_POINTS := 0x0000
  488. Static OGL_LINES := 0x0001
  489. Static OGL_LINE_LOOP := 0x0002
  490. Static OGL_LINE_STRIP := 0x0003
  491. Static OGL_TRIANGLES := 0x0004
  492. Static OGL_TRIANGLE_STRIP := 0x0005
  493. Static OGL_TRIANGLE_FAN := 0x0006
  494. Static OGL_QUADS := 0x0007
  495. Static OGL_QUAD_STRIP := 0x0008
  496. Static OGL_POLYGON := 0x0009
  497. ; SolveLPResult
  498. Static SOLVELP_UNBOUNDED := -2
  499. Static SOLVELP_UNFEASIBLE := -1
  500. Static SOLVELP_SINGLE := 0
  501. Static SOLVELP_MULTI := 1
  502. ; Mode
  503. Static FILE_STORAGE_READ := 0
  504. Static FILE_STORAGE_WRITE := 1
  505. Static FILE_STORAGE_APPEND := 2
  506. Static FILE_STORAGE_MEMORY := 4
  507. Static FILE_STORAGE_FORMAT_MASK := (BitShift(7, -3))
  508. Static FILE_STORAGE_FORMAT_AUTO := 0
  509. Static FILE_STORAGE_FORMAT_XML := (BitShift(1, -3))
  510. Static FILE_STORAGE_FORMAT_YAML := (BitShift(2, -3))
  511. Static FILE_STORAGE_FORMAT_JSON := (BitShift(3, -3))
  512. Static FILE_STORAGE_BASE64 := 64
  513. Static FILE_STORAGE_WRITE_BASE64 := BitOR(OpenCV.FILE_STORAGE_BASE64, OpenCV.FILE_STORAGE_WRITE)
  514. ; State
  515. Static FILE_STORAGE_UNDEFINED := 0
  516. Static FILE_STORAGE_VALUE_EXPECTED := 1
  517. Static FILE_STORAGE_NAME_EXPECTED := 2
  518. Static FILE_STORAGE_INSIDE_MAP := 4
  519. ; anonymous
  520. Static FILE_NODE_NONE := 0
  521. Static FILE_NODE_INT := 1
  522. Static FILE_NODE_REAL := 2
  523. Static FILE_NODE_FLOAT := OpenCV.FILE_NODE_REAL
  524. Static FILE_NODE_STR := 3
  525. Static FILE_NODE_STRING := OpenCV.FILE_NODE_STR
  526. Static FILE_NODE_SEQ := 4
  527. Static FILE_NODE_MAP := 5
  528. Static FILE_NODE_TYPE_MASK := 7
  529. Static FILE_NODE_FLOW := 8
  530. Static FILE_NODE_UNIFORM := 8
  531. Static FILE_NODE_EMPTY := 16
  532. Static FILE_NODE_NAMED := 32
  533. ; QuatAssumeType
  534. Static QUAT_ASSUME_NOT_UNIT := 0
  535. Static QUAT_ASSUME_UNIT := 1
  536. ; EulerAnglesType
  537. Static QUAT_ENUM_INT_XYZ := 0
  538. Static QUAT_ENUM_INT_XZY := 1
  539. Static QUAT_ENUM_INT_YXZ := 2
  540. Static QUAT_ENUM_INT_YZX := 3
  541. Static QUAT_ENUM_INT_ZXY := 4
  542. Static QUAT_ENUM_INT_ZYX := 5
  543. Static QUAT_ENUM_INT_XYX := 6
  544. Static QUAT_ENUM_INT_XZX := 7
  545. Static QUAT_ENUM_INT_YXY := 8
  546. Static QUAT_ENUM_INT_YZY := 9
  547. Static QUAT_ENUM_INT_ZXZ := 10
  548. Static QUAT_ENUM_INT_ZYZ := 11
  549. Static QUAT_ENUM_EXT_XYZ := 12
  550. Static QUAT_ENUM_EXT_XZY := 13
  551. Static QUAT_ENUM_EXT_YXZ := 14
  552. Static QUAT_ENUM_EXT_YZX := 15
  553. Static QUAT_ENUM_EXT_ZXY := 16
  554. Static QUAT_ENUM_EXT_ZYX := 17
  555. Static QUAT_ENUM_EXT_XYX := 18
  556. Static QUAT_ENUM_EXT_XZX := 19
  557. Static QUAT_ENUM_EXT_YXY := 20
  558. Static QUAT_ENUM_EXT_YZY := 21
  559. Static QUAT_ENUM_EXT_ZXZ := 22
  560. Static QUAT_ENUM_EXT_ZYZ := 23
  561. Static QUAT_ENUM_EULER_ANGLES_MAX_VALUE := 24
  562. ; Type
  563. Static TERM_CRITERIA_COUNT := 1
  564. Static TERM_CRITERIA_MAX_ITER := OpenCV.TERM_CRITERIA_COUNT
  565. Static TERM_CRITERIA_EPS := 2
  566. ; FlannIndexType
  567. Static FLANN_FLANN_INDEX_TYPE_8U := OpenCV.CV_8U
  568. Static FLANN_FLANN_INDEX_TYPE_8S := OpenCV.CV_8S
  569. Static FLANN_FLANN_INDEX_TYPE_16U := OpenCV.CV_16U
  570. Static FLANN_FLANN_INDEX_TYPE_16S := OpenCV.CV_16S
  571. Static FLANN_FLANN_INDEX_TYPE_32S := OpenCV.CV_32S
  572. Static FLANN_FLANN_INDEX_TYPE_32F := OpenCV.CV_32F
  573. Static FLANN_FLANN_INDEX_TYPE_64F := OpenCV.CV_64F
  574. Static FLANN_FLANN_INDEX_TYPE_STRING := OpenCV.CV_64F + 1
  575. Static FLANN_FLANN_INDEX_TYPE_BOOL := OpenCV.CV_64F + 2
  576. Static FLANN_FLANN_INDEX_TYPE_ALGORITHM := OpenCV.CV_64F + 3
  577. Static FLANN_LAST_VALUE_FLANN_INDEX_TYPE := OpenCV.FLANN_FLANN_INDEX_TYPE_ALGORITHM
  578. ; SpecialFilter
  579. Static FILTER_SCHARR := -1
  580. ; MorphTypes
  581. Static MORPH_ERODE := 0
  582. Static MORPH_DILATE := 1
  583. Static MORPH_OPEN := 2
  584. Static MORPH_CLOSE := 3
  585. Static MORPH_GRADIENT := 4
  586. Static MORPH_TOPHAT := 5
  587. Static MORPH_BLACKHAT := 6
  588. Static MORPH_HITMISS := 7
  589. ; MorphShapes
  590. Static MORPH_RECT := 0
  591. Static MORPH_CROSS := 1
  592. Static MORPH_ELLIPSE := 2
  593. ; InterpolationFlags
  594. Static INTER_NEAREST := 0
  595. Static INTER_LINEAR := 1
  596. Static INTER_CUBIC := 2
  597. Static INTER_AREA := 3
  598. Static INTER_LANCZOS4 := 4
  599. Static INTER_LINEAR_EXACT := 5
  600. Static INTER_NEAREST_EXACT := 6
  601. Static INTER_MAX := 7
  602. Static WARP_FILL_OUTLIERS := 8
  603. Static WARP_INVERSE_MAP := 16
  604. ; WarpPolarMode
  605. Static WARP_POLAR_LINEAR := 0
  606. Static WARP_POLAR_LOG := 256
  607. ; InterpolationMasks
  608. Static INTER_BITS := 5
  609. Static INTER_BITS2 := OpenCV.INTER_BITS * 2
  610. Static INTER_TAB_SIZE := BitShift(1, -OpenCV.INTER_BITS)
  611. Static INTER_TAB_SIZE2 := OpenCV.INTER_TAB_SIZE * OpenCV.INTER_TAB_SIZE
  612. ; DistanceTypes
  613. Static DIST_USER := -1
  614. Static DIST_L1 := 1
  615. Static DIST_L2 := 2
  616. Static DIST_C := 3
  617. Static DIST_L12 := 4
  618. Static DIST_FAIR := 5
  619. Static DIST_WELSCH := 6
  620. Static DIST_HUBER := 7
  621. ; DistanceTransformMasks
  622. Static DIST_MASK_3 := 3
  623. Static DIST_MASK_5 := 5
  624. Static DIST_MASK_PRECISE := 0
  625. ; ThresholdTypes
  626. Static THRESH_BINARY := 0
  627. Static THRESH_BINARY_INV := 1
  628. Static THRESH_TRUNC := 2
  629. Static THRESH_TOZERO := 3
  630. Static THRESH_TOZERO_INV := 4
  631. Static THRESH_MASK := 7
  632. Static THRESH_OTSU := 8
  633. Static THRESH_TRIANGLE := 16
  634. ; AdaptiveThresholdTypes
  635. Static ADAPTIVE_THRESH_MEAN_C := 0
  636. Static ADAPTIVE_THRESH_GAUSSIAN_C := 1
  637. ; GrabCutClasses
  638. Static GC_BGD := 0
  639. Static GC_FGD := 1
  640. Static GC_PR_BGD := 2
  641. Static GC_PR_FGD := 3
  642. ; GrabCutModes
  643. Static GC_INIT_WITH_RECT := 0
  644. Static GC_INIT_WITH_MASK := 1
  645. Static GC_EVAL := 2
  646. Static GC_EVAL_FREEZE_MODEL := 3
  647. ; DistanceTransformLabelTypes
  648. Static DIST_LABEL_CCOMP := 0
  649. Static DIST_LABEL_PIXEL := 1
  650. ; FloodFillFlags
  651. Static FLOODFILL_FIXED_RANGE := BitShift(1, -16)
  652. Static FLOODFILL_MASK_ONLY := BitShift(1, -17)
  653. ; ConnectedComponentsTypes
  654. Static CC_STAT_LEFT := 0
  655. Static CC_STAT_TOP := 1
  656. Static CC_STAT_WIDTH := 2
  657. Static CC_STAT_HEIGHT := 3
  658. Static CC_STAT_AREA := 4
  659. Static CC_STAT_MAX := 5
  660. ; ConnectedComponentsAlgorithmsTypes
  661. Static CCL_DEFAULT := -1
  662. Static CCL_WU := 0
  663. Static CCL_GRANA := 1
  664. Static CCL_BOLELLI := 2
  665. Static CCL_SAUF := 3
  666. Static CCL_BBDT := 4
  667. Static CCL_SPAGHETTI := 5
  668. ; RetrievalModes
  669. Static RETR_EXTERNAL := 0
  670. Static RETR_LIST := 1
  671. Static RETR_CCOMP := 2
  672. Static RETR_TREE := 3
  673. Static RETR_FLOODFILL := 4
  674. ; ContourApproximationModes
  675. Static CHAIN_APPROX_NONE := 1
  676. Static CHAIN_APPROX_SIMPLE := 2
  677. Static CHAIN_APPROX_TC89_L1 := 3
  678. Static CHAIN_APPROX_TC89_KCOS := 4
  679. ; ShapeMatchModes
  680. Static CONTOURS_MATCH_I1 := 1
  681. Static CONTOURS_MATCH_I2 := 2
  682. Static CONTOURS_MATCH_I3 := 3
  683. ; HoughModes
  684. Static HOUGH_STANDARD := 0
  685. Static HOUGH_PROBABILISTIC := 1
  686. Static HOUGH_MULTI_SCALE := 2
  687. Static HOUGH_GRADIENT := 3
  688. Static HOUGH_GRADIENT_ALT := 4
  689. ; LineSegmentDetectorModes
  690. Static LSD_REFINE_NONE := 0
  691. Static LSD_REFINE_STD := 1
  692. Static LSD_REFINE_ADV := 2
  693. ; HistCompMethods
  694. Static HISTCMP_CORREL := 0
  695. Static HISTCMP_CHISQR := 1
  696. Static HISTCMP_INTERSECT := 2
  697. Static HISTCMP_BHATTACHARYYA := 3
  698. Static HISTCMP_HELLINGER := OpenCV.HISTCMP_BHATTACHARYYA
  699. Static HISTCMP_CHISQR_ALT := 4
  700. Static HISTCMP_KL_DIV := 5
  701. ; ColorConversionCodes
  702. Static COLOR_BGR2BGRA := 0
  703. Static COLOR_RGB2RGBA := OpenCV.COLOR_BGR2BGRA
  704. Static COLOR_BGRA2BGR := 1
  705. Static COLOR_RGBA2RGB := OpenCV.COLOR_BGRA2BGR
  706. Static COLOR_BGR2RGBA := 2
  707. Static COLOR_RGB2BGRA := OpenCV.COLOR_BGR2RGBA
  708. Static COLOR_RGBA2BGR := 3
  709. Static COLOR_BGRA2RGB := OpenCV.COLOR_RGBA2BGR
  710. Static COLOR_BGR2RGB := 4
  711. Static COLOR_RGB2BGR := OpenCV.COLOR_BGR2RGB
  712. Static COLOR_BGRA2RGBA := 5
  713. Static COLOR_RGBA2BGRA := OpenCV.COLOR_BGRA2RGBA
  714. Static COLOR_BGR2GRAY := 6
  715. Static COLOR_RGB2GRAY := 7
  716. Static COLOR_GRAY2BGR := 8
  717. Static COLOR_GRAY2RGB := OpenCV.COLOR_GRAY2BGR
  718. Static COLOR_GRAY2BGRA := 9
  719. Static COLOR_GRAY2RGBA := OpenCV.COLOR_GRAY2BGRA
  720. Static COLOR_BGRA2GRAY := 10
  721. Static COLOR_RGBA2GRAY := 11
  722. Static COLOR_BGR2BGR565 := 12
  723. Static COLOR_RGB2BGR565 := 13
  724. Static COLOR_BGR5652BGR := 14
  725. Static COLOR_BGR5652RGB := 15
  726. Static COLOR_BGRA2BGR565 := 16
  727. Static COLOR_RGBA2BGR565 := 17
  728. Static COLOR_BGR5652BGRA := 18
  729. Static COLOR_BGR5652RGBA := 19
  730. Static COLOR_GRAY2BGR565 := 20
  731. Static COLOR_BGR5652GRAY := 21
  732. Static COLOR_BGR2BGR555 := 22
  733. Static COLOR_RGB2BGR555 := 23
  734. Static COLOR_BGR5552BGR := 24
  735. Static COLOR_BGR5552RGB := 25
  736. Static COLOR_BGRA2BGR555 := 26
  737. Static COLOR_RGBA2BGR555 := 27
  738. Static COLOR_BGR5552BGRA := 28
  739. Static COLOR_BGR5552RGBA := 29
  740. Static COLOR_GRAY2BGR555 := 30
  741. Static COLOR_BGR5552GRAY := 31
  742. Static COLOR_BGR2XYZ := 32
  743. Static COLOR_RGB2XYZ := 33
  744. Static COLOR_XYZ2BGR := 34
  745. Static COLOR_XYZ2RGB := 35
  746. Static COLOR_BGR2YCrCb := 36
  747. Static COLOR_RGB2YCrCb := 37
  748. Static COLOR_YCrCb2BGR := 38
  749. Static COLOR_YCrCb2RGB := 39
  750. Static COLOR_BGR2HSV := 40
  751. Static COLOR_RGB2HSV := 41
  752. Static COLOR_BGR2Lab := 44
  753. Static COLOR_RGB2Lab := 45
  754. Static COLOR_BGR2Luv := 50
  755. Static COLOR_RGB2Luv := 51
  756. Static COLOR_BGR2HLS := 52
  757. Static COLOR_RGB2HLS := 53
  758. Static COLOR_HSV2BGR := 54
  759. Static COLOR_HSV2RGB := 55
  760. Static COLOR_Lab2BGR := 56
  761. Static COLOR_Lab2RGB := 57
  762. Static COLOR_Luv2BGR := 58
  763. Static COLOR_Luv2RGB := 59
  764. Static COLOR_HLS2BGR := 60
  765. Static COLOR_HLS2RGB := 61
  766. Static COLOR_BGR2HSV_FULL := 66
  767. Static COLOR_RGB2HSV_FULL := 67
  768. Static COLOR_BGR2HLS_FULL := 68
  769. Static COLOR_RGB2HLS_FULL := 69
  770. Static COLOR_HSV2BGR_FULL := 70
  771. Static COLOR_HSV2RGB_FULL := 71
  772. Static COLOR_HLS2BGR_FULL := 72
  773. Static COLOR_HLS2RGB_FULL := 73
  774. Static COLOR_LBGR2Lab := 74
  775. Static COLOR_LRGB2Lab := 75
  776. Static COLOR_LBGR2Luv := 76
  777. Static COLOR_LRGB2Luv := 77
  778. Static COLOR_Lab2LBGR := 78
  779. Static COLOR_Lab2LRGB := 79
  780. Static COLOR_Luv2LBGR := 80
  781. Static COLOR_Luv2LRGB := 81
  782. Static COLOR_BGR2YUV := 82
  783. Static COLOR_RGB2YUV := 83
  784. Static COLOR_YUV2BGR := 84
  785. Static COLOR_YUV2RGB := 85
  786. Static COLOR_YUV2RGB_NV12 := 90
  787. Static COLOR_YUV2BGR_NV12 := 91
  788. Static COLOR_YUV2RGB_NV21 := 92
  789. Static COLOR_YUV2BGR_NV21 := 93
  790. Static COLOR_YUV420sp2RGB := OpenCV.COLOR_YUV2RGB_NV21
  791. Static COLOR_YUV420sp2BGR := OpenCV.COLOR_YUV2BGR_NV21
  792. Static COLOR_YUV2RGBA_NV12 := 94
  793. Static COLOR_YUV2BGRA_NV12 := 95
  794. Static COLOR_YUV2RGBA_NV21 := 96
  795. Static COLOR_YUV2BGRA_NV21 := 97
  796. Static COLOR_YUV420sp2RGBA := OpenCV.COLOR_YUV2RGBA_NV21
  797. Static COLOR_YUV420sp2BGRA := OpenCV.COLOR_YUV2BGRA_NV21
  798. Static COLOR_YUV2RGB_YV12 := 98
  799. Static COLOR_YUV2BGR_YV12 := 99
  800. Static COLOR_YUV2RGB_IYUV := 100
  801. Static COLOR_YUV2BGR_IYUV := 101
  802. Static COLOR_YUV2RGB_I420 := OpenCV.COLOR_YUV2RGB_IYUV
  803. Static COLOR_YUV2BGR_I420 := OpenCV.COLOR_YUV2BGR_IYUV
  804. Static COLOR_YUV420p2RGB := OpenCV.COLOR_YUV2RGB_YV12
  805. Static COLOR_YUV420p2BGR := OpenCV.COLOR_YUV2BGR_YV12
  806. Static COLOR_YUV2RGBA_YV12 := 102
  807. Static COLOR_YUV2BGRA_YV12 := 103
  808. Static COLOR_YUV2RGBA_IYUV := 104
  809. Static COLOR_YUV2BGRA_IYUV := 105
  810. Static COLOR_YUV2RGBA_I420 := OpenCV.COLOR_YUV2RGBA_IYUV
  811. Static COLOR_YUV2BGRA_I420 := OpenCV.COLOR_YUV2BGRA_IYUV
  812. Static COLOR_YUV420p2RGBA := OpenCV.COLOR_YUV2RGBA_YV12
  813. Static COLOR_YUV420p2BGRA := OpenCV.COLOR_YUV2BGRA_YV12
  814. Static COLOR_YUV2GRAY_420 := 106
  815. Static COLOR_YUV2GRAY_NV21 := OpenCV.COLOR_YUV2GRAY_420
  816. Static COLOR_YUV2GRAY_NV12 := OpenCV.COLOR_YUV2GRAY_420
  817. Static COLOR_YUV2GRAY_YV12 := OpenCV.COLOR_YUV2GRAY_420
  818. Static COLOR_YUV2GRAY_IYUV := OpenCV.COLOR_YUV2GRAY_420
  819. Static COLOR_YUV2GRAY_I420 := OpenCV.COLOR_YUV2GRAY_420
  820. Static COLOR_YUV420sp2GRAY := OpenCV.COLOR_YUV2GRAY_420
  821. Static COLOR_YUV420p2GRAY := OpenCV.COLOR_YUV2GRAY_420
  822. Static COLOR_YUV2RGB_UYVY := 107
  823. Static COLOR_YUV2BGR_UYVY := 108
  824. Static COLOR_YUV2RGB_Y422 := OpenCV.COLOR_YUV2RGB_UYVY
  825. Static COLOR_YUV2BGR_Y422 := OpenCV.COLOR_YUV2BGR_UYVY
  826. Static COLOR_YUV2RGB_UYNV := OpenCV.COLOR_YUV2RGB_UYVY
  827. Static COLOR_YUV2BGR_UYNV := OpenCV.COLOR_YUV2BGR_UYVY
  828. Static COLOR_YUV2RGBA_UYVY := 111
  829. Static COLOR_YUV2BGRA_UYVY := 112
  830. Static COLOR_YUV2RGBA_Y422 := OpenCV.COLOR_YUV2RGBA_UYVY
  831. Static COLOR_YUV2BGRA_Y422 := OpenCV.COLOR_YUV2BGRA_UYVY
  832. Static COLOR_YUV2RGBA_UYNV := OpenCV.COLOR_YUV2RGBA_UYVY
  833. Static COLOR_YUV2BGRA_UYNV := OpenCV.COLOR_YUV2BGRA_UYVY
  834. Static COLOR_YUV2RGB_YUY2 := 115
  835. Static COLOR_YUV2BGR_YUY2 := 116
  836. Static COLOR_YUV2RGB_YVYU := 117
  837. Static COLOR_YUV2BGR_YVYU := 118
  838. Static COLOR_YUV2RGB_YUYV := OpenCV.COLOR_YUV2RGB_YUY2
  839. Static COLOR_YUV2BGR_YUYV := OpenCV.COLOR_YUV2BGR_YUY2
  840. Static COLOR_YUV2RGB_YUNV := OpenCV.COLOR_YUV2RGB_YUY2
  841. Static COLOR_YUV2BGR_YUNV := OpenCV.COLOR_YUV2BGR_YUY2
  842. Static COLOR_YUV2RGBA_YUY2 := 119
  843. Static COLOR_YUV2BGRA_YUY2 := 120
  844. Static COLOR_YUV2RGBA_YVYU := 121
  845. Static COLOR_YUV2BGRA_YVYU := 122
  846. Static COLOR_YUV2RGBA_YUYV := OpenCV.COLOR_YUV2RGBA_YUY2
  847. Static COLOR_YUV2BGRA_YUYV := OpenCV.COLOR_YUV2BGRA_YUY2
  848. Static COLOR_YUV2RGBA_YUNV := OpenCV.COLOR_YUV2RGBA_YUY2
  849. Static COLOR_YUV2BGRA_YUNV := OpenCV.COLOR_YUV2BGRA_YUY2
  850. Static COLOR_YUV2GRAY_UYVY := 123
  851. Static COLOR_YUV2GRAY_YUY2 := 124
  852. Static COLOR_YUV2GRAY_Y422 := OpenCV.COLOR_YUV2GRAY_UYVY
  853. Static COLOR_YUV2GRAY_UYNV := OpenCV.COLOR_YUV2GRAY_UYVY
  854. Static COLOR_YUV2GRAY_YVYU := OpenCV.COLOR_YUV2GRAY_YUY2
  855. Static COLOR_YUV2GRAY_YUYV := OpenCV.COLOR_YUV2GRAY_YUY2
  856. Static COLOR_YUV2GRAY_YUNV := OpenCV.COLOR_YUV2GRAY_YUY2
  857. Static COLOR_RGBA2mRGBA := 125
  858. Static COLOR_mRGBA2RGBA := 126
  859. Static COLOR_RGB2YUV_I420 := 127
  860. Static COLOR_BGR2YUV_I420 := 128
  861. Static COLOR_RGB2YUV_IYUV := OpenCV.COLOR_RGB2YUV_I420
  862. Static COLOR_BGR2YUV_IYUV := OpenCV.COLOR_BGR2YUV_I420
  863. Static COLOR_RGBA2YUV_I420 := 129
  864. Static COLOR_BGRA2YUV_I420 := 130
  865. Static COLOR_RGBA2YUV_IYUV := OpenCV.COLOR_RGBA2YUV_I420
  866. Static COLOR_BGRA2YUV_IYUV := OpenCV.COLOR_BGRA2YUV_I420
  867. Static COLOR_RGB2YUV_YV12 := 131
  868. Static COLOR_BGR2YUV_YV12 := 132
  869. Static COLOR_RGBA2YUV_YV12 := 133
  870. Static COLOR_BGRA2YUV_YV12 := 134
  871. Static COLOR_BayerBG2BGR := 46
  872. Static COLOR_BayerGB2BGR := 47
  873. Static COLOR_BayerRG2BGR := 48
  874. Static COLOR_BayerGR2BGR := 49
  875. Static COLOR_BayerRGGB2BGR := OpenCV.COLOR_BayerBG2BGR
  876. Static COLOR_BayerGRBG2BGR := OpenCV.COLOR_BayerGB2BGR
  877. Static COLOR_BayerBGGR2BGR := OpenCV.COLOR_BayerRG2BGR
  878. Static COLOR_BayerGBRG2BGR := OpenCV.COLOR_BayerGR2BGR
  879. Static COLOR_BayerRGGB2RGB := OpenCV.COLOR_BayerBGGR2BGR
  880. Static COLOR_BayerGRBG2RGB := OpenCV.COLOR_BayerGBRG2BGR
  881. Static COLOR_BayerBGGR2RGB := OpenCV.COLOR_BayerRGGB2BGR
  882. Static COLOR_BayerGBRG2RGB := OpenCV.COLOR_BayerGRBG2BGR
  883. Static COLOR_BayerBG2RGB := OpenCV.COLOR_BayerRG2BGR
  884. Static COLOR_BayerGB2RGB := OpenCV.COLOR_BayerGR2BGR
  885. Static COLOR_BayerRG2RGB := OpenCV.COLOR_BayerBG2BGR
  886. Static COLOR_BayerGR2RGB := OpenCV.COLOR_BayerGB2BGR
  887. Static COLOR_BayerBG2GRAY := 86
  888. Static COLOR_BayerGB2GRAY := 87
  889. Static COLOR_BayerRG2GRAY := 88
  890. Static COLOR_BayerGR2GRAY := 89
  891. Static COLOR_BayerRGGB2GRAY := OpenCV.COLOR_BayerBG2GRAY
  892. Static COLOR_BayerGRBG2GRAY := OpenCV.COLOR_BayerGB2GRAY
  893. Static COLOR_BayerBGGR2GRAY := OpenCV.COLOR_BayerRG2GRAY
  894. Static COLOR_BayerGBRG2GRAY := OpenCV.COLOR_BayerGR2GRAY
  895. Static COLOR_BayerBG2BGR_VNG := 62
  896. Static COLOR_BayerGB2BGR_VNG := 63
  897. Static COLOR_BayerRG2BGR_VNG := 64
  898. Static COLOR_BayerGR2BGR_VNG := 65
  899. Static COLOR_BayerRGGB2BGR_VNG := OpenCV.COLOR_BayerBG2BGR_VNG
  900. Static COLOR_BayerGRBG2BGR_VNG := OpenCV.COLOR_BayerGB2BGR_VNG
  901. Static COLOR_BayerBGGR2BGR_VNG := OpenCV.COLOR_BayerRG2BGR_VNG
  902. Static COLOR_BayerGBRG2BGR_VNG := OpenCV.COLOR_BayerGR2BGR_VNG
  903. Static COLOR_BayerRGGB2RGB_VNG := OpenCV.COLOR_BayerBGGR2BGR_VNG
  904. Static COLOR_BayerGRBG2RGB_VNG := OpenCV.COLOR_BayerGBRG2BGR_VNG
  905. Static COLOR_BayerBGGR2RGB_VNG := OpenCV.COLOR_BayerRGGB2BGR_VNG
  906. Static COLOR_BayerGBRG2RGB_VNG := OpenCV.COLOR_BayerGRBG2BGR_VNG
  907. Static COLOR_BayerBG2RGB_VNG := OpenCV.COLOR_BayerRG2BGR_VNG
  908. Static COLOR_BayerGB2RGB_VNG := OpenCV.COLOR_BayerGR2BGR_VNG
  909. Static COLOR_BayerRG2RGB_VNG := OpenCV.COLOR_BayerBG2BGR_VNG
  910. Static COLOR_BayerGR2RGB_VNG := OpenCV.COLOR_BayerGB2BGR_VNG
  911. Static COLOR_BayerBG2BGR_EA := 135
  912. Static COLOR_BayerGB2BGR_EA := 136
  913. Static COLOR_BayerRG2BGR_EA := 137
  914. Static COLOR_BayerGR2BGR_EA := 138
  915. Static COLOR_BayerRGGB2BGR_EA := OpenCV.COLOR_BayerBG2BGR_EA
  916. Static COLOR_BayerGRBG2BGR_EA := OpenCV.COLOR_BayerGB2BGR_EA
  917. Static COLOR_BayerBGGR2BGR_EA := OpenCV.COLOR_BayerRG2BGR_EA
  918. Static COLOR_BayerGBRG2BGR_EA := OpenCV.COLOR_BayerGR2BGR_EA
  919. Static COLOR_BayerRGGB2RGB_EA := OpenCV.COLOR_BayerBGGR2BGR_EA
  920. Static COLOR_BayerGRBG2RGB_EA := OpenCV.COLOR_BayerGBRG2BGR_EA
  921. Static COLOR_BayerBGGR2RGB_EA := OpenCV.COLOR_BayerRGGB2BGR_EA
  922. Static COLOR_BayerGBRG2RGB_EA := OpenCV.COLOR_BayerGRBG2BGR_EA
  923. Static COLOR_BayerBG2RGB_EA := OpenCV.COLOR_BayerRG2BGR_EA
  924. Static COLOR_BayerGB2RGB_EA := OpenCV.COLOR_BayerGR2BGR_EA
  925. Static COLOR_BayerRG2RGB_EA := OpenCV.COLOR_BayerBG2BGR_EA
  926. Static COLOR_BayerGR2RGB_EA := OpenCV.COLOR_BayerGB2BGR_EA
  927. Static COLOR_BayerBG2BGRA := 139
  928. Static COLOR_BayerGB2BGRA := 140
  929. Static COLOR_BayerRG2BGRA := 141
  930. Static COLOR_BayerGR2BGRA := 142
  931. Static COLOR_BayerRGGB2BGRA := OpenCV.COLOR_BayerBG2BGRA
  932. Static COLOR_BayerGRBG2BGRA := OpenCV.COLOR_BayerGB2BGRA
  933. Static COLOR_BayerBGGR2BGRA := OpenCV.COLOR_BayerRG2BGRA
  934. Static COLOR_BayerGBRG2BGRA := OpenCV.COLOR_BayerGR2BGRA
  935. Static COLOR_BayerRGGB2RGBA := OpenCV.COLOR_BayerBGGR2BGRA
  936. Static COLOR_BayerGRBG2RGBA := OpenCV.COLOR_BayerGBRG2BGRA
  937. Static COLOR_BayerBGGR2RGBA := OpenCV.COLOR_BayerRGGB2BGRA
  938. Static COLOR_BayerGBRG2RGBA := OpenCV.COLOR_BayerGRBG2BGRA
  939. Static COLOR_BayerBG2RGBA := OpenCV.COLOR_BayerRG2BGRA
  940. Static COLOR_BayerGB2RGBA := OpenCV.COLOR_BayerGR2BGRA
  941. Static COLOR_BayerRG2RGBA := OpenCV.COLOR_BayerBG2BGRA
  942. Static COLOR_BayerGR2RGBA := OpenCV.COLOR_BayerGB2BGRA
  943. Static COLOR_COLORCVT_MAX := 143
  944. ; RectanglesIntersectTypes
  945. Static INTERSECT_NONE := 0
  946. Static INTERSECT_PARTIAL := 1
  947. Static INTERSECT_FULL := 2
  948. ; LineTypes
  949. Static FILLED := -1
  950. Static LINE_4 := 4
  951. Static LINE_8 := 8
  952. Static LINE_AA := 16
  953. ; HersheyFonts
  954. Static FONT_HERSHEY_SIMPLEX := 0
  955. Static FONT_HERSHEY_PLAIN := 1
  956. Static FONT_HERSHEY_DUPLEX := 2
  957. Static FONT_HERSHEY_COMPLEX := 3
  958. Static FONT_HERSHEY_TRIPLEX := 4
  959. Static FONT_HERSHEY_COMPLEX_SMALL := 5
  960. Static FONT_HERSHEY_SCRIPT_SIMPLEX := 6
  961. Static FONT_HERSHEY_SCRIPT_COMPLEX := 7
  962. Static FONT_ITALIC := 16
  963. ; MarkerTypes
  964. Static MARKER_CROSS := 0
  965. Static MARKER_TILTED_CROSS := 1
  966. Static MARKER_STAR := 2
  967. Static MARKER_DIAMOND := 3
  968. Static MARKER_SQUARE := 4
  969. Static MARKER_TRIANGLE_UP := 5
  970. Static MARKER_TRIANGLE_DOWN := 6
  971. ; anonymous
  972. Static SUBDIV2D_PTLOC_ERROR := -2
  973. Static SUBDIV2D_PTLOC_OUTSIDE_RECT := -1
  974. Static SUBDIV2D_PTLOC_INSIDE := 0
  975. Static SUBDIV2D_PTLOC_VERTEX := 1
  976. Static SUBDIV2D_PTLOC_ON_EDGE := 2
  977. Static SUBDIV2D_NEXT_AROUND_ORG := 0x00
  978. Static SUBDIV2D_NEXT_AROUND_DST := 0x22
  979. Static SUBDIV2D_PREV_AROUND_ORG := 0x11
  980. Static SUBDIV2D_PREV_AROUND_DST := 0x33
  981. Static SUBDIV2D_NEXT_AROUND_LEFT := 0x13
  982. Static SUBDIV2D_NEXT_AROUND_RIGHT := 0x31
  983. Static SUBDIV2D_PREV_AROUND_LEFT := 0x20
  984. Static SUBDIV2D_PREV_AROUND_RIGHT := 0x02
  985. ; TemplateMatchModes
  986. Static TM_SQDIFF := 0
  987. Static TM_SQDIFF_NORMED := 1
  988. Static TM_CCORR := 2
  989. Static TM_CCORR_NORMED := 3
  990. Static TM_CCOEFF := 4
  991. Static TM_CCOEFF_NORMED := 5
  992. ; ColormapTypes
  993. Static COLORMAP_AUTUMN := 0
  994. Static COLORMAP_BONE := 1
  995. Static COLORMAP_JET := 2
  996. Static COLORMAP_WINTER := 3
  997. Static COLORMAP_RAINBOW := 4
  998. Static COLORMAP_OCEAN := 5
  999. Static COLORMAP_SUMMER := 6
  1000. Static COLORMAP_SPRING := 7
  1001. Static COLORMAP_COOL := 8
  1002. Static COLORMAP_HSV := 9
  1003. Static COLORMAP_PINK := 10
  1004. Static COLORMAP_HOT := 11
  1005. Static COLORMAP_PARULA := 12
  1006. Static COLORMAP_MAGMA := 13
  1007. Static COLORMAP_INFERNO := 14
  1008. Static COLORMAP_PLASMA := 15
  1009. Static COLORMAP_VIRIDIS := 16
  1010. Static COLORMAP_CIVIDIS := 17
  1011. Static COLORMAP_TWILIGHT := 18
  1012. Static COLORMAP_TWILIGHT_SHIFTED := 19
  1013. Static COLORMAP_TURBO := 20
  1014. Static COLORMAP_DEEPGREEN := 21
  1015. ; VariableTypes
  1016. Static ML_VAR_NUMERICAL := 0
  1017. Static ML_VAR_ORDERED := 0
  1018. Static ML_VAR_CATEGORICAL := 1
  1019. ; ErrorTypes
  1020. Static ML_TEST_ERROR := 0
  1021. Static ML_TRAIN_ERROR := 1
  1022. ; SampleTypes
  1023. Static ML_ROW_SAMPLE := 0
  1024. Static ML_COL_SAMPLE := 1
  1025. ; Flags
  1026. Static ML_STAT_MODEL_UPDATE_MODEL := 1
  1027. Static ML_STAT_MODEL_RAW_OUTPUT := 1
  1028. Static ML_STAT_MODEL_COMPRESSED_INPUT := 2
  1029. Static ML_STAT_MODEL_PREPROCESSED_INPUT := 4
  1030. ; Types
  1031. Static ML_KNEAREST_BRUTE_FORCE := 1
  1032. Static ML_KNEAREST_KDTREE := 2
  1033. ; Types
  1034. Static ML_SVM_C_SVC := 100
  1035. Static ML_SVM_NU_SVC := 101
  1036. Static ML_SVM_ONE_CLASS := 102
  1037. Static ML_SVM_EPS_SVR := 103
  1038. Static ML_SVM_NU_SVR := 104
  1039. ; KernelTypes
  1040. Static ML_SVM_CUSTOM := -1
  1041. Static ML_SVM_LINEAR := 0
  1042. Static ML_SVM_POLY := 1
  1043. Static ML_SVM_RBF := 2
  1044. Static ML_SVM_SIGMOID := 3
  1045. Static ML_SVM_CHI2 := 4
  1046. Static ML_SVM_INTER := 5
  1047. ; ParamTypes
  1048. Static ML_SVM_C := 0
  1049. Static ML_SVM_GAMMA := 1
  1050. Static ML_SVM_P := 2
  1051. Static ML_SVM_NU := 3
  1052. Static ML_SVM_COEF := 4
  1053. Static ML_SVM_DEGREE := 5
  1054. ; Types
  1055. Static ML_EM_COV_MAT_SPHERICAL := 0
  1056. Static ML_EM_COV_MAT_DIAGONAL := 1
  1057. Static ML_EM_COV_MAT_GENERIC := 2
  1058. Static ML_EM_COV_MAT_DEFAULT := OpenCV.ML_EM_COV_MAT_DIAGONAL
  1059. ; anonymous
  1060. Static ML_EM_DEFAULT_NCLUSTERS := 5
  1061. Static ML_EM_DEFAULT_MAX_ITERS := 100
  1062. Static ML_EM_START_E_STEP := 1
  1063. Static ML_EM_START_M_STEP := 2
  1064. Static ML_EM_START_AUTO_STEP := 0
  1065. ; Flags
  1066. Static ML_DTREES_PREDICT_AUTO := 0
  1067. Static ML_DTREES_PREDICT_SUM := (BitShift(1, -8))
  1068. Static ML_DTREES_PREDICT_MAX_VOTE := (BitShift(2, -8))
  1069. Static ML_DTREES_PREDICT_MASK := (BitShift(3, -8))
  1070. ; Types
  1071. Static ML_BOOST_DISCRETE := 0
  1072. Static ML_BOOST_REAL := 1
  1073. Static ML_BOOST_LOGIT := 2
  1074. Static ML_BOOST_GENTLE := 3
  1075. ; TrainingMethods
  1076. Static ML_ANN_MLP_BACKPROP := 0
  1077. Static ML_ANN_MLP_RPROP := 1
  1078. Static ML_ANN_MLP_ANNEAL := 2
  1079. ; ActivationFunctions
  1080. Static ML_ANN_MLP_IDENTITY := 0
  1081. Static ML_ANN_MLP_SIGMOID_SYM := 1
  1082. Static ML_ANN_MLP_GAUSSIAN := 2
  1083. Static ML_ANN_MLP_RELU := 3
  1084. Static ML_ANN_MLP_LEAKYRELU := 4
  1085. ; TrainFlags
  1086. Static ML_ANN_MLP_UPDATE_WEIGHTS := 1
  1087. Static ML_ANN_MLP_NO_INPUT_SCALE := 2
  1088. Static ML_ANN_MLP_NO_OUTPUT_SCALE := 4
  1089. ; RegKinds
  1090. Static ML_LOGISTIC_REGRESSION_REG_DISABLE := -1
  1091. Static ML_LOGISTIC_REGRESSION_REG_L1 := 0
  1092. Static ML_LOGISTIC_REGRESSION_REG_L2 := 1
  1093. ; Methods
  1094. Static ML_LOGISTIC_REGRESSION_BATCH := 0
  1095. Static ML_LOGISTIC_REGRESSION_MINI_BATCH := 1
  1096. ; SvmsgdType
  1097. Static ML_SVMSGD_SGD := 0
  1098. Static ML_SVMSGD_ASGD := 1
  1099. ; MarginType
  1100. Static ML_SVMSGD_SOFT_MARGIN := 0
  1101. Static ML_SVMSGD_HARD_MARGIN := 1
  1102. ; anonymous
  1103. Static INPAINT_NS := 0
  1104. Static INPAINT_TELEA := 1
  1105. Static LDR_SIZE := 256
  1106. Static NORMAL_CLONE := 1
  1107. Static MIXED_CLONE := 2
  1108. Static MONOCHROME_TRANSFER := 3
  1109. Static RECURS_FILTER := 1
  1110. Static NORMCONV_FILTER := 2
  1111. Static CAP_PROP_DC1394_OFF := -4
  1112. Static CAP_PROP_DC1394_MODE_MANUAL := -3
  1113. Static CAP_PROP_DC1394_MODE_AUTO := -2
  1114. Static CAP_PROP_DC1394_MODE_ONE_PUSH_AUTO := -1
  1115. Static CAP_PROP_DC1394_MAX := 31
  1116. Static CAP_OPENNI_DEPTH_GENERATOR := BitShift(1, -31)
  1117. Static CAP_OPENNI_IMAGE_GENERATOR := BitShift(1, -30)
  1118. Static CAP_OPENNI_IR_GENERATOR := BitShift(1, -29)
  1119. Static CAP_OPENNI_GENERATORS_MASK := OpenCV.CAP_OPENNI_DEPTH_GENERATOR + OpenCV.CAP_OPENNI_IMAGE_GENERATOR + OpenCV.CAP_OPENNI_IR_GENERATOR
  1120. Static CAP_PROP_OPENNI_OUTPUT_MODE := 100
  1121. Static CAP_PROP_OPENNI_FRAME_MAX_DEPTH := 101
  1122. Static CAP_PROP_OPENNI_BASELINE := 102
  1123. Static CAP_PROP_OPENNI_FOCAL_LENGTH := 103
  1124. Static CAP_PROP_OPENNI_REGISTRATION := 104
  1125. Static CAP_PROP_OPENNI_REGISTRATION_ON := OpenCV.CAP_PROP_OPENNI_REGISTRATION
  1126. Static CAP_PROP_OPENNI_APPROX_FRAME_SYNC := 105
  1127. Static CAP_PROP_OPENNI_MAX_BUFFER_SIZE := 106
  1128. Static CAP_PROP_OPENNI_CIRCLE_BUFFER := 107
  1129. Static CAP_PROP_OPENNI_MAX_TIME_DURATION := 108
  1130. Static CAP_PROP_OPENNI_GENERATOR_PRESENT := 109
  1131. Static CAP_PROP_OPENNI2_SYNC := 110
  1132. Static CAP_PROP_OPENNI2_MIRROR := 111
  1133. Static CAP_OPENNI_IMAGE_GENERATOR_PRESENT := OpenCV.CAP_OPENNI_IMAGE_GENERATOR + OpenCV.CAP_PROP_OPENNI_GENERATOR_PRESENT
  1134. Static CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE := OpenCV.CAP_OPENNI_IMAGE_GENERATOR + OpenCV.CAP_PROP_OPENNI_OUTPUT_MODE
  1135. Static CAP_OPENNI_DEPTH_GENERATOR_PRESENT := OpenCV.CAP_OPENNI_DEPTH_GENERATOR + OpenCV.CAP_PROP_OPENNI_GENERATOR_PRESENT
  1136. Static CAP_OPENNI_DEPTH_GENERATOR_BASELINE := OpenCV.CAP_OPENNI_DEPTH_GENERATOR + OpenCV.CAP_PROP_OPENNI_BASELINE
  1137. Static CAP_OPENNI_DEPTH_GENERATOR_FOCAL_LENGTH := OpenCV.CAP_OPENNI_DEPTH_GENERATOR + OpenCV.CAP_PROP_OPENNI_FOCAL_LENGTH
  1138. Static CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION := OpenCV.CAP_OPENNI_DEPTH_GENERATOR + OpenCV.CAP_PROP_OPENNI_REGISTRATION
  1139. Static CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION_ON := OpenCV.CAP_OPENNI_DEPTH_GENERATOR_REGISTRATION
  1140. Static CAP_OPENNI_IR_GENERATOR_PRESENT := OpenCV.CAP_OPENNI_IR_GENERATOR + OpenCV.CAP_PROP_OPENNI_GENERATOR_PRESENT
  1141. Static CAP_OPENNI_DEPTH_MAP := 0
  1142. Static CAP_OPENNI_POINT_CLOUD_MAP := 1
  1143. Static CAP_OPENNI_DISPARITY_MAP := 2
  1144. Static CAP_OPENNI_DISPARITY_MAP_32F := 3
  1145. Static CAP_OPENNI_VALID_DEPTH_MASK := 4
  1146. Static CAP_OPENNI_BGR_IMAGE := 5
  1147. Static CAP_OPENNI_GRAY_IMAGE := 6
  1148. Static CAP_OPENNI_IR_IMAGE := 7
  1149. Static CAP_OPENNI_VGA_30HZ := 0
  1150. Static CAP_OPENNI_SXGA_15HZ := 1
  1151. Static CAP_OPENNI_SXGA_30HZ := 2
  1152. Static CAP_OPENNI_QVGA_30HZ := 3
  1153. Static CAP_OPENNI_QVGA_60HZ := 4
  1154. Static CAP_PROP_GSTREAMER_QUEUE_LENGTH := 200
  1155. Static CAP_PROP_PVAPI_MULTICASTIP := 300
  1156. Static CAP_PROP_PVAPI_FRAMESTARTTRIGGERMODE := 301
  1157. Static CAP_PROP_PVAPI_DECIMATIONHORIZONTAL := 302
  1158. Static CAP_PROP_PVAPI_DECIMATIONVERTICAL := 303
  1159. Static CAP_PROP_PVAPI_BINNINGX := 304
  1160. Static CAP_PROP_PVAPI_BINNINGY := 305
  1161. Static CAP_PROP_PVAPI_PIXELFORMAT := 306
  1162. Static CAP_PVAPI_FSTRIGMODE_FREERUN := 0
  1163. Static CAP_PVAPI_FSTRIGMODE_SYNCIN1 := 1
  1164. Static CAP_PVAPI_FSTRIGMODE_SYNCIN2 := 2
  1165. Static CAP_PVAPI_FSTRIGMODE_FIXEDRATE := 3
  1166. Static CAP_PVAPI_FSTRIGMODE_SOFTWARE := 4
  1167. Static CAP_PVAPI_DECIMATION_OFF := 1
  1168. Static CAP_PVAPI_DECIMATION_2OUTOF4 := 2
  1169. Static CAP_PVAPI_DECIMATION_2OUTOF8 := 4
  1170. Static CAP_PVAPI_DECIMATION_2OUTOF16 := 8
  1171. Static CAP_PVAPI_PIXELFORMAT_MONO8 := 1
  1172. Static CAP_PVAPI_PIXELFORMAT_MONO16 := 2
  1173. Static CAP_PVAPI_PIXELFORMAT_BAYER8 := 3
  1174. Static CAP_PVAPI_PIXELFORMAT_BAYER16 := 4
  1175. Static CAP_PVAPI_PIXELFORMAT_RGB24 := 5
  1176. Static CAP_PVAPI_PIXELFORMAT_BGR24 := 6
  1177. Static CAP_PVAPI_PIXELFORMAT_RGBA32 := 7
  1178. Static CAP_PVAPI_PIXELFORMAT_BGRA32 := 8
  1179. Static CAP_PROP_XI_DOWNSAMPLING := 400
  1180. Static CAP_PROP_XI_DATA_FORMAT := 401
  1181. Static CAP_PROP_XI_OFFSET_X := 402
  1182. Static CAP_PROP_XI_OFFSET_Y := 403
  1183. Static CAP_PROP_XI_TRG_SOURCE := 404
  1184. Static CAP_PROP_XI_TRG_SOFTWARE := 405
  1185. Static CAP_PROP_XI_GPI_SELECTOR := 406
  1186. Static CAP_PROP_XI_GPI_MODE := 407
  1187. Static CAP_PROP_XI_GPI_LEVEL := 408
  1188. Static CAP_PROP_XI_GPO_SELECTOR := 409
  1189. Static CAP_PROP_XI_GPO_MODE := 410
  1190. Static CAP_PROP_XI_LED_SELECTOR := 411
  1191. Static CAP_PROP_XI_LED_MODE := 412
  1192. Static CAP_PROP_XI_MANUAL_WB := 413
  1193. Static CAP_PROP_XI_AUTO_WB := 414
  1194. Static CAP_PROP_XI_AEAG := 415
  1195. Static CAP_PROP_XI_EXP_PRIORITY := 416
  1196. Static CAP_PROP_XI_AE_MAX_LIMIT := 417
  1197. Static CAP_PROP_XI_AG_MAX_LIMIT := 418
  1198. Static CAP_PROP_XI_AEAG_LEVEL := 419
  1199. Static CAP_PROP_XI_TIMEOUT := 420
  1200. Static CAP_PROP_XI_EXPOSURE := 421
  1201. Static CAP_PROP_XI_EXPOSURE_BURST_COUNT := 422
  1202. Static CAP_PROP_XI_GAIN_SELECTOR := 423
  1203. Static CAP_PROP_XI_GAIN := 424
  1204. Static CAP_PROP_XI_DOWNSAMPLING_TYPE := 426
  1205. Static CAP_PROP_XI_BINNING_SELECTOR := 427
  1206. Static CAP_PROP_XI_BINNING_VERTICAL := 428
  1207. Static CAP_PROP_XI_BINNING_HORIZONTAL := 429
  1208. Static CAP_PROP_XI_BINNING_PATTERN := 430
  1209. Static CAP_PROP_XI_DECIMATION_SELECTOR := 431
  1210. Static CAP_PROP_XI_DECIMATION_VERTICAL := 432
  1211. Static CAP_PROP_XI_DECIMATION_HORIZONTAL := 433
  1212. Static CAP_PROP_XI_DECIMATION_PATTERN := 434
  1213. Static CAP_PROP_XI_TEST_PATTERN_GENERATOR_SELECTOR := 587
  1214. Static CAP_PROP_XI_TEST_PATTERN := 588
  1215. Static CAP_PROP_XI_IMAGE_DATA_FORMAT := 435
  1216. Static CAP_PROP_XI_SHUTTER_TYPE := 436
  1217. Static CAP_PROP_XI_SENSOR_TAPS := 437
  1218. Static CAP_PROP_XI_AEAG_ROI_OFFSET_X := 439
  1219. Static CAP_PROP_XI_AEAG_ROI_OFFSET_Y := 440
  1220. Static CAP_PROP_XI_AEAG_ROI_WIDTH := 441
  1221. Static CAP_PROP_XI_AEAG_ROI_HEIGHT := 442
  1222. Static CAP_PROP_XI_BPC := 445
  1223. Static CAP_PROP_XI_WB_KR := 448
  1224. Static CAP_PROP_XI_WB_KG := 449
  1225. Static CAP_PROP_XI_WB_KB := 450
  1226. Static CAP_PROP_XI_WIDTH := 451
  1227. Static CAP_PROP_XI_HEIGHT := 452
  1228. Static CAP_PROP_XI_REGION_SELECTOR := 589
  1229. Static CAP_PROP_XI_REGION_MODE := 595
  1230. Static CAP_PROP_XI_LIMIT_BANDWIDTH := 459
  1231. Static CAP_PROP_XI_SENSOR_DATA_BIT_DEPTH := 460
  1232. Static CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH := 461
  1233. Static CAP_PROP_XI_IMAGE_DATA_BIT_DEPTH := 462
  1234. Static CAP_PROP_XI_OUTPUT_DATA_PACKING := 463
  1235. Static CAP_PROP_XI_OUTPUT_DATA_PACKING_TYPE := 464
  1236. Static CAP_PROP_XI_IS_COOLED := 465
  1237. Static CAP_PROP_XI_COOLING := 466
  1238. Static CAP_PROP_XI_TARGET_TEMP := 467
  1239. Static CAP_PROP_XI_CHIP_TEMP := 468
  1240. Static CAP_PROP_XI_HOUS_TEMP := 469
  1241. Static CAP_PROP_XI_HOUS_BACK_SIDE_TEMP := 590
  1242. Static CAP_PROP_XI_SENSOR_BOARD_TEMP := 596
  1243. Static CAP_PROP_XI_CMS := 470
  1244. Static CAP_PROP_XI_APPLY_CMS := 471
  1245. Static CAP_PROP_XI_IMAGE_IS_COLOR := 474
  1246. Static CAP_PROP_XI_COLOR_FILTER_ARRAY := 475
  1247. Static CAP_PROP_XI_GAMMAY := 476
  1248. Static CAP_PROP_XI_GAMMAC := 477
  1249. Static CAP_PROP_XI_SHARPNESS := 478
  1250. Static CAP_PROP_XI_CC_MATRIX_00 := 479
  1251. Static CAP_PROP_XI_CC_MATRIX_01 := 480
  1252. Static CAP_PROP_XI_CC_MATRIX_02 := 481
  1253. Static CAP_PROP_XI_CC_MATRIX_03 := 482
  1254. Static CAP_PROP_XI_CC_MATRIX_10 := 483
  1255. Static CAP_PROP_XI_CC_MATRIX_11 := 484
  1256. Static CAP_PROP_XI_CC_MATRIX_12 := 485
  1257. Static CAP_PROP_XI_CC_MATRIX_13 := 486
  1258. Static CAP_PROP_XI_CC_MATRIX_20 := 487
  1259. Static CAP_PROP_XI_CC_MATRIX_21 := 488
  1260. Static CAP_PROP_XI_CC_MATRIX_22 := 489
  1261. Static CAP_PROP_XI_CC_MATRIX_23 := 490
  1262. Static CAP_PROP_XI_CC_MATRIX_30 := 491
  1263. Static CAP_PROP_XI_CC_MATRIX_31 := 492
  1264. Static CAP_PROP_XI_CC_MATRIX_32 := 493
  1265. Static CAP_PROP_XI_CC_MATRIX_33 := 494
  1266. Static CAP_PROP_XI_DEFAULT_CC_MATRIX := 495
  1267. Static CAP_PROP_XI_TRG_SELECTOR := 498
  1268. Static CAP_PROP_XI_ACQ_FRAME_BURST_COUNT := 499
  1269. Static CAP_PROP_XI_DEBOUNCE_EN := 507
  1270. Static CAP_PROP_XI_DEBOUNCE_T0 := 508
  1271. Static CAP_PROP_XI_DEBOUNCE_T1 := 509
  1272. Static CAP_PROP_XI_DEBOUNCE_POL := 510
  1273. Static CAP_PROP_XI_LENS_MODE := 511
  1274. Static CAP_PROP_XI_LENS_APERTURE_VALUE := 512
  1275. Static CAP_PROP_XI_LENS_FOCUS_MOVEMENT_VALUE := 513
  1276. Static CAP_PROP_XI_LENS_FOCUS_MOVE := 514
  1277. Static CAP_PROP_XI_LENS_FOCUS_DISTANCE := 515
  1278. Static CAP_PROP_XI_LENS_FOCAL_LENGTH := 516
  1279. Static CAP_PROP_XI_LENS_FEATURE_SELECTOR := 517
  1280. Static CAP_PROP_XI_LENS_FEATURE := 518
  1281. Static CAP_PROP_XI_DEVICE_MODEL_ID := 521
  1282. Static CAP_PROP_XI_DEVICE_SN := 522
  1283. Static CAP_PROP_XI_IMAGE_DATA_FORMAT_RGB32_ALPHA := 529
  1284. Static CAP_PROP_XI_IMAGE_PAYLOAD_SIZE := 530
  1285. Static CAP_PROP_XI_TRANSPORT_PIXEL_FORMAT := 531
  1286. Static CAP_PROP_XI_SENSOR_CLOCK_FREQ_HZ := 532
  1287. Static CAP_PROP_XI_SENSOR_CLOCK_FREQ_INDEX := 533
  1288. Static CAP_PROP_XI_SENSOR_OUTPUT_CHANNEL_COUNT := 534
  1289. Static CAP_PROP_XI_FRAMERATE := 535
  1290. Static CAP_PROP_XI_COUNTER_SELECTOR := 536
  1291. Static CAP_PROP_XI_COUNTER_VALUE := 537
  1292. Static CAP_PROP_XI_ACQ_TIMING_MODE := 538
  1293. Static CAP_PROP_XI_AVAILABLE_BANDWIDTH := 539
  1294. Static CAP_PROP_XI_BUFFER_POLICY := 540
  1295. Static CAP_PROP_XI_LUT_EN := 541
  1296. Static CAP_PROP_XI_LUT_INDEX := 542
  1297. Static CAP_PROP_XI_LUT_VALUE := 543
  1298. Static CAP_PROP_XI_TRG_DELAY := 544
  1299. Static CAP_PROP_XI_TS_RST_MODE := 545
  1300. Static CAP_PROP_XI_TS_RST_SOURCE := 546
  1301. Static CAP_PROP_XI_IS_DEVICE_EXIST := 547
  1302. Static CAP_PROP_XI_ACQ_BUFFER_SIZE := 548
  1303. Static CAP_PROP_XI_ACQ_BUFFER_SIZE_UNIT := 549
  1304. Static CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_SIZE := 550
  1305. Static CAP_PROP_XI_BUFFERS_QUEUE_SIZE := 551
  1306. Static CAP_PROP_XI_ACQ_TRANSPORT_BUFFER_COMMIT := 552
  1307. Static CAP_PROP_XI_RECENT_FRAME := 553
  1308. Static CAP_PROP_XI_DEVICE_RESET := 554
  1309. Static CAP_PROP_XI_COLUMN_FPN_CORRECTION := 555
  1310. Static CAP_PROP_XI_ROW_FPN_CORRECTION := 591
  1311. Static CAP_PROP_XI_SENSOR_MODE := 558
  1312. Static CAP_PROP_XI_HDR := 559
  1313. Static CAP_PROP_XI_HDR_KNEEPOINT_COUNT := 560
  1314. Static CAP_PROP_XI_HDR_T1 := 561
  1315. Static CAP_PROP_XI_HDR_T2 := 562
  1316. Static CAP_PROP_XI_KNEEPOINT1 := 563
  1317. Static CAP_PROP_XI_KNEEPOINT2 := 564
  1318. Static CAP_PROP_XI_IMAGE_BLACK_LEVEL := 565
  1319. Static CAP_PROP_XI_HW_REVISION := 571
  1320. Static CAP_PROP_XI_DEBUG_LEVEL := 572
  1321. Static CAP_PROP_XI_AUTO_BANDWIDTH_CALCULATION := 573
  1322. Static CAP_PROP_XI_FFS_FILE_ID := 594
  1323. Static CAP_PROP_XI_FFS_FILE_SIZE := 580
  1324. Static CAP_PROP_XI_FREE_FFS_SIZE := 581
  1325. Static CAP_PROP_XI_USED_FFS_SIZE := 582
  1326. Static CAP_PROP_XI_FFS_ACCESS_KEY := 583
  1327. Static CAP_PROP_XI_SENSOR_FEATURE_SELECTOR := 585
  1328. Static CAP_PROP_XI_SENSOR_FEATURE_VALUE := 586
  1329. Static CAP_PROP_ARAVIS_AUTOTRIGGER := 600
  1330. Static CAP_PROP_IOS_DEVICE_FOCUS := 9001
  1331. Static CAP_PROP_IOS_DEVICE_EXPOSURE := 9002
  1332. Static CAP_PROP_IOS_DEVICE_FLASH := 9003
  1333. Static CAP_PROP_IOS_DEVICE_WHITEBALANCE := 9004
  1334. Static CAP_PROP_IOS_DEVICE_TORCH := 9005
  1335. Static CAP_PROP_GIGA_FRAME_OFFSET_X := 10001
  1336. Static CAP_PROP_GIGA_FRAME_OFFSET_Y := 10002
  1337. Static CAP_PROP_GIGA_FRAME_WIDTH_MAX := 10003
  1338. Static CAP_PROP_GIGA_FRAME_HEIGH_MAX := 10004
  1339. Static CAP_PROP_GIGA_FRAME_SENS_WIDTH := 10005
  1340. Static CAP_PROP_GIGA_FRAME_SENS_HEIGH := 10006
  1341. Static CAP_PROP_INTELPERC_PROFILE_COUNT := 11001
  1342. Static CAP_PROP_INTELPERC_PROFILE_IDX := 11002
  1343. Static CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE := 11003
  1344. Static CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE := 11004
  1345. Static CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD := 11005
  1346. Static CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ := 11006
  1347. Static CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT := 11007
  1348. Static CAP_INTELPERC_DEPTH_GENERATOR := BitShift(1, -29)
  1349. Static CAP_INTELPERC_IMAGE_GENERATOR := BitShift(1, -28)
  1350. Static CAP_INTELPERC_IR_GENERATOR := BitShift(1, -27)
  1351. Static CAP_INTELPERC_GENERATORS_MASK := OpenCV.CAP_INTELPERC_DEPTH_GENERATOR + OpenCV.CAP_INTELPERC_IMAGE_GENERATOR + OpenCV.CAP_INTELPERC_IR_GENERATOR
  1352. Static CAP_INTELPERC_DEPTH_MAP := 0
  1353. Static CAP_INTELPERC_UVDEPTH_MAP := 1
  1354. Static CAP_INTELPERC_IR_MAP := 2
  1355. Static CAP_INTELPERC_IMAGE := 3
  1356. Static CAP_PROP_GPHOTO2_PREVIEW := 17001
  1357. Static CAP_PROP_GPHOTO2_WIDGET_ENUMERATE := 17002
  1358. Static CAP_PROP_GPHOTO2_RELOAD_CONFIG := 17003
  1359. Static CAP_PROP_GPHOTO2_RELOAD_ON_CHANGE := 17004
  1360. Static CAP_PROP_GPHOTO2_COLLECT_MSGS := 17005
  1361. Static CAP_PROP_GPHOTO2_FLUSH_MSGS := 17006
  1362. Static CAP_PROP_SPEED := 17007
  1363. Static CAP_PROP_APERTURE := 17008
  1364. Static CAP_PROP_EXPOSUREPROGRAM := 17009
  1365. Static CAP_PROP_VIEWFINDER := 17010
  1366. Static CAP_PROP_IMAGES_BASE := 18000
  1367. Static CAP_PROP_IMAGES_LAST := 19000
  1368. Static LMEDS := 4
  1369. Static RANSAC := 8
  1370. Static RHO := 16
  1371. Static USAC_DEFAULT := 32
  1372. Static USAC_PARALLEL := 33
  1373. Static USAC_FM_8PTS := 34
  1374. Static USAC_FAST := 35
  1375. Static USAC_ACCURATE := 36
  1376. Static USAC_PROSAC := 37
  1377. Static USAC_MAGSAC := 38
  1378. Static CALIB_CB_ADAPTIVE_THRESH := 1
  1379. Static CALIB_CB_NORMALIZE_IMAGE := 2
  1380. Static CALIB_CB_FILTER_QUADS := 4
  1381. Static CALIB_CB_FAST_CHECK := 8
  1382. Static CALIB_CB_EXHAUSTIVE := 16
  1383. Static CALIB_CB_ACCURACY := 32
  1384. Static CALIB_CB_LARGER := 64
  1385. Static CALIB_CB_MARKER := 128
  1386. Static CALIB_CB_SYMMETRIC_GRID := 1
  1387. Static CALIB_CB_ASYMMETRIC_GRID := 2
  1388. Static CALIB_CB_CLUSTERING := 4
  1389. Static CALIB_NINTRINSIC := 18
  1390. Static CALIB_USE_INTRINSIC_GUESS := 0x00001
  1391. Static CALIB_FIX_ASPECT_RATIO := 0x00002
  1392. Static CALIB_FIX_PRINCIPAL_POINT := 0x00004
  1393. Static CALIB_ZERO_TANGENT_DIST := 0x00008
  1394. Static CALIB_FIX_FOCAL_LENGTH := 0x00010
  1395. Static CALIB_FIX_K1 := 0x00020
  1396. Static CALIB_FIX_K2 := 0x00040
  1397. Static CALIB_FIX_K3 := 0x00080
  1398. Static CALIB_FIX_K4 := 0x00800
  1399. Static CALIB_FIX_K5 := 0x01000
  1400. Static CALIB_FIX_K6 := 0x02000
  1401. Static CALIB_RATIONAL_MODEL := 0x04000
  1402. Static CALIB_THIN_PRISM_MODEL := 0x08000
  1403. Static CALIB_FIX_S1_S2_S3_S4 := 0x10000
  1404. Static CALIB_TILTED_MODEL := 0x40000
  1405. Static CALIB_FIX_TAUX_TAUY := 0x80000
  1406. Static CALIB_USE_QR := 0x100000
  1407. Static CALIB_FIX_TANGENT_DIST := 0x200000
  1408. Static CALIB_FIX_INTRINSIC := 0x00100
  1409. Static CALIB_SAME_FOCAL_LENGTH := 0x00200
  1410. Static CALIB_ZERO_DISPARITY := 0x00400
  1411. Static CALIB_USE_LU := (BitShift(1, -17))
  1412. Static CALIB_USE_EXTRINSIC_GUESS := (BitShift(1, -22))
  1413. Static FM_7POINT := 1
  1414. Static FM_8POINT := 2
  1415. Static FM_LMEDS := 4
  1416. Static FM_RANSAC := 8
  1417. Static CASCADE_DO_CANNY_PRUNING := 1
  1418. Static CASCADE_SCALE_IMAGE := 2
  1419. Static CASCADE_FIND_BIGGEST_OBJECT := 4
  1420. Static CASCADE_DO_ROUGH_SEARCH := 8
  1421. Static OPTFLOW_USE_INITIAL_FLOW := 4
  1422. Static OPTFLOW_LK_GET_MIN_EIGENVALS := 8
  1423. Static OPTFLOW_FARNEBACK_GAUSSIAN := 256
  1424. Static MOTION_TRANSLATION := 0
  1425. Static MOTION_EUCLIDEAN := 1
  1426. Static MOTION_AFFINE := 2
  1427. Static MOTION_HOMOGRAPHY := 3
  1428. ; Backend
  1429. Static DNN_DNN_BACKEND_DEFAULT := 0
  1430. Static DNN_DNN_BACKEND_HALIDE := 0 + 1
  1431. Static DNN_DNN_BACKEND_INFERENCE_ENGINE := 0 + 2
  1432. Static DNN_DNN_BACKEND_OPENCV := 0 + 3
  1433. Static DNN_DNN_BACKEND_VKCOM := 0 + 4
  1434. Static DNN_DNN_BACKEND_CUDA := 0 + 5
  1435. Static DNN_DNN_BACKEND_WEBNN := 0 + 6
  1436. ; Target
  1437. Static DNN_DNN_TARGET_CPU := 0
  1438. Static DNN_DNN_TARGET_OPENCL := 0 + 1
  1439. Static DNN_DNN_TARGET_OPENCL_FP16 := 0 + 2
  1440. Static DNN_DNN_TARGET_MYRIAD := 0 + 3
  1441. Static DNN_DNN_TARGET_VULKAN := 0 + 4
  1442. Static DNN_DNN_TARGET_FPGA := 0 + 5
  1443. Static DNN_DNN_TARGET_CUDA := 0 + 6
  1444. Static DNN_DNN_TARGET_CUDA_FP16 := 0 + 7
  1445. Static DNN_DNN_TARGET_HDDL := 0 + 8
  1446. ; SoftNMSMethod
  1447. Static DNN_SOFT_NMSMETHOD_SOFTNMS_LINEAR := 1
  1448. Static DNN_SOFT_NMSMETHOD_SOFTNMS_GAUSSIAN := 2
  1449. ; ScoreType
  1450. Static ORB_HARRIS_SCORE := 0
  1451. Static ORB_FAST_SCORE := 1
  1452. ; DetectorType
  1453. Static FAST_FEATURE_DETECTOR_TYPE_5_8 := 0
  1454. Static FAST_FEATURE_DETECTOR_TYPE_7_12 := 1
  1455. Static FAST_FEATURE_DETECTOR_TYPE_9_16 := 2
  1456. ; anonymous
  1457. Static FAST_FEATURE_DETECTOR_THRESHOLD := 10000
  1458. Static FAST_FEATURE_DETECTOR_NONMAX_SUPPRESSION := 10001
  1459. Static FAST_FEATURE_DETECTOR_FAST_N := 10002
  1460. ; DetectorType
  1461. Static AGAST_FEATURE_DETECTOR_AGAST_5_8 := 0
  1462. Static AGAST_FEATURE_DETECTOR_AGAST_7_12d := 1
  1463. Static AGAST_FEATURE_DETECTOR_AGAST_7_12s := 2
  1464. Static AGAST_FEATURE_DETECTOR_OAST_9_16 := 3
  1465. ; anonymous
  1466. Static AGAST_FEATURE_DETECTOR_THRESHOLD := 10000
  1467. Static AGAST_FEATURE_DETECTOR_NONMAX_SUPPRESSION := 10001
  1468. ; DiffusivityType
  1469. Static KAZE_DIFF_PM_G1 := 0
  1470. Static KAZE_DIFF_PM_G2 := 1
  1471. Static KAZE_DIFF_WEICKERT := 2
  1472. Static KAZE_DIFF_CHARBONNIER := 3
  1473. ; DescriptorType
  1474. Static AKAZE_DESCRIPTOR_KAZE_UPRIGHT := 2
  1475. Static AKAZE_DESCRIPTOR_KAZE := 3
  1476. Static AKAZE_DESCRIPTOR_MLDB_UPRIGHT := 4
  1477. Static AKAZE_DESCRIPTOR_MLDB := 5
  1478. ; MatcherType
  1479. Static DESCRIPTOR_MATCHER_FLANNBASED := 1
  1480. Static DESCRIPTOR_MATCHER_BRUTEFORCE := 2
  1481. Static DESCRIPTOR_MATCHER_BRUTEFORCE_L1 := 3
  1482. Static DESCRIPTOR_MATCHER_BRUTEFORCE_HAMMING := 4
  1483. Static DESCRIPTOR_MATCHER_BRUTEFORCE_HAMMINGLUT := 5
  1484. Static DESCRIPTOR_MATCHER_BRUTEFORCE_SL2 := 6
  1485. ; DrawMatchesFlags
  1486. Static DRAW_MATCHES_FLAGS_DEFAULT := 0
  1487. Static DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG := 1
  1488. Static DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS := 2
  1489. Static DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS := 4
  1490. ; ImreadModes
  1491. Static IMREAD_UNCHANGED := -1
  1492. Static IMREAD_GRAYSCALE := 0
  1493. Static IMREAD_COLOR := 1
  1494. Static IMREAD_ANYDEPTH := 2
  1495. Static IMREAD_ANYCOLOR := 4
  1496. Static IMREAD_LOAD_GDAL := 8
  1497. Static IMREAD_REDUCED_GRAYSCALE_2 := 16
  1498. Static IMREAD_REDUCED_COLOR_2 := 17
  1499. Static IMREAD_REDUCED_GRAYSCALE_4 := 32
  1500. Static IMREAD_REDUCED_COLOR_4 := 33
  1501. Static IMREAD_REDUCED_GRAYSCALE_8 := 64
  1502. Static IMREAD_REDUCED_COLOR_8 := 65
  1503. Static IMREAD_IGNORE_ORIENTATION := 128
  1504. ; ImwriteFlags
  1505. Static IMWRITE_JPEG_QUALITY := 1
  1506. Static IMWRITE_JPEG_PROGRESSIVE := 2
  1507. Static IMWRITE_JPEG_OPTIMIZE := 3
  1508. Static IMWRITE_JPEG_RST_INTERVAL := 4
  1509. Static IMWRITE_JPEG_LUMA_QUALITY := 5
  1510. Static IMWRITE_JPEG_CHROMA_QUALITY := 6
  1511. Static IMWRITE_PNG_COMPRESSION := 16
  1512. Static IMWRITE_PNG_STRATEGY := 17
  1513. Static IMWRITE_PNG_BILEVEL := 18
  1514. Static IMWRITE_PXM_BINARY := 32
  1515. Static IMWRITE_EXR_TYPE := (BitShift(3, -4)) + 0
  1516. Static IMWRITE_EXR_COMPRESSION := (BitShift(3, -4)) + 1
  1517. Static IMWRITE_WEBP_QUALITY := 64
  1518. Static IMWRITE_PAM_TUPLETYPE := 128
  1519. Static IMWRITE_TIFF_RESUNIT := 256
  1520. Static IMWRITE_TIFF_XDPI := 257
  1521. Static IMWRITE_TIFF_YDPI := 258
  1522. Static IMWRITE_TIFF_COMPRESSION := 259
  1523. Static IMWRITE_JPEG2000_COMPRESSION_X1000 := 272
  1524. ; ImwriteEXRTypeFlags
  1525. Static IMWRITE_EXR_TYPE_HALF := 1
  1526. Static IMWRITE_EXR_TYPE_FLOAT := 2
  1527. ; ImwriteEXRCompressionFlags
  1528. Static IMWRITE_EXR_COMPRESSION_NO := 0
  1529. Static IMWRITE_EXR_COMPRESSION_RLE := 1
  1530. Static IMWRITE_EXR_COMPRESSION_ZIPS := 2
  1531. Static IMWRITE_EXR_COMPRESSION_ZIP := 3
  1532. Static IMWRITE_EXR_COMPRESSION_PIZ := 4
  1533. Static IMWRITE_EXR_COMPRESSION_PXR24 := 5
  1534. Static IMWRITE_EXR_COMPRESSION_B44 := 6
  1535. Static IMWRITE_EXR_COMPRESSION_B44A := 7
  1536. Static IMWRITE_EXR_COMPRESSION_DWAA := 8
  1537. Static IMWRITE_EXR_COMPRESSION_DWAB := 9
  1538. ; ImwritePNGFlags
  1539. Static IMWRITE_PNG_STRATEGY_DEFAULT := 0
  1540. Static IMWRITE_PNG_STRATEGY_FILTERED := 1
  1541. Static IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY := 2
  1542. Static IMWRITE_PNG_STRATEGY_RLE := 3
  1543. Static IMWRITE_PNG_STRATEGY_FIXED := 4
  1544. ; ImwritePAMFlags
  1545. Static IMWRITE_PAM_FORMAT_NULL := 0
  1546. Static IMWRITE_PAM_FORMAT_BLACKANDWHITE := 1
  1547. Static IMWRITE_PAM_FORMAT_GRAYSCALE := 2
  1548. Static IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA := 3
  1549. Static IMWRITE_PAM_FORMAT_RGB := 4
  1550. Static IMWRITE_PAM_FORMAT_RGB_ALPHA := 5
  1551. ; VideoCaptureAPIs
  1552. Static CAP_ANY := 0
  1553. Static CAP_VFW := 200
  1554. Static CAP_V4L := 200
  1555. Static CAP_V4L2 := OpenCV.CAP_V4L
  1556. Static CAP_FIREWIRE := 300
  1557. Static CAP_FIREWARE := OpenCV.CAP_FIREWIRE
  1558. Static CAP_IEEE1394 := OpenCV.CAP_FIREWIRE
  1559. Static CAP_DC1394 := OpenCV.CAP_FIREWIRE
  1560. Static CAP_CMU1394 := OpenCV.CAP_FIREWIRE
  1561. Static CAP_QT := 500
  1562. Static CAP_UNICAP := 600
  1563. Static CAP_DSHOW := 700
  1564. Static CAP_PVAPI := 800
  1565. Static CAP_OPENNI := 900
  1566. Static CAP_OPENNI_ASUS := 910
  1567. Static CAP_ANDROID := 1000
  1568. Static CAP_XIAPI := 1100
  1569. Static CAP_AVFOUNDATION := 1200
  1570. Static CAP_GIGANETIX := 1300
  1571. Static CAP_MSMF := 1400
  1572. Static CAP_WINRT := 1410
  1573. Static CAP_INTELPERC := 1500
  1574. Static CAP_REALSENSE := 1500
  1575. Static CAP_OPENNI2 := 1600
  1576. Static CAP_OPENNI2_ASUS := 1610
  1577. Static CAP_OPENNI2_ASTRA := 1620
  1578. Static CAP_GPHOTO2 := 1700
  1579. Static CAP_GSTREAMER := 1800
  1580. Static CAP_FFMPEG := 1900
  1581. Static CAP_IMAGES := 2000
  1582. Static CAP_ARAVIS := 2100
  1583. Static CAP_OPENMJPEG := 2200
  1584. Static CAP_INTEL_MFX := 2300
  1585. Static CAP_XINE := 2400
  1586. Static CAP_UEYE := 2500
  1587. ; VideoCaptureProperties
  1588. Static CAP_PROP_POS_MSEC := 0
  1589. Static CAP_PROP_POS_FRAMES := 1
  1590. Static CAP_PROP_POS_AVI_RATIO := 2
  1591. Static CAP_PROP_FRAME_WIDTH := 3
  1592. Static CAP_PROP_FRAME_HEIGHT := 4
  1593. Static CAP_PROP_FPS := 5
  1594. Static CAP_PROP_FOURCC := 6
  1595. Static CAP_PROP_FRAME_COUNT := 7
  1596. Static CAP_PROP_FORMAT := 8
  1597. Static CAP_PROP_MODE := 9
  1598. Static CAP_PROP_BRIGHTNESS := 10
  1599. Static CAP_PROP_CONTRAST := 11
  1600. Static CAP_PROP_SATURATION := 12
  1601. Static CAP_PROP_HUE := 13
  1602. Static CAP_PROP_GAIN := 14
  1603. Static CAP_PROP_EXPOSURE := 15
  1604. Static CAP_PROP_CONVERT_RGB := 16
  1605. Static CAP_PROP_WHITE_BALANCE_BLUE_U := 17
  1606. Static CAP_PROP_RECTIFICATION := 18
  1607. Static CAP_PROP_MONOCHROME := 19
  1608. Static CAP_PROP_SHARPNESS := 20
  1609. Static CAP_PROP_AUTO_EXPOSURE := 21
  1610. Static CAP_PROP_GAMMA := 22
  1611. Static CAP_PROP_TEMPERATURE := 23
  1612. Static CAP_PROP_TRIGGER := 24
  1613. Static CAP_PROP_TRIGGER_DELAY := 25
  1614. Static CAP_PROP_WHITE_BALANCE_RED_V := 26
  1615. Static CAP_PROP_ZOOM := 27
  1616. Static CAP_PROP_FOCUS := 28
  1617. Static CAP_PROP_GUID := 29
  1618. Static CAP_PROP_ISO_SPEED := 30
  1619. Static CAP_PROP_BACKLIGHT := 32
  1620. Static CAP_PROP_PAN := 33
  1621. Static CAP_PROP_TILT := 34
  1622. Static CAP_PROP_ROLL := 35
  1623. Static CAP_PROP_IRIS := 36
  1624. Static CAP_PROP_SETTINGS := 37
  1625. Static CAP_PROP_BUFFERSIZE := 38
  1626. Static CAP_PROP_AUTOFOCUS := 39
  1627. Static CAP_PROP_SAR_NUM := 40
  1628. Static CAP_PROP_SAR_DEN := 41
  1629. Static CAP_PROP_BACKEND := 42
  1630. Static CAP_PROP_CHANNEL := 43
  1631. Static CAP_PROP_AUTO_WB := 44
  1632. Static CAP_PROP_WB_TEMPERATURE := 45
  1633. Static CAP_PROP_CODEC_PIXEL_FORMAT := 46
  1634. Static CAP_PROP_BITRATE := 47
  1635. Static CAP_PROP_ORIENTATION_META := 48
  1636. Static CAP_PROP_ORIENTATION_AUTO := 49
  1637. Static CAP_PROP_HW_ACCELERATION := 50
  1638. Static CAP_PROP_HW_DEVICE := 51
  1639. Static CAP_PROP_HW_ACCELERATION_USE_OPENCL := 52
  1640. Static CAP_PROP_OPEN_TIMEOUT_MSEC := 53
  1641. Static CAP_PROP_READ_TIMEOUT_MSEC := 54
  1642. Static CAP_PROP_STREAM_OPEN_TIME_USEC := 55
  1643. Static CAP_PROP_VIDEO_TOTAL_CHANNELS := 56
  1644. Static CAP_PROP_VIDEO_STREAM := 57
  1645. Static CAP_PROP_AUDIO_STREAM := 58
  1646. Static CAP_PROP_AUDIO_POS := 59
  1647. Static CAP_PROP_AUDIO_SHIFT_NSEC := 60
  1648. Static CAP_PROP_AUDIO_DATA_DEPTH := 61
  1649. Static CAP_PROP_AUDIO_SAMPLES_PER_SECOND := 62
  1650. Static CAP_PROP_AUDIO_BASE_INDEX := 63
  1651. Static CAP_PROP_AUDIO_TOTAL_CHANNELS := 64
  1652. Static CAP_PROP_AUDIO_TOTAL_STREAMS := 65
  1653. Static CAP_PROP_AUDIO_SYNCHRONIZE := 66
  1654. Static CAP_PROP_LRF_HAS_KEY_FRAME := 67
  1655. Static CAP_PROP_CODEC_EXTRADATA_INDEX := 68
  1656. ; VideoWriterProperties
  1657. Static VIDEOWRITER_PROP_QUALITY := 1
  1658. Static VIDEOWRITER_PROP_FRAMEBYTES := 2
  1659. Static VIDEOWRITER_PROP_NSTRIPES := 3
  1660. Static VIDEOWRITER_PROP_IS_COLOR := 4
  1661. Static VIDEOWRITER_PROP_DEPTH := 5
  1662. Static VIDEOWRITER_PROP_HW_ACCELERATION := 6
  1663. Static VIDEOWRITER_PROP_HW_DEVICE := 7
  1664. Static VIDEOWRITER_PROP_HW_ACCELERATION_USE_OPENCL := 8
  1665. ; VideoAccelerationType
  1666. Static VIDEO_ACCELERATION_NONE := 0
  1667. Static VIDEO_ACCELERATION_ANY := 1
  1668. Static VIDEO_ACCELERATION_D3D11 := 2
  1669. Static VIDEO_ACCELERATION_VAAPI := 3
  1670. Static VIDEO_ACCELERATION_MFX := 4
  1671. ; SolvePnPMethod
  1672. Static SOLVEPNP_ITERATIVE := 0
  1673. Static SOLVEPNP_EPNP := 1
  1674. Static SOLVEPNP_P3P := 2
  1675. Static SOLVEPNP_DLS := 3
  1676. Static SOLVEPNP_UPNP := 4
  1677. Static SOLVEPNP_AP3P := 5
  1678. Static SOLVEPNP_IPPE := 6
  1679. Static SOLVEPNP_IPPE_SQUARE := 7
  1680. Static SOLVEPNP_SQPNP := 8
  1681. Static SOLVEPNP_MAX_COUNT := 8 + 1
  1682. ; HandEyeCalibrationMethod
  1683. Static CALIB_HAND_EYE_TSAI := 0
  1684. Static CALIB_HAND_EYE_PARK := 1
  1685. Static CALIB_HAND_EYE_HORAUD := 2
  1686. Static CALIB_HAND_EYE_ANDREFF := 3
  1687. Static CALIB_HAND_EYE_DANIILIDIS := 4
  1688. ; RobotWorldHandEyeCalibrationMethod
  1689. Static CALIB_ROBOT_WORLD_HAND_EYE_SHAH := 0
  1690. Static CALIB_ROBOT_WORLD_HAND_EYE_LI := 1
  1691. ; SamplingMethod
  1692. Static SAMPLING_UNIFORM := 0
  1693. Static SAMPLING_PROGRESSIVE_NAPSAC := 1
  1694. Static SAMPLING_NAPSAC := 2
  1695. Static SAMPLING_PROSAC := 3
  1696. ; LocalOptimMethod
  1697. Static LOCAL_OPTIM_NULL := 0
  1698. Static LOCAL_OPTIM_INNER_LO := 1
  1699. Static LOCAL_OPTIM_INNER_AND_ITER_LO := 2
  1700. Static LOCAL_OPTIM_GC := 3
  1701. Static LOCAL_OPTIM_SIGMA := 4
  1702. ; ScoreMethod
  1703. Static SCORE_METHOD_RANSAC := 0
  1704. Static SCORE_METHOD_MSAC := 1
  1705. Static SCORE_METHOD_MAGSAC := 2
  1706. Static SCORE_METHOD_LMEDS := 3
  1707. ; NeighborSearchMethod
  1708. Static NEIGH_FLANN_KNN := 0
  1709. Static NEIGH_GRID := 1
  1710. Static NEIGH_FLANN_RADIUS := 2
  1711. ; GridType
  1712. Static CIRCLES_GRID_FINDER_PARAMETERS_SYMMETRIC_GRID := 0
  1713. Static CIRCLES_GRID_FINDER_PARAMETERS_ASYMMETRIC_GRID := 1
  1714. ; anonymous
  1715. Static STEREO_MATCHER_DISP_SHIFT := 4
  1716. Static STEREO_MATCHER_DISP_SCALE := (BitShift(1, -OpenCV.STEREO_MATCHER_DISP_SHIFT))
  1717. ; anonymous
  1718. Static STEREO_BM_PREFILTER_NORMALIZED_RESPONSE := 0
  1719. Static STEREO_BM_PREFILTER_XSOBEL := 1
  1720. ; anonymous
  1721. Static STEREO_SGBM_MODE_SGBM := 0
  1722. Static STEREO_SGBM_MODE_HH := 1
  1723. Static STEREO_SGBM_MODE_SGBM_3WAY := 2
  1724. Static STEREO_SGBM_MODE_HH4 := 3
  1725. ; UndistortTypes
  1726. Static PROJ_SPHERICAL_ORTHO := 0
  1727. Static PROJ_SPHERICAL_EQRECT := 1
  1728. ; anonymous
  1729. Static FISHEYE_CALIB_USE_INTRINSIC_GUESS := BitShift(1, -0)
  1730. Static FISHEYE_CALIB_RECOMPUTE_EXTRINSIC := BitShift(1, -1)
  1731. Static FISHEYE_CALIB_CHECK_COND := BitShift(1, -2)
  1732. Static FISHEYE_CALIB_FIX_SKEW := BitShift(1, -3)
  1733. Static FISHEYE_CALIB_FIX_K1 := BitShift(1, -4)
  1734. Static FISHEYE_CALIB_FIX_K2 := BitShift(1, -5)
  1735. Static FISHEYE_CALIB_FIX_K3 := BitShift(1, -6)
  1736. Static FISHEYE_CALIB_FIX_K4 := BitShift(1, -7)
  1737. Static FISHEYE_CALIB_FIX_INTRINSIC := BitShift(1, -8)
  1738. Static FISHEYE_CALIB_FIX_PRINCIPAL_POINT := BitShift(1, -9)
  1739. Static FISHEYE_CALIB_ZERO_DISPARITY := BitShift(1, -10)
  1740. Static FISHEYE_CALIB_FIX_FOCAL_LENGTH := BitShift(1, -11)
  1741. ; WindowFlags
  1742. Static WINDOW_NORMAL := 0x00000000
  1743. Static WINDOW_AUTOSIZE := 0x00000001
  1744. Static WINDOW_OPENGL := 0x00001000
  1745. Static WINDOW_FULLSCREEN := 1
  1746. Static WINDOW_FREERATIO := 0x00000100
  1747. Static WINDOW_KEEPRATIO := 0x00000000
  1748. Static WINDOW_GUI_EXPANDED := 0x00000000
  1749. Static WINDOW_GUI_NORMAL := 0x00000010
  1750. ; WindowPropertyFlags
  1751. Static WND_PROP_FULLSCREEN := 0
  1752. Static WND_PROP_AUTOSIZE := 1
  1753. Static WND_PROP_ASPECT_RATIO := 2
  1754. Static WND_PROP_OPENGL := 3
  1755. Static WND_PROP_VISIBLE := 4
  1756. Static WND_PROP_TOPMOST := 5
  1757. Static WND_PROP_VSYNC := 6
  1758. ; MouseEventTypes
  1759. Static EVENT_MOUSEMOVE := 0
  1760. Static EVENT_LBUTTONDOWN := 1
  1761. Static EVENT_RBUTTONDOWN := 2
  1762. Static EVENT_MBUTTONDOWN := 3
  1763. Static EVENT_LBUTTONUP := 4
  1764. Static EVENT_RBUTTONUP := 5
  1765. Static EVENT_MBUTTONUP := 6
  1766. Static EVENT_LBUTTONDBLCLK := 7
  1767. Static EVENT_RBUTTONDBLCLK := 8
  1768. Static EVENT_MBUTTONDBLCLK := 9
  1769. Static EVENT_MOUSEWHEEL := 10
  1770. Static EVENT_MOUSEHWHEEL := 11
  1771. ; MouseEventFlags
  1772. Static EVENT_FLAG_LBUTTON := 1
  1773. Static EVENT_FLAG_RBUTTON := 2
  1774. Static EVENT_FLAG_MBUTTON := 4
  1775. Static EVENT_FLAG_CTRLKEY := 8
  1776. Static EVENT_FLAG_SHIFTKEY := 16
  1777. Static EVENT_FLAG_ALTKEY := 32
  1778. ; QtFontWeights
  1779. Static QT_FONT_LIGHT := 25
  1780. Static QT_FONT_NORMAL := 50
  1781. Static QT_FONT_DEMIBOLD := 63
  1782. Static QT_FONT_BOLD := 75
  1783. Static QT_FONT_BLACK := 87
  1784. ; QtFontStyles
  1785. Static QT_STYLE_NORMAL := 0
  1786. Static QT_STYLE_ITALIC := 1
  1787. Static QT_STYLE_OBLIQUE := 2
  1788. ; QtButtonTypes
  1789. Static QT_PUSH_BUTTON := 0
  1790. Static QT_CHECKBOX := 1
  1791. Static QT_RADIOBOX := 2
  1792. Static QT_NEW_BUTTONBAR := 1024
  1793. ; HistogramNormType
  1794. Static HOGDESCRIPTOR_L2Hys := 0
  1795. ; anonymous
  1796. Static HOGDESCRIPTOR_DEFAULT_NLEVELS := 64
  1797. ; DescriptorStorageFormat
  1798. Static HOGDESCRIPTOR_DESCR_FORMAT_COL_BY_COL := 0
  1799. Static HOGDESCRIPTOR_DESCR_FORMAT_ROW_BY_ROW := 1
  1800. ; EncodeMode
  1801. Static QRCODE_ENCODER_MODE_AUTO := -1
  1802. Static QRCODE_ENCODER_MODE_NUMERIC := 1
  1803. Static QRCODE_ENCODER_MODE_ALPHANUMERIC := 2
  1804. Static QRCODE_ENCODER_MODE_BYTE := 4
  1805. Static QRCODE_ENCODER_MODE_ECI := 7
  1806. Static QRCODE_ENCODER_MODE_KANJI := 8
  1807. Static QRCODE_ENCODER_MODE_STRUCTURED_APPEND := 3
  1808. ; CorrectionLevel
  1809. Static QRCODE_ENCODER_CORRECT_LEVEL_L := 0
  1810. Static QRCODE_ENCODER_CORRECT_LEVEL_M := 1
  1811. Static QRCODE_ENCODER_CORRECT_LEVEL_Q := 2
  1812. Static QRCODE_ENCODER_CORRECT_LEVEL_H := 3
  1813. ; ECIEncodings
  1814. Static QRCODE_ENCODER_ECI_UTF8 := 26
  1815. ; DisType
  1816. Static FACE_RECOGNIZER_SF_FR_COSINE := 0
  1817. Static FACE_RECOGNIZER_SF_FR_NORM_L2 := 1
  1818. ; Status
  1819. Static STITCHER_OK := 0
  1820. Static STITCHER_ERR_NEED_MORE_IMGS := 1
  1821. Static STITCHER_ERR_HOMOGRAPHY_EST_FAIL := 2
  1822. Static STITCHER_ERR_CAMERA_PARAMS_ADJUST_FAIL := 3
  1823. ; Mode
  1824. Static STITCHER_PANORAMA := 0
  1825. Static STITCHER_SCANS := 1
  1826. ; anonymous
  1827. Static DETAIL_BLENDER_NO := 0
  1828. Static DETAIL_BLENDER_FEATHER := 1
  1829. Static DETAIL_BLENDER_MULTI_BAND := 2
  1830. ; anonymous
  1831. Static DETAIL_EXPOSURE_COMPENSATOR_NO := 0
  1832. Static DETAIL_EXPOSURE_COMPENSATOR_GAIN := 1
  1833. Static DETAIL_EXPOSURE_COMPENSATOR_GAIN_BLOCKS := 2
  1834. Static DETAIL_EXPOSURE_COMPENSATOR_CHANNELS := 3
  1835. Static DETAIL_EXPOSURE_COMPENSATOR_CHANNELS_BLOCKS := 4
  1836. ; WaveCorrectKind
  1837. Static DETAIL_WAVE_CORRECT_HORIZ := 0
  1838. Static DETAIL_WAVE_CORRECT_VERT := 1
  1839. Static DETAIL_WAVE_CORRECT_AUTO := 2
  1840. ; anonymous
  1841. Static DETAIL_SEAM_FINDER_NO := 0
  1842. Static DETAIL_SEAM_FINDER_VORONOI_SEAM := 1
  1843. Static DETAIL_SEAM_FINDER_DP_SEAM := 2
  1844. ; CostFunction
  1845. Static DETAIL_DP_SEAM_FINDER_COLOR := 0
  1846. Static DETAIL_DP_SEAM_FINDER_COLOR_GRAD := 1
  1847. ; CostType
  1848. Static DETAIL_GRAPH_CUT_SEAM_FINDER_BASE_COST_COLOR := 0
  1849. Static DETAIL_GRAPH_CUT_SEAM_FINDER_BASE_COST_COLOR_GRAD := 1
  1850. ; anonymous
  1851. Static DETAIL_TIMELAPSER_AS_IS := 0
  1852. Static DETAIL_TIMELAPSER_CROP := 1
  1853. ; anonymous
  1854. Static DISOPTICAL_FLOW_PRESET_ULTRAFAST := 0
  1855. Static DISOPTICAL_FLOW_PRESET_FAST := 1
  1856. Static DISOPTICAL_FLOW_PRESET_MEDIUM := 2
  1857. ; MODE
  1858. Static DETAIL_TRACKER_SAMPLER_CSC_MODE_INIT_POS := 1
  1859. Static DETAIL_TRACKER_SAMPLER_CSC_MODE_INIT_NEG := 2
  1860. Static DETAIL_TRACKER_SAMPLER_CSC_MODE_TRACK_POS := 3
  1861. Static DETAIL_TRACKER_SAMPLER_CSC_MODE_TRACK_NEG := 4
  1862. Static DETAIL_TRACKER_SAMPLER_CSC_MODE_DETECT := 5
  1863. ; Kind
  1864. Static GFLUID_KERNEL_KIND_Filter := 0
  1865. Static GFLUID_KERNEL_KIND_Resize := 1
  1866. Static GFLUID_KERNEL_KIND_YUV420toRGB := 2
  1867. ; OpaqueKind
  1868. Static DETAIL_OPAQUE_KIND_UNKNOWN := 0
  1869. Static DETAIL_OPAQUE_KIND_BOOL := 1
  1870. Static DETAIL_OPAQUE_KIND_INT := 2
  1871. Static DETAIL_OPAQUE_KIND_INT64 := 3
  1872. Static DETAIL_OPAQUE_KIND_DOUBLE := 4
  1873. Static DETAIL_OPAQUE_KIND_FLOAT := 5
  1874. Static DETAIL_OPAQUE_KIND_UINT64 := 6
  1875. Static DETAIL_OPAQUE_KIND_STRING := 7
  1876. Static DETAIL_OPAQUE_KIND_POINT := 8
  1877. Static DETAIL_OPAQUE_KIND_POINT2F := 9
  1878. Static DETAIL_OPAQUE_KIND_SIZE := 10
  1879. Static DETAIL_OPAQUE_KIND_RECT := 11
  1880. Static DETAIL_OPAQUE_KIND_SCALAR := 12
  1881. Static DETAIL_OPAQUE_KIND_MAT := 13
  1882. Static DETAIL_OPAQUE_KIND_DRAW_PRIM := 14
  1883. ; GShape
  1884. Static GSHAPE_GMAT := 0
  1885. Static GSHAPE_GSCALAR := 1
  1886. Static GSHAPE_GARRAY := 2
  1887. Static GSHAPE_GOPAQUE := 3
  1888. Static GSHAPE_GFRAME := 4
  1889. ; MediaFormat
  1890. Static MEDIA_FORMAT_BGR := 0
  1891. Static MEDIA_FORMAT_NV12 := 0 + 1
  1892. ; ArgKind
  1893. Static DETAIL_ARG_KIND_OPAQUE_VAL := 0
  1894. Static DETAIL_ARG_KIND_OPAQUE := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL
  1895. Static DETAIL_ARG_KIND_GOBJREF := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 1
  1896. Static DETAIL_ARG_KIND_GMAT := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 2
  1897. Static DETAIL_ARG_KIND_GMATP := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 3
  1898. Static DETAIL_ARG_KIND_GFRAME := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 4
  1899. Static DETAIL_ARG_KIND_GSCALAR := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 5
  1900. Static DETAIL_ARG_KIND_GARRAY := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 6
  1901. Static DETAIL_ARG_KIND_GOPAQUE := OpenCV.DETAIL_ARG_KIND_OPAQUE_VAL + 7
  1902. ; TraitAs
  1903. Static GAPI_IE_TRAIT_AS_TENSOR := 0
  1904. Static GAPI_IE_TRAIT_AS_IMAGE := 1
  1905. ; Kind
  1906. Static GAPI_IE_DETAIL_PARAM_DESC_KIND_Load := 0
  1907. Static GAPI_IE_DETAIL_PARAM_DESC_KIND_Import := 1
  1908. ; TraitAs
  1909. Static GAPI_ONNX_TRAIT_AS_TENSOR := 0
  1910. Static GAPI_ONNX_TRAIT_AS_IMAGE := 1
  1911. ; Access
  1912. Static MEDIA_FRAME_ACCESS_R := 0
  1913. Static MEDIA_FRAME_ACCESS_W := 1
  1914. ; anonymous
  1915. Static GAPI_OWN_DETAIL_MAT_HEADER_AUTO_STEP := 0
  1916. Static GAPI_OWN_DETAIL_MAT_HEADER_TYPE_MASK := 0x00000FFF
  1917. ; Access
  1918. Static RMAT_ACCESS_R := 0
  1919. Static RMAT_ACCESS_W := 1
  1920. ; StereoOutputFormat
  1921. Static GAPI_STEREO_OUTPUT_FORMAT_DEPTH_FLOAT16 := 0
  1922. Static GAPI_STEREO_OUTPUT_FORMAT_DEPTH_FLOAT32 := 1
  1923. Static GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_11_5 := 2
  1924. Static GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_12_4 := 3
  1925. Static GAPI_STEREO_OUTPUT_FORMAT_DEPTH_16F := OpenCV.GAPI_STEREO_OUTPUT_FORMAT_DEPTH_FLOAT16
  1926. Static GAPI_STEREO_OUTPUT_FORMAT_DEPTH_32F := OpenCV.GAPI_STEREO_OUTPUT_FORMAT_DEPTH_FLOAT32
  1927. Static GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_16Q_10_5 := OpenCV.GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_11_5
  1928. Static GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_16Q_11_4 := OpenCV.GAPI_STEREO_OUTPUT_FORMAT_DISPARITY_FIXED16_12_4
  1929. ; OutputType
  1930. Static GAPI_WIP_GST_GSTREAMER_SOURCE_OUTPUT_TYPE_FRAME := 0
  1931. Static GAPI_WIP_GST_GSTREAMER_SOURCE_OUTPUT_TYPE_MAT := 1
  1932. ; AccelType
  1933. Static GAPI_WIP_ONEVPL_ACCEL_TYPE_HOST := 0
  1934. Static GAPI_WIP_ONEVPL_ACCEL_TYPE_DX11 := 1
  1935. Static GAPI_WIP_ONEVPL_ACCEL_TYPE_LAST_VALUE := 0xFF
  1936. ; sync_policy
  1937. Static GAPI_STREAMING_SYNC_POLICY_dont_sync := 0
  1938. Static GAPI_STREAMING_SYNC_POLICY_drop := 1
  1939. ; BackgroundSubtractorType
  1940. Static GAPI_VIDEO_TYPE_BS_MOG2 := 0
  1941. Static GAPI_VIDEO_TYPE_BS_KNN := 1
  1942. ; flann_algorithm_t
  1943. Static FLANN_FLANN_INDEX_LINEAR := 0
  1944. Static FLANN_FLANN_INDEX_KDTREE := 1
  1945. Static FLANN_FLANN_INDEX_KMEANS := 2
  1946. Static FLANN_FLANN_INDEX_COMPOSITE := 3
  1947. Static FLANN_FLANN_INDEX_KDTREE_SINGLE := 4
  1948. Static FLANN_FLANN_INDEX_HIERARCHICAL := 5
  1949. Static FLANN_FLANN_INDEX_LSH := 6
  1950. Static FLANN_FLANN_INDEX_SAVED := 254
  1951. Static FLANN_FLANN_INDEX_AUTOTUNED := 255
  1952. Static FLANN_LINEAR := 0
  1953. Static FLANN_KDTREE := 1
  1954. Static FLANN_KMEANS := 2
  1955. Static FLANN_COMPOSITE := 3
  1956. Static FLANN_KDTREE_SINGLE := 4
  1957. Static FLANN_SAVED := 254
  1958. Static FLANN_AUTOTUNED := 255
  1959. ; flann_centers_Init_t
  1960. Static FLANN_FLANN_CENTERS_RANDOM := 0
  1961. Static FLANN_FLANN_CENTERS_GONZALES := 1
  1962. Static FLANN_FLANN_CENTERS_KMEANSPP := 2
  1963. Static FLANN_FLANN_CENTERS_GROUPWISE := 3
  1964. Static FLANN_CENTERS_RANDOM := 0
  1965. Static FLANN_CENTERS_GONZALES := 1
  1966. Static FLANN_CENTERS_KMEANSPP := 2
  1967. ; flann_log_level_t
  1968. Static FLANN_FLANN_LOG_NONE := 0
  1969. Static FLANN_FLANN_LOG_FATAL := 1
  1970. Static FLANN_FLANN_LOG_ERROR := 2
  1971. Static FLANN_FLANN_LOG_WARN := 3
  1972. Static FLANN_FLANN_LOG_INFO := 4
  1973. ; flann_distance_t
  1974. Static FLANN_FLANN_DIST_EUCLIDEAN := 1
  1975. Static FLANN_FLANN_DIST_L2 := 1
  1976. Static FLANN_FLANN_DIST_MANHATTAN := 2
  1977. Static FLANN_FLANN_DIST_L1 := 2
  1978. Static FLANN_FLANN_DIST_MINKOWSKI := 3
  1979. Static FLANN_FLANN_DIST_MAX := 4
  1980. Static FLANN_FLANN_DIST_HIST_INTERSECT := 5
  1981. Static FLANN_FLANN_DIST_HELLINGER := 6
  1982. Static FLANN_FLANN_DIST_CHI_SQUARE := 7
  1983. Static FLANN_FLANN_DIST_CS := 7
  1984. Static FLANN_FLANN_DIST_KULLBACK_LEIBLER := 8
  1985. Static FLANN_FLANN_DIST_KL := 8
  1986. Static FLANN_FLANN_DIST_HAMMING := 9
  1987. Static FLANN_FLANN_DIST_DNAMMING := 10
  1988. Static FLANN_EUCLIDEAN := 1
  1989. Static FLANN_MANHATTAN := 2
  1990. Static FLANN_MINKOWSKI := 3
  1991. Static FLANN_MAX_DIST := 4
  1992. Static FLANN_HIST_INTERSECT := 5
  1993. Static FLANN_HELLINGER := 6
  1994. Static FLANN_CS := 7
  1995. Static FLANN_KL := 8
  1996. Static FLANN_KULLBACK_LEIBLER := 8
  1997. ; flann_datatype_t
  1998. Static FLANN_FLANN_INT8 := 0
  1999. Static FLANN_FLANN_INT16 := 1
  2000. Static FLANN_FLANN_INT32 := 2
  2001. Static FLANN_FLANN_INT64 := 3
  2002. Static FLANN_FLANN_UINT8 := 4
  2003. Static FLANN_FLANN_UINT16 := 5
  2004. Static FLANN_FLANN_UINT32 := 6
  2005. Static FLANN_FLANN_UINT64 := 7
  2006. Static FLANN_FLANN_FLOAT32 := 8
  2007. Static FLANN_FLANN_FLOAT64 := 9
  2008. ; anonymous
  2009. Static FLANN_FLANN_CHECKS_UNLIMITED := -1
  2010. Static FLANN_FLANN_CHECKS_AUTOTUNED := -2
  2011. Static AFFINEFEATURE_Init()
  2012. {
  2013. AffineFeature := ComObject("OpenCV.CV.AFFINEFEATURE")
  2014. Return AffineFeature
  2015. }
  2016. Static AGASTFEATUREDETECTOR_Init()
  2017. {
  2018. AgastFeatureDetector := ComObject("OpenCV.CV.AGASTFEATUREDETECTOR")
  2019. Return AgastFeatureDetector
  2020. }
  2021. Static ALGORITHM_Init()
  2022. {
  2023. Algorithm := ComObject("OpenCV.CV.ALGORITHM")
  2024. Return Algorithm
  2025. }
  2026. Static BFMATCHER_Init()
  2027. {
  2028. BFMatcher := ComObject("OpenCV.CV.BFMATCHER")
  2029. Return BFMatcher
  2030. }
  2031. Static BOWIMGDESCRIPTOREXTRACTOR_Init()
  2032. {
  2033. BOWImgDescriptorExtractor := ComObject("OpenCV.CV.BOWIMGDESCRIPTOREXTRACTOR")
  2034. Return BOWImgDescriptorExtractor
  2035. }
  2036. Static BRISK_Init()
  2037. {
  2038. Brisk := ComObject("OpenCV.CV.BRISK")
  2039. Return Brisk
  2040. }
  2041. Static CASCADECLASSIFIER_Init()
  2042. {
  2043. CascadeClassifier := ComObject("OpenCV.CV.CASCADECLASSIFIER")
  2044. Return CascadeClassifier
  2045. }
  2046. Static Crop(Img, Pos)
  2047. {
  2048. CV := OpenCV.CV_Init()
  2049. Mat := OpenCV.MAT_Init()
  2050. Img := Mat.Create(Img, Pos)
  2051. Return Img
  2052. }
  2053. Static CUDA_Init()
  2054. {
  2055. Cuda := ComObject("OpenCV.CV.CUDA")
  2056. Return Cuda
  2057. }
  2058. Static CUDABUFFERPOOL_Init()
  2059. {
  2060. CudaBufferPool := ComObject("OpenCV.CV.CUDA.BUFFERPOOL")
  2061. Return CudaBufferPool
  2062. }
  2063. Static CUDAGPUMAT_Init()
  2064. {
  2065. CudaGpuMat := ComObject("OpenCV.CV.CUDA.GPUMAT")
  2066. Return CudaGpuMat
  2067. }
  2068. Static CUDAGPUMATND_Init()
  2069. {
  2070. CudaGpuMatND := ComObject("OpenCV.CV.CUDA.GPUMATND")
  2071. Return CudaGpuMatND
  2072. }
  2073. Static CUDAHOSTMEM_Init()
  2074. {
  2075. CudaHostMem := ComObject("OpenCV.CV.CUDA.CUDAHOSTMEM")
  2076. Return CudaHostMem
  2077. }
  2078. Static CUDATARGETARCHS_Init()
  2079. {
  2080. CudaTargetArchs := ComObject("OpenCV.CV.CUDA.TARGETARCHS")
  2081. Return CudaTargetArchs
  2082. }
  2083. Static CV_Init()
  2084. {
  2085. CV := ComObject("OpenCV.CV")
  2086. Return CV
  2087. }
  2088. Static DESCRIPTORMATCHER_Init()
  2089. {
  2090. Matcher := ComObject("OpenCV.CV.DESCRIPTORMATCHER")
  2091. Return Matcher
  2092. }
  2093. Static DMATCH_Init()
  2094. {
  2095. DMatch := ComObject("OpenCV.CV.DMATCH")
  2096. Return DMatch
  2097. }
  2098. Static DNN_Init()
  2099. {
  2100. Dnn := ComObject("OpenCV.CV.DNN")
  2101. Return Dnn
  2102. }
  2103. Static FASTFEATUREDETECTOR_Init()
  2104. {
  2105. Fast := ComObject("OpenCV.CV.FASTFEATUREDETECTOR")
  2106. Return Fast
  2107. }
  2108. Static FILESTORAGE_Init()
  2109. {
  2110. FS := ComObject("OpenCV.CV.FILESTORAGE")
  2111. Return FS
  2112. }
  2113. Static FLANN_Init()
  2114. {
  2115. Flann := ComObject("OpenCV.CV.FLANN")
  2116. Return Flann
  2117. }
  2118. Static FLANNBASEDMATCHER_Init()
  2119. {
  2120. FlannBasedMatcher := ComObject("OpenCV.CV.FLANNBASEDMATCHER")
  2121. Return FlannBasedMatcher
  2122. }
  2123. Static FORMATTER_Init()
  2124. {
  2125. Formatter := ComObject("OpenCV.CV.FORMATTER")
  2126. Return Formatter
  2127. }
  2128. Static GENERALIZEDHOUGHGUIL_Init()
  2129. {
  2130. GeneralizedHoughGuil := ComObject("OpenCV.CV.GENERALIZEDHOUGHGUIL")
  2131. Return GeneralizedHoughGuil
  2132. }
  2133. Static GFTTDETECTOR_Init()
  2134. {
  2135. GFTTDetector := ComObject("OpenCV.CV.GFTTDETECTOR")
  2136. Return GFTTDetector
  2137. }
  2138. Static LINESEGMENTDETECTOR_Init()
  2139. {
  2140. LineSegmentDetector := ComObject("OpenCV.CV.LINESEGMENTDETECTOR")
  2141. Return LineSegmentDetector
  2142. }
  2143. Static KAZE_Init()
  2144. {
  2145. Kaze := ComObject("OpenCV.CV.KAZE")
  2146. Return Kaze
  2147. }
  2148. Static KEYPOINT_Init()
  2149. {
  2150. KeyPoint := ComObject("OpenCV.CV.KEYPOINT")
  2151. Return KeyPoint
  2152. }
  2153. Static KNN_Init()
  2154. {
  2155. Knn := ComObject("OpenCV.CV.ML.KNEAREST")
  2156. Return Knn
  2157. }
  2158. Static MAT_Init()
  2159. {
  2160. Frame := ComObject("OpenCV.CV.MAT")
  2161. Return Frame
  2162. }
  2163. Static ML_Init()
  2164. {
  2165. Ml := ComObject("OpenCV.CV.ML")
  2166. Return Ml
  2167. }
  2168. Static OCL_Init()
  2169. {
  2170. Ocl := ComObject("OpenCV.CV.OCL")
  2171. Return Ocl
  2172. }
  2173. Static OCLDEVICE_Init()
  2174. {
  2175. OclDevice := ComObject("OpenCV.CV.OCL.DEVICE")
  2176. Return OclDevice
  2177. }
  2178. Static OCLKERNELARG_Init()
  2179. {
  2180. OclKernelArg := ComObject("OpenCV.CV.OCL.KERNELARG")
  2181. Return OclKernelArg
  2182. }
  2183. Static OCLOPENCLEXECUTIONCONTEXT_Init()
  2184. {
  2185. OCLOpenCLExecutionContext := ComObject("OpenCV.CV.OCL.OPENCLEXECUTIONCONTEXT")
  2186. Return OCLOpenCLExecutionContext
  2187. }
  2188. Static ORB_Init()
  2189. {
  2190. Orb := ComObject("OpenCV.CV.ORB")
  2191. Return Orb
  2192. }
  2193. Static PCA_Init()
  2194. {
  2195. Pca := ComObject("OpenCV.CV.PCA")
  2196. Return Pca
  2197. }
  2198. Static QRCODEDETECTOR_Init()
  2199. {
  2200. QRCodeDetector := ComObject("OpenCV.CV.QRCODEDETECTOR")
  2201. Return QRCodeDetector
  2202. }
  2203. Static RANGE_Init()
  2204. {
  2205. Range := ComObject("OpenCV.CV.RANGE")
  2206. Return Range
  2207. }
  2208. Static Resize(Img, Width := -1, Height := -1)
  2209. {
  2210. OpenCV.init()
  2211. CV := OpenCV.init()
  2212. if Width == -1
  2213. Sizew := 1
  2214. else
  2215. Sizew := Width / Img.Cols()
  2216. if Height == -1
  2217. Sizeh := 1
  2218. else
  2219. Sizeh := Height / Img.Rows()
  2220. Resized := CV.resize(Img, ComArrayMake([]), Sizew, Sizeh)
  2221. Return Resized
  2222. }
  2223. Static RNG_Init()
  2224. {
  2225. Rng := ComObject("OpenCV.CV.RNG")
  2226. Return Rng
  2227. }
  2228. Static ROTATEDRECT_Init()
  2229. {
  2230. RotatedRect := ComObject("OpenCV.CV.ROTATEDRECT")
  2231. Return RotatedRect
  2232. }
  2233. Static SIFT_Init()
  2234. {
  2235. Sift := ComObject("OpenCV.CV.SIFT")
  2236. Return Sift
  2237. }
  2238. Static SIMPLEBLOBDETECTOR_Init()
  2239. {
  2240. SimpleBlobDetector := ComObject("OpenCV.CV.SIMPLEBLOBDETECTOR")
  2241. Return SimpleBlobDetector
  2242. }
  2243. Static SIMPLEBLOBDETECTOR_PARAMS_Init()
  2244. {
  2245. SimpleBlobDetector_Params := ComObject("OpenCV.CV.SIMPLEBLOBDETECTOR.PARAMS")
  2246. Return SimpleBlobDetector_Params
  2247. }
  2248. Static SPARSEMAT_Init()
  2249. {
  2250. SparseMat := ComObject("OpenCV.CV.SPARSEMAT")
  2251. Return SparseMat
  2252. }
  2253. Static STATMODEL_Init()
  2254. {
  2255. StatModel := ComObject("OpenCV.CV.ML.STATMODEL")
  2256. Return StatModel
  2257. }
  2258. Static SUBDIV2D_Init()
  2259. {
  2260. Subdiv2D := ComObject("OpenCV.CV.SUBDIV2D")
  2261. Return Subdiv2D
  2262. }
  2263. Static SVD_Init()
  2264. {
  2265. Svd := ComObject("OpenCV.CV.ML.SVD")
  2266. Return Svd
  2267. }
  2268. Static SVM_Init()
  2269. {
  2270. Svm := ComObject("OpenCV.CV.ML.SVM")
  2271. Return Svm
  2272. }
  2273. Static TermCriteria(type, maxCount, epsilon)
  2274. {
  2275. criteria := ComObject("OpenCV.CV.TERMCRITERIA")
  2276. criteria.type := type
  2277. criteria.maxCount := maxCount
  2278. criteria.epsilon := epsilon
  2279. Return criteria
  2280. }
  2281. Static TERMCRITERIA_Init()
  2282. {
  2283. criteria := ComObject("OpenCV.CV.TERMCRITERIA")
  2284. Return criteria
  2285. }
  2286. Static TICKMETER_Init()
  2287. {
  2288. TickMeter := ComObject("OpenCV.CV.TICKMETER")
  2289. Return TickMeter
  2290. }
  2291. Static UMAT_Init()
  2292. {
  2293. UMat := ComObject("OpenCV.CV.UMAT")
  2294. Return UMat
  2295. }
  2296. Static UMATDATA_Init()
  2297. {
  2298. UMatData := ComObject("OpenCV.CV.UMATDATA")
  2299. Return UMatData
  2300. }
  2301. Static VECTOROFPOINT_Init()
  2302. {
  2303. pts := ComObject("OpenCV.VECTOROFPOINT")
  2304. Return pts
  2305. }
  2306. Static VIDEOCAPTURE_Init()
  2307. {
  2308. Cap := ComObject("OpenCV.CV.VIDEOCAPTURE")
  2309. Return Cap
  2310. }
  2311. Static VIDEOWRITER_Init()
  2312. {
  2313. Out := ComObject("OpenCV.CV.VIDEOWRITER")
  2314. Return Out
  2315. }
  2316. Static VIDEOWRITER_Fourcc_Init(Lst_Codec*)
  2317. {
  2318. Out := ComObject("OpenCV.CV.VIDEOWRITER")
  2319. if Lst_Codec.Length !== 4
  2320. Return 0
  2321. else
  2322. {
  2323. Codec := Out.fourcc(Ord(Lst_Codec[1]), Ord(Lst_Codec[2]), Ord(Lst_Codec[3]), Ord(Lst_Codec[4]))
  2324. Return Codec
  2325. }
  2326. }
  2327. }
  2328. BitAND(value1, value2)
  2329. {
  2330. Return value1 & value2
  2331. }
  2332. BitNOT(Value)
  2333. {
  2334. Return ~Value
  2335. }
  2336. BitOR(Value1, Value2)
  2337. {
  2338. Return Value1 | Value2
  2339. }
  2340. BitShift(Value, Shift)
  2341. {
  2342. Return Shift < 0 ? Value << -Shift : Value >> Shift
  2343. }
  2344. BitXOR(Value1, Value2)
  2345. {
  2346. Return Value1 ^ Value2
  2347. }
  2348. ComArrayMake(InputArray)
  2349. {
  2350. if Type(InputArray) == "ComObjArray"
  2351. Return InputArray
  2352. Arr := ComObjArray(VT_VARIANT := 12, InputArray.Length)
  2353. Loop InputArray.Length
  2354. {
  2355. if Type(InputArray[A_Index]) == "Array"
  2356. Arr[A_Index - 1] := ComArrayMake(InputArray[A_Index])
  2357. else
  2358. Arr[A_Index - 1] := InputArray[A_Index]
  2359. }
  2360. Return Arr
  2361. }
  2362. OpencvAHK_Char(Char)
  2363. {
  2364. Return Ord(Char)
  2365. }
  2366. OpencvAHK_Bool(InputBool)
  2367. {
  2368. ComValue(0XB, InputBool == True ? -1 : 0)
  2369. }
  2370. OpencvAHK_ConstPointConst(InputArray)
  2371. {
  2372. pts := CV2.VectorOfpoint_Init()
  2373. Loop InputArray.Length()
  2374. {
  2375. pts.Push_Back(ComArrayMake(InputArray[A_Index]))
  2376. }
  2377. Return pts
  2378. }
  2379. OpencvAHK_ConstScalar(InputArray)
  2380. {
  2381. Return ComArrayMake(InputArray)
  2382. }
  2383. OpencvAHK_Double(Number)
  2384. {
  2385. NumPut("Double", fps := Number, Temp := Buffer(8))
  2386. Return fps := NumGet(Temp, "Double")
  2387. }
  2388. OpencvAHK_Point(InputArray)
  2389. {
  2390. Return ComArrayMake(InputArray)
  2391. }
  2392. OpencvAHK_OutputArray()
  2393. {
  2394. Return CV2.MAT_Init()
  2395. }
  2396. OpencvAHK_Size(InputArray)
  2397. {
  2398. Return ComArrayMake(InputArray)
  2399. }
  2400. Class CV2 Extends OpenCV
  2401. {
  2402. Static CV := OpenCV.CV_Init()
  2403. Static None := None()
  2404. Static Absdiff(src1, src2)
  2405. {
  2406. dst := this.MAT()
  2407. tomat(dst, this.CV.Absdiff(src1.MAT, src2.MAT))
  2408. Return dst
  2409. }
  2410. Static AdaptiveThreshold(src, maxValue, adaptiveMethod := CV2.CV_ADAPTIVE_THRESH_MEAN_C, thresholdType := CV2.CV_THRESH_BINARY, blockSize := 3, param1 := 5)
  2411. {
  2412. dst := this.MAT()
  2413. if Mod(blockSize, 2) == 0
  2414. blockSize += 1
  2415. if (src.channels() == 3)
  2416. src := cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
  2417. tomat(dst, this.CV.AdaptiveThreshold(src.MAT, maxValue, adaptiveMethod, thresholdType, blockSize, param1))
  2418. Return dst
  2419. }
  2420. Static Add(src1, src2)
  2421. {
  2422. dst := this.MAT()
  2423. tomat(dst, this.CV.Add(src1.MAT, src2.MAT))
  2424. Return dst
  2425. }
  2426. Static AddWeighted(src1, alpha, src2, beta, gamma)
  2427. {
  2428. dst := this.MAT()
  2429. tomat(dst, this.CV.AddWeighted(src1.MAT, alpha, src2.MAT, beta, gamma))
  2430. Return dst
  2431. }
  2432. Static AdjustGamma(src, gamma := 1)
  2433. {
  2434. invGamma := 1 / gamma
  2435. table := CV2.MAT(1, 256, CV2.CV_8U)
  2436. Loop 256
  2437. {
  2438. table.At[0, A_Index - 1] := (((A_Index - 1) / 255.0) ** invGamma) * 255
  2439. }
  2440. Return CV2.LUT(src, table)
  2441. }
  2442. Static ApplyColorMap(src, colormap)
  2443. {
  2444. dst := this.MAT()
  2445. tomat(dst, this.CV.ApplyColorMap(src.MAT, colormap))
  2446. Return dst
  2447. }
  2448. Static BilateralFilter(src, d, sigmaColor, sigmaSpace, borderType := CV2.BORDER_DEFAULT)
  2449. {
  2450. dst := this.MAT()
  2451. tomat(dst, this.CV.BilateralFilter(src.MAT, d, sigmaColor, sigmaSpace, borderType))
  2452. Return dst
  2453. }
  2454. Static Bitwise_And(src1, src2, dst, mask := noArray())
  2455. {
  2456. this.CV.Bitwise_And(src1.MAT, src2.MAT, mask.MAT, dst.MAT)
  2457. tomat(dst, dst.MAT)
  2458. Return dst
  2459. }
  2460. Static Bitwise_Not(src, dst, mask := noArray())
  2461. {
  2462. this.CV.Bitwise_Not(src.MAT, mask.MAT, dst.MAT)
  2463. tomat(dst, dst.MAT)
  2464. Return dst
  2465. }
  2466. Static Bitwise_Or(src1, src2, dst, mask := noArray())
  2467. {
  2468. this.CV.Bitwise_Or(src1.MAT, src2.MAT, mask.MAT, dst.MAT)
  2469. tomat(dst, dst.MAT)
  2470. Return dst
  2471. }
  2472. Static Bitwise_Xor(src1, src2, dst, mask := noArray())
  2473. {
  2474. this.CV.Bitwise_Xor(src1.MAT, src2.MAT, mask.MAT, dst.MAT)
  2475. tomat(dst, dst.MAT)
  2476. Return dst
  2477. }
  2478. Static Blur(src, ksize, anchor := [-1, -1], borderType := CV2.BORDER_DEFAULT)
  2479. {
  2480. ksize := ComArrayMake(ksize)
  2481. anchor := ComArrayMake(anchor)
  2482. dst := this.MAT()
  2483. tomat(dst, this.CV.Blur(src.MAT, ksize, anchor, borderType))
  2484. Return dst
  2485. }
  2486. Static CascadeClassifier(addr := "")
  2487. {
  2488. faceCascade := this.Classifier()
  2489. if !addr
  2490. faceCascade.Classifier := CV2.CascadeClassifier_Init()
  2491. else
  2492. {
  2493. faceCascade.Classifier := CV2.CascadeClassifier_Init()
  2494. faceCascade.Classifier.load(addr)
  2495. }
  2496. Return faceCascade
  2497. }
  2498. Static Canny(image, threshold1, threshold2, apertureSize := 3, L2gradient := False)
  2499. {
  2500. threshold1 := (threshold1 is Array) ? threshold1[1] : threshold1
  2501. threshold2 := (threshold2 is Array) ? threshold2[1] : threshold2
  2502. L2gradient := OpencvAHK_Bool(L2gradient)
  2503. edges := noArray()
  2504. this.CV.Canny(image.MAT, threshold1, threshold2, edges.MAT, apertureSize)
  2505. tomat(edges, edges.MAT)
  2506. Return edges
  2507. }
  2508. Static Circle(img, center, radius, color, thickness := 1, lineType := CV2.LINE_8, shift := 0)
  2509. {
  2510. center := ComArrayMake(center)
  2511. color := ComArrayMake(color)
  2512. this.CV.Circle(img.MAT, center, radius, color, thickness, lineType, shift)
  2513. Return img
  2514. }
  2515. Static Close(binaryImage, ksize, kernelMode)
  2516. {
  2517. element := cv2.getStructuringElement(kernelMode, [ksize, ksize])
  2518. dst := cv2.morphologyEx(binaryImage, 3, element)
  2519. Return dst
  2520. }
  2521. Static ContourArea(contour, oriented := False)
  2522. {
  2523. oriented := OpencvAHK_Bool(oriented)
  2524. Return this.CV.ContourArea(contour, oriented)
  2525. }
  2526. Static CopyMakeBorder(src, top, bottom, left, right, borderType, value := [])
  2527. {
  2528. value := ComArrayMake(value)
  2529. dst := this.MAT()
  2530. tomat(dst, this.CV.CopyMakeBorder(src.MAT, top, bottom, left, right, borderType, value))
  2531. Return dst
  2532. }
  2533. Static CreateTrackbar(trackbarname, winname, value, count, onChange := 0)
  2534. {
  2535. if !onChange
  2536. onChange := temp
  2537. tmp := Buffer(8)
  2538. tmpChange := CallbackCreate(onChange, "CDecl")
  2539. DllCall("opencv_world455.dll\cvCreateTrackbar", "Astr", trackbarname, "Astr", winname, "ptr", tmp, "int", count, "ptr", tmpChange)
  2540. temp(*)
  2541. {
  2542. Return
  2543. }
  2544. }
  2545. Static CvtColor(src, code, dstCn := noArray())
  2546. {
  2547. dst := this.MAT()
  2548. tomat(dst, this.CV.CvtColor(src.MAT, code, dstCn.MAT))
  2549. Return dst
  2550. }
  2551. Static DestroyAllWindows()
  2552. {
  2553. this.CV.DestroyAllWindows()
  2554. }
  2555. Static DestroyWindow(wname)
  2556. {
  2557. this.CV.DestroyWindow(wname)
  2558. }
  2559. Static Dft(src, flage := 0, nonzeroRow := 0)
  2560. {
  2561. dst := this.MAT()
  2562. tomat(dst, this.CV.Dft(src.MAT, flage, nonzeroRow))
  2563. Return dst
  2564. }
  2565. Static Dilate(src, kernel, anchor := [-1, -1], iterations := 0, BorderTypes := CV2.BORDER_CONSTANT)
  2566. {
  2567. anchor := ComArrayMake(anchor)
  2568. dst := this.MAT()
  2569. tomat(dst, this.CV.Dilate(src.MAT, kernel.MAT, anchor, iterations, BorderTypes))
  2570. Return dst
  2571. }
  2572. Static DistanceTransform(src, distanceType, maskSize, dstType := CV2.CV_32F)
  2573. {
  2574. dst := this.MAT()
  2575. tomat(dst, this.CV.DistanceTransform(src.MAT, distanceType, maskSize, dstType))
  2576. Return dst
  2577. }
  2578. Static Divide(src1, src2)
  2579. {
  2580. dst := this.MAT()
  2581. tomat(dst, this.CV.Divide(src1.MAT, src2.MAT))
  2582. Return dst
  2583. }
  2584. Static DrawContours(image, contours, contourIdx, color, thickness := 1, lineType := 8, hierarchy := CV2.MAT())
  2585. {
  2586. contours := ComArrayMake(contours)
  2587. color := ComArrayMake(color)
  2588. this.CV.DrawContours(image.MAT, contours, contourIdx, color, thickness, lineType, hierarchy.MAT)
  2589. Return image
  2590. }
  2591. Static DrawKeypoints(image, keypoints, outImage, color := [-1, -1, -1], flags := CV2.DRAW_MATCHES_FLAGS_DEFAULT)
  2592. {
  2593. color := ComArrayMake(color)
  2594. this.CV.DrawKeypoints(image.MAT, keypoints, outImage.MAT, color, flags)
  2595. tomat(outImage, outImage.MAT)
  2596. Return outImage
  2597. }
  2598. Static Ellipse(img, center, axes, angle, startAngle, endAngle, color, thickness := 1, lineType := CV2.LINE_8, shift := 0)
  2599. {
  2600. center := ComArrayMake(center)
  2601. axes := ComArrayMake(axes)
  2602. color := ComArrayMake(color)
  2603. this.CV.Ellipse(img.MAT, center, axes, angle, startAngle, endAngle, color, thickness, lineType, shift)
  2604. Return img
  2605. }
  2606. Static EqualizeHist(src)
  2607. {
  2608. dst := this.MAT()
  2609. tomat(dst, this.CV.EqualizeHist(src.MAT))
  2610. Return dst
  2611. }
  2612. Static Erode(src, kernel, anchor := [-1, -1], iterations := 0, BorderTypes := CV2.BORDER_CONSTANT)
  2613. {
  2614. anchor := ComArrayMake(anchor)
  2615. dst := this.MAT()
  2616. tomat(dst, this.CV.Erode(src.MAT, kernel.MAT, anchor, iterations, BorderTypes))
  2617. Return dst
  2618. }
  2619. Static FastNlMeansDenoisingColored(src, h := 3, hColor := 3, templateWindowSize := 7, searchWindowSize := 21)
  2620. {
  2621. dst := noArray()
  2622. this.CV.FastNlMeansDenoisingColored(src.MAT, dst.MAT, h, hColor, templateWindowSize, searchWindowSize)
  2623. tomat(dst, dst.MAT)
  2624. Return dst
  2625. }
  2626. Static FillPoly(img, pts, color, lineType := CV2.LINE_8, shift := 0, offset := [])
  2627. {
  2628. pts := ComArrayMake([pts.MAT])
  2629. color := ComArrayMake(color)
  2630. offset := ComArrayMake(offset)
  2631. dst := this.MAT()
  2632. tomat(dst, this.CV.FillPoly(img.MAT, pts, color, lineType, shift, offset))
  2633. Return dst
  2634. }
  2635. Static Filter2D(src, ddepth, kernel, anchor := [-1, -1], delta := 0, BorderTypes := CV2.BORDER_DEFAULT)
  2636. {
  2637. anchor := ComArrayMake(anchor)
  2638. dst := this.MAT()
  2639. tomat(dst, this.CV.Filter2D(src.MAT, ddepth, kernel.MAT, anchor, delta, BorderTypes))
  2640. Return dst
  2641. }
  2642. Static FindContours(image, mode, method)
  2643. {
  2644. contours := this.CV.FindContours(image.MAT, mode, method)
  2645. hierarchy := this.MAT()
  2646. tomat(hierarchy, this.CV.extended()[1])
  2647. Return [contours, hierarchy]
  2648. }
  2649. Static Flip(img, flipcode)
  2650. {
  2651. imgflip := this.MAT()
  2652. tomat(imgflip, this.CV.Flip(img.MAT, flipcode))
  2653. Return imgflip
  2654. }
  2655. Static GaussianBlur(src, ksize, sigmaX, sigmaY := 0, borderType := CV2.BORDER_DEFAULT)
  2656. {
  2657. ksize := ComArrayMake(ksize)
  2658. dst := this.MAT()
  2659. tomat(dst, this.CV.GaussianBlur(src.MAT, ksize, sigmaX, sigmaY, borderType))
  2660. Return dst
  2661. }
  2662. Static GetNumThreads()
  2663. {
  2664. Return this.CV.GetNumThreads()
  2665. }
  2666. Static GetOptimalDFTSize(vecsize)
  2667. {
  2668. Return this.CV.GetOptimalDFTSize(vecsize)
  2669. }
  2670. Static GetRotationMatrix2D(center, angle, scale)
  2671. {
  2672. center := ComArrayMake(center)
  2673. dst := this.MAT()
  2674. tomat(dst, this.CV.GetRotationMatrix2D(center, angle, scale))
  2675. Return dst
  2676. }
  2677. Static GetStructuringElement(shape, ksize, anchor := [-1, -1])
  2678. {
  2679. ksize := ComArrayMake(ksize)
  2680. anchor := ComArrayMake(anchor)
  2681. kernel := this.MAT()
  2682. tomat(kernel, this.CV.GetStructuringElement(shape, ksize, anchor))
  2683. Return kernel
  2684. }
  2685. Static GetTextSize(text, fontFace, fontScale, thickness)
  2686. {
  2687. retval := CV2.CV.GetTextSize(text, fontFace, fontScale, thickness)
  2688. baseLine := CV2.CV.extended()[1]
  2689. Return [retval, baseLine]
  2690. }
  2691. Static GetTickCount()
  2692. {
  2693. Return this.CV.GetTickCount()
  2694. }
  2695. Static GetTickFrequency()
  2696. {
  2697. Return this.CV.GetTickFrequency()
  2698. }
  2699. Static GetTrackbarPos(trackbarname, winname)
  2700. {
  2701. Return this.CV.GetTrackbarPos(trackbarname, winname)
  2702. }
  2703. Static HConcat(arr)
  2704. {
  2705. Loop arr.Length
  2706. arr[A_Index] := arr[A_Index].MAT
  2707. dst := this.MAT()
  2708. tomat(dst, this.CV.HConcat(ComArrayMake(arr)))
  2709. Return dst
  2710. }
  2711. Static HoughLines(image, rho, theta, threshold, srn := 0, stn := 0)
  2712. {
  2713. lines := this.MAT()
  2714. tomat(lines, this.CV.HoughLines(image.MAT, rho, theta, threshold, srn, stn))
  2715. Return lines
  2716. }
  2717. Static HoughLinesP(image, rho, theta, threshold, minLineLegth := 0, maxLineGap := 0)
  2718. {
  2719. lines := this.MAT()
  2720. tomat(lines, this.CV.HoughLinesP(image.MAT, rho, theta, threshold, minLineLegth, maxLineGap))
  2721. Return lines
  2722. }
  2723. Static Imdecode(buf, flags)
  2724. {
  2725. retval := this.MAT()
  2726. tomat(retval, this.CV.Imdecode(buf, flags))
  2727. Return retval
  2728. }
  2729. Static Imencode(ext, img, params := [])
  2730. {
  2731. params := ComArrayMake(params)
  2732. retval := this.CV.Imencode(ext, img.MAT, params)
  2733. buf := this.CV.extended()[1]
  2734. Return [retval, buf]
  2735. }
  2736. Static Imread(filepath, flags := CV2.IMREAD_COLOR)
  2737. {
  2738. img := this.MAT()
  2739. tomat(img, this.CV.Imread(filepath, flags))
  2740. Return img
  2741. }
  2742. Static Imshow(wname, img := "")
  2743. {
  2744. if !img
  2745. {
  2746. img := wname
  2747. wname := "Default"
  2748. }
  2749. this.CV.Imshow(wname, img.MAT)
  2750. }
  2751. Static Imwrite(file, img, num := -1)
  2752. {
  2753. if !InStr(file, ":")
  2754. file := A_ScriptDir "/" file
  2755. this.CV.Imwrite(file, img.MAT)
  2756. }
  2757. Static Inpaint(src, inpaintMask, inpaintRadius, flags)
  2758. {
  2759. dst := this.MAT()
  2760. tomat(dst, this.CV.Inpaint(src.MAT, inpaintMask.MAT, inpaintRadius, flags))
  2761. Return dst
  2762. }
  2763. Static InRange(src, lowerb, upperb)
  2764. {
  2765. lowerb := ComArrayMake(lowerb)
  2766. upperb := ComArrayMake(upperb)
  2767. dst := this.MAT()
  2768. tomat(dst, this.CV.InRange(src.MAT, lowerb, upperb))
  2769. Return dst
  2770. }
  2771. Static Invert(src, flags := CV2.DECOMP_LU)
  2772. {
  2773. dst := this.MAT()
  2774. tomat(dst, this.CV.Invert(src.MAT, flags))
  2775. Return dst
  2776. }
  2777. Static Laplacian(src, ddepth, ksize := 1, scale := 1, delta := 0, borderType := CV2.BORDER_DEFAULT)
  2778. {
  2779. dst := this.MAT()
  2780. tomat(dst, this.CV.Laplacian(src.MAT, ddepth, ksize, scale, delta, borderType))
  2781. Return dst
  2782. }
  2783. Static Line(img, pt1, pt2, color, thickness := 1, lineType := CV2.LINE_8, shift := 0)
  2784. {
  2785. pt1 := ComArrayMake(pt1)
  2786. pt2 := ComArrayMake(pt2)
  2787. color := ComArrayMake(color)
  2788. this.CV.Line(img.MAT, pt1, pt2, color, thickness, lineType, shift)
  2789. Return img
  2790. }
  2791. Static Log(src)
  2792. {
  2793. dst := this.MAT()
  2794. tomat(dst, this.CV.Log(src.MAT))
  2795. Return dst
  2796. }
  2797. Static LUT(src, lut)
  2798. {
  2799. dst := this.MAT()
  2800. tomat(dst, this.CV.LUT(src.MAT, lut.MAT))
  2801. Return dst
  2802. }
  2803. Static Magnitude(x, y)
  2804. {
  2805. magnitude := this.MAT()
  2806. tomat(magnitude, this.CV.Magnitude(x.MAT, y.MAT))
  2807. Return magnitude
  2808. }
  2809. Static MAT_(param*)
  2810. {
  2811. if !param.Length
  2812. {
  2813. MAT_ := CV2.MAT()
  2814. MAT_.MAT := CV2.MAT_Init()
  2815. Return MAT_
  2816. }
  2817. else
  2818. {
  2819. x := 0
  2820. y := 0
  2821. flag := (param[1] * param[2] == param.Length - 2) || (param[3] is Array)
  2822. index := flag ? 2 : 3
  2823. cvtype := (index == 2) ? CV2.CV_8UC1 : param[3]
  2824. MAT_ := CV2.MAT()
  2825. MAT_.MAT := CV2.MAT_Init().Create(param[1], param[2], cvtype)
  2826. MAT_.Shape := [MAT_.MAT.Rows, MAT_.MAT.Cols, MAT_.MAT.Channels]
  2827. MAT_.At := CV2.MAT.At(MAT_)
  2828. if param[index + 1] is Array
  2829. {
  2830. Loop param[index + 1].Length
  2831. {
  2832. if y == param[2]
  2833. {
  2834. y := 0
  2835. x++
  2836. }
  2837. MAT_.At[x, y++] := param[index + 1][A_Index]
  2838. }
  2839. }
  2840. else
  2841. {
  2842. Loop param.Length - index
  2843. {
  2844. if y == param[2]
  2845. {
  2846. y := 0
  2847. x++
  2848. }
  2849. MAT_.At[x, y++] := param[A_Index + index]
  2850. }
  2851. }
  2852. tomat(MAT_, MAT_.MAT)
  2853. Return MAT_
  2854. }
  2855. }
  2856. Static MeanStdDev(src, mask := noArray())
  2857. {
  2858. mean := this.MAT()
  2859. stddev := this.MAT()
  2860. this.CV.MeanStdDev(src.MAT, mask.MAT)
  2861. tomat(mean, this.CV.extended()[0])
  2862. tomat(stddev, this.CV.extended()[1])
  2863. Return [mean, stddev]
  2864. }
  2865. Static MedianBlur(src, ksize)
  2866. {
  2867. dst := this.MAT()
  2868. tomat(dst, this.CV.MedianBlur(src.MAT, ksize))
  2869. Return dst
  2870. }
  2871. Static Merge(mv)
  2872. {
  2873. Loop mv.Length
  2874. mv[A_Index] := mv[A_Index].MAT
  2875. dst := this.MAT()
  2876. tomat(dst, this.CV.Merge(ComArrayMake(mv)))
  2877. Return dst
  2878. }
  2879. Static MinMaxLoc(src, mask := noArray())
  2880. {
  2881. this.CV.MinMaxLoc(src.MAT, mask.MAT)
  2882. min_val := this.CV.extended()[0]
  2883. max_val := this.CV.extended()[1]
  2884. min_loc := this.CV.extended()[2]
  2885. max_loc := this.CV.extended()[3]
  2886. Return [min_val, max_val, min_loc, max_loc]
  2887. }
  2888. Static MorphologyEx(src, op, kernel, anchor := [-1, -1], iterations := 1, borderType := cv2.BORDER_CONSTANT, borderValue := [])
  2889. {
  2890. anchor := ComArrayMake(anchor)
  2891. borderValue := ComArrayMake(borderValue)
  2892. dst := this.MAT()
  2893. this.CV.MorphologyEx(src.MAT, op, kernel.MAT, dst.MAT, anchor, iterations, borderType, borderValue)
  2894. tomat(dst, dst.MAT)
  2895. Return dst
  2896. }
  2897. Static Multiply(src1, src2)
  2898. {
  2899. dst := this.MAT()
  2900. tomat(dst, this.CV.Multiply(src1.MAT, src2.MAT))
  2901. Return dst
  2902. }
  2903. Static MoveWindow(winname, x, y)
  2904. {
  2905. this.CV.MoveWindow(winname, x, y)
  2906. }
  2907. Static NamedWindow(name, flags := 0)
  2908. {
  2909. this.CV.NamedWindow(name, flags)
  2910. }
  2911. Static Normalize(src, dst, alpha := 1, beta := 0, norm_type := CV2.NORM_L2, dtype := -1)
  2912. {
  2913. this.CV.Normalize(src.MAT, dst.MAT, alpha, beta, norm_type, dtype)
  2914. tomat(dst, dst.MAT)
  2915. Return dst
  2916. }
  2917. Static Open(binaryImage, ksize, kernelMode)
  2918. {
  2919. element := cv2.getStructuringElement(kernelMode, [ksize, ksize])
  2920. dst := cv2.morphologyEx(binaryImage, 2, element)
  2921. Return dst
  2922. }
  2923. Static Otsu(src)
  2924. {
  2925. gray := cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
  2926. tmp := cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
  2927. Return tmp
  2928. }
  2929. Static Point(args*)
  2930. {
  2931. Return ComArrayMake(args)
  2932. }
  2933. Static Polylines(img, pts, flags, color, lineType := CV2.LINE_8, shift := 0, offset := [])
  2934. {
  2935. pts := ComArrayMake([pts.MAT])
  2936. flags := OpencvAHK_Bool(flags)
  2937. color := ComArrayMake(color)
  2938. dst := this.MAT()
  2939. tomat(dst, this.CV.Polylines(img.MAT, pts, flags, color, lineType, shift, offset))
  2940. Return dst
  2941. }
  2942. Static PutText(image, text, org, font, fontScale, color, thickness := 1, lineType := CV2.LINE_8)
  2943. {
  2944. org := ComArrayMake(org)
  2945. color := ComArrayMake(color)
  2946. this.CV.PutText(image.MAT, text, org, font, fontScale, color, thickness, lineType)
  2947. tomat(image, image.MAT)
  2948. Return image
  2949. }
  2950. Static QRCodeDetector()
  2951. {
  2952. qrcode := this.Detector.QRCode()
  2953. qrcode.qrcode := CV2.QRCodeDetector_Init()
  2954. Return qrcode
  2955. }
  2956. Static Randu(src, low, high)
  2957. {
  2958. if low is Integer || low is Float
  2959. low := ComArrayMake([low])
  2960. else
  2961. low := ComArrayMake(low)
  2962. if high is Integer || high is Float
  2963. high := ComArrayMake([high])
  2964. else
  2965. high := ComArrayMake(high)
  2966. dst := this.MAT()
  2967. tomat(dst, this.CV.Randu(src.MAT, low, high))
  2968. Return dst
  2969. }
  2970. Static Rect(args*)
  2971. {
  2972. Return ComArrayMake(args)
  2973. }
  2974. Static Rectangle(img, pt1, pt2, color, thickness := 1, lineType := 8, shift := 0)
  2975. {
  2976. pt1 := ComArrayMake(pt1)
  2977. pt2 := ComArrayMake(pt2)
  2978. color := ComArrayMake(color)
  2979. this.CV.Rectangle(img.MAT, pt1, pt2, color, thickness, lineType, shift)
  2980. Return img
  2981. }
  2982. Static Resize(src, dsize, fx := 0, fy := 0, interpolation := CV2.INTER_LINEAR)
  2983. {
  2984. if InStr(fx, "interpolation")
  2985. {
  2986. interpolation := Integer(Trim(StrSplit(fx, "=")[2]))
  2987. fx := 0
  2988. }
  2989. dsize := ComArrayMake(dsize)
  2990. dst := this.MAT()
  2991. tomat(dst, this.CV.Resize(src.MAT, dsize, fx, fy, interpolation))
  2992. Return dst
  2993. }
  2994. Static SetMouseCallback(winname, onMouse, userdata := 0)
  2995. {
  2996. if !onMouse
  2997. onMouse := temp
  2998. ;if userdata
  2999. ;tmpdata := ObjPtrAddRef(userdata)
  3000. tmpMouse := CallbackCreate(onMouse)
  3001. DllCall("opencv_world455.dll\cvSetMouseCallback", "Astr", winname, "ptr", tmpMouse, "ptr", 0)
  3002. temp(*)
  3003. {
  3004. Return
  3005. }
  3006. }
  3007. Static SetNumThreads(nthreads)
  3008. {
  3009. this.CV.SetNumThreads(nthreads)
  3010. }
  3011. Static SetTrackbarPos(trackbarname, winname, pos)
  3012. {
  3013. this.CV.SetTrackbarPos(trackbarname, winname, pos)
  3014. }
  3015. Static SetUseOptimized(bool)
  3016. {
  3017. this.CV.SetUseOptimized(OpencvAHK_Bool(bool))
  3018. }
  3019. Static SetWindowProperty(winname, prop_id, prop_value)
  3020. {
  3021. this.CV.SetWindowProperty(winname, prop_id, prop_value)
  3022. }
  3023. Static Size(args*)
  3024. {
  3025. Return ComArrayMake(args)
  3026. }
  3027. Static Sobel(src, ddepth, dx, dy, ksize := 3, scale := 1, delta := 0, borderType := CV2.BORDER_DEFAULT)
  3028. {
  3029. dst := this.MAT()
  3030. tomat(dst, this.CV.Sobel(src.MAT, ddepth, dx, dy, ksize, scale, delta, borderType))
  3031. Return dst
  3032. }
  3033. Static Sobel_X(src, ksize := 3)
  3034. {
  3035. dst := this.MAT()
  3036. tomat(dst, this.CV.Sobel(src.MAT, cv2.CV_64F, 1, 0, ksize))
  3037. Return dst
  3038. }
  3039. Static Sobel_Y(src, ksize := 3)
  3040. {
  3041. dst := this.MAT()
  3042. tomat(dst, this.CV.Sobel(src.MAT, cv2.CV_64F, 0, 1, ksize))
  3043. Return dst
  3044. }
  3045. Static Sobel_XY(src, ksize := 3)
  3046. {
  3047. sobel_x := cv2.Sobel_X(src, ksize)
  3048. sobel_y := cv2.Sobel_Y(src, ksize)
  3049. dst := this.MAT()
  3050. tomat(dst, cv2.addWeighted(sobel_x, 0.5, sobel_y, 0.5, 0))
  3051. Return dst
  3052. }
  3053. Static Split(m)
  3054. {
  3055. mv := this.CV.Split(m.MAT)
  3056. mvl := []
  3057. Loop mv.MaxIndex() + 1
  3058. {
  3059. tmp := this.MAT()
  3060. tomat(tmp, mv[A_Index - 1])
  3061. mvl.Push(tmp)
  3062. }
  3063. Return mvl
  3064. }
  3065. Static StartWindowThread()
  3066. {
  3067. Return this.CV.StartWindowThread()
  3068. }
  3069. Static Subtract(src1, src2)
  3070. {
  3071. dst := this.MAT()
  3072. tomat(dst, this.CV.Subtract(src1.MAT, src2.MAT))
  3073. Return dst
  3074. }
  3075. Static Threshold(src, thresh, maxval, type)
  3076. {
  3077. dst := this.MAT()
  3078. ret := this.CV.Threshold(src.MAT, thresh, maxval, type)
  3079. tomat(dst, this.CV.extended()[1])
  3080. Return [ret, dst]
  3081. }
  3082. Static UseOptimized()
  3083. {
  3084. Return this.CV.UseOptimized()
  3085. }
  3086. Static VConcat(arr)
  3087. {
  3088. Loop arr.Length
  3089. arr[A_Index] := arr[A_Index].MAT
  3090. dst := this.MAT()
  3091. tomat(dst, this.CV.VConcat(ComArrayMake(arr)))
  3092. Return dst
  3093. }
  3094. Static VideoCapture(video := "")
  3095. {
  3096. Cap := this.Video()
  3097. Cap.Video := CV2.VideoCapture_Init()
  3098. if video !== ""
  3099. Cap.Video.Open(video)
  3100. Return Cap
  3101. }
  3102. Static VideoWriter(filename, fourcc, fps, frame_size)
  3103. {
  3104. video := this.Video()
  3105. video.Video := CV2.VideoWriter_Init()
  3106. frame_size := ComArrayMake(frame_size)
  3107. video.Video.Open(filename, fourcc, fps, frame_size)
  3108. Return video
  3109. }
  3110. Static VideoWriter_fourcc(Lst_Codec*)
  3111. {
  3112. Return CV2.VideoWriter_Fourcc_Init(Lst_Codec*)
  3113. }
  3114. Static WaitKey(num := 0)
  3115. {
  3116. Return CV2.CV.WaitKey(num)
  3117. }
  3118. Static WarpAffine(src, M, dsize, flags := CV2.INTER_LINEAR, borderMode := CV2.BORDER_CONSTANT, borderValue := [])
  3119. {
  3120. dsize := ComArrayMake(dsize)
  3121. borderValue := ComArrayMake(borderValue)
  3122. dst := this.MAT()
  3123. this.CV.WarpAffine(src.MAT, M.MAT, dsize, dst.MAT, flags, borderMode, borderValue)
  3124. tomat(dst, dst.MAT)
  3125. Return dst
  3126. }
  3127. Class Classifier
  3128. {
  3129. detectMultiScale(image, scaleFactor := 1.1, minNeighbors := 3, flags := 0, minSize := [], maxSize := [])
  3130. {
  3131. minSize := ComArrayMake(minSize)
  3132. maxSize := ComArrayMake(maxSize)
  3133. Return this.Classifier.detectMultiScale(image.MAT, scaleFactor, minNeighbors, flags, minSize, maxSize)
  3134. }
  3135. }
  3136. Class Detector
  3137. {
  3138. Class QRCode
  3139. {
  3140. detectAndDecode(img)
  3141. {
  3142. this.qrcode.detectAndDecode(img.MAT)
  3143. Ret := []
  3144. Loop 3
  3145. Ret.Push(CV2.CV.extended()[A_Index - 1])
  3146. Return Ret
  3147. }
  3148. }
  3149. }
  3150. Class MAT
  3151. {
  3152. __New(param*)
  3153. {
  3154. if !param.Length
  3155. {
  3156. this.MAT := CV2.MAT_Init()
  3157. Return this
  3158. }
  3159. else if Type(param[1]) == "CV2.MAT"
  3160. {
  3161. this.MAT := param[1].MAT
  3162. Return this
  3163. }
  3164. else
  3165. {
  3166. While param.Length < 4
  3167. param.Push(0)
  3168. if Type(param[-1]) == "Array"
  3169. param[-1] := ComArrayMake(param[-1])
  3170. else
  3171. param[-1] := ComArrayMake([param[-1]])
  3172. tomat(this, CV2.MAT_Init().Create(param[1], param[2], param[3], param[-1]))
  3173. Return this
  3174. }
  3175. }
  3176. __Item[size*]
  3177. {
  3178. Get => this.GetMethod(this, size)
  3179. Set => ROIMethod(this, size, value)
  3180. }
  3181. Clone()
  3182. {
  3183. imgclone := CV2.MAT()
  3184. tomat(imgclone, this.MAT.Clone())
  3185. Return imgclone
  3186. }
  3187. Col(column)
  3188. {
  3189. imgcol := CV2.MAT()
  3190. tomat(imgcol, this.MAT.Col(column))
  3191. Return imgcol
  3192. }
  3193. Copy()
  3194. {
  3195. imgcopy := CV2.MAT()
  3196. tomat(imgcopy, this.MAT.Copy())
  3197. Return imgcopy
  3198. }
  3199. Copyto(dst, mask := 0)
  3200. {
  3201. if !HasProp(dst, "MAT")
  3202. dst.MAT := CV2.MAT_Init()
  3203. if !mask
  3204. this.MAT.Copyto(dst.MAT)
  3205. else
  3206. this.MAT.Copyto(dst.MAT, mask.MAT)
  3207. tomat(dst, dst.MAT)
  3208. Return dst
  3209. }
  3210. ConvertTo(rtype, alpha := 1, beta := 0)
  3211. {
  3212. dst := noArray()
  3213. this.MAT.ConvertTo(rtype, dst.MAT, alpha, beta)
  3214. tomat(dst, dst.MAT)
  3215. Return dst
  3216. }
  3217. Empty()
  3218. {
  3219. Return this.MAT.Empty()
  3220. }
  3221. GetMethod(src, size)
  3222. {
  3223. size := ComArrayMake(size)
  3224. dst := CV2.MAT()
  3225. dst.MAT := (src.Cols == size[2] && src.Rows == size[3]) ? src.MAT : CV2.Crop(src.MAT, size)
  3226. tomat(dst, dst.MAT)
  3227. Return dst
  3228. }
  3229. isContinuous()
  3230. {
  3231. Return this.MAT.isContinuous()
  3232. }
  3233. Reshape(cn, rows := 0)
  3234. {
  3235. dst := CV2.MAT()
  3236. tomat(dst, this.MAT.Reshape(cn, rows))
  3237. Return dst
  3238. }
  3239. Row(rowing)
  3240. {
  3241. imgrow := CV2.MAT()
  3242. tomat(imgrow, this.MAT.Row(rowing))
  3243. Return imgrow
  3244. }
  3245. SetMethod(src, size, value)
  3246. {
  3247. NewCols := Array()
  3248. x := size[1]
  3249. y := size[2]
  3250. Width := size[3]
  3251. Height := size[4]
  3252. cropw := (value.Cols > src.Cols - x) ? src.Cols - x : value.Cols
  3253. croph := (value.Rows > src.Rows - y) ? src.Rows - y : value.Rows
  3254. value := value[0, 0, cropw, croph]
  3255. Loop src.Cols
  3256. {
  3257. index := A_Index - 1
  3258. if A_Index - 1 < x || A_Index > width + x
  3259. NewCols.Push(src.Col(A_Index - 1).MAT)
  3260. else
  3261. {
  3262. tmpRows := Array()
  3263. Loop src.Rows
  3264. {
  3265. if A_Index - 1 < y || A_Index > height + y
  3266. tmpRows.Push(src.Col(index).MAT.Row(A_Index - 1))
  3267. else
  3268. tmpRows.Push(value.Col(index - x).MAT.Row(A_Index - 1 - y))
  3269. }
  3270. NewCols.Push(CV2.CV.vconcat(ComArrayMake(tmpRows)))
  3271. }
  3272. }
  3273. src.MAT := CV2.CV.hconcat(ComArrayMake(NewCols))
  3274. }
  3275. SetTo(value, mask := 0)
  3276. {
  3277. value := ComArrayMake(value)
  3278. if !mask
  3279. this.MAT.SetTo(value)
  3280. else
  3281. this.MAT.SetTo(value, mask.MAT)
  3282. }
  3283. T()
  3284. {
  3285. dst := CV2.MAT()
  3286. tomat(dst, this.MAT.T())
  3287. Return dst
  3288. }
  3289. Static Zeros(rows, cols, type := -1)
  3290. {
  3291. src := CV2.MAT()
  3292. if type !== -1
  3293. src.MAT := CV2.MAT_Init().Zeros(rows, cols, type)
  3294. else
  3295. src.MAT := CV2.MAT_Init().Zeros(ComArrayMake(rows), cols)
  3296. tomat(src, src.MAT)
  3297. Return src
  3298. }
  3299. Static Eye(rows, cols, type := -1)
  3300. {
  3301. src := CV2.MAT()
  3302. if type !== -1
  3303. src.MAT := CV2.MAT_Init().Eye(rows, cols, type)
  3304. else
  3305. src.MAT := CV2.MAT_Init().Eye(ComArrayMake(rows), cols)
  3306. tomat(src, src.MAT)
  3307. Return src
  3308. }
  3309. Static Ones(rows, cols, type := -1)
  3310. {
  3311. src := CV2.MAT()
  3312. if type !== -1
  3313. src.MAT := CV2.MAT_Init().Ones(rows, cols, type)
  3314. else
  3315. src.MAT := CV2.MAT_Init().Ones(ComArrayMake(rows), cols)
  3316. tomat(src, src.MAT)
  3317. Return src
  3318. }
  3319. Class At
  3320. {
  3321. __New(MAT)
  3322. {
  3323. this.At := MAT
  3324. }
  3325. __Item[x, y]
  3326. {
  3327. Get => this.At.MAT.At[x, y]
  3328. Set => this.SetMethod(x, y, value)
  3329. }
  3330. SetMethod(x, y, value)
  3331. {
  3332. if Type(value) == "Array"
  3333. value := ComArrayMake(value)
  3334. else
  3335. value := ComArrayMake([value])
  3336. CV := CV2.CV_Init()
  3337. dst := CV2.MAT_Init().Create(1, 1, this.At.MAT.type, value)
  3338. width := this.At.shape[1]
  3339. height := this.At.shape[2]
  3340. changerow := this.At.MAT.Col(y)
  3341. Row_Array := Array()
  3342. Col_Array := Array()
  3343. Loop width
  3344. {
  3345. if A_Index - 1 == x
  3346. Row_Array.Push(dst)
  3347. else
  3348. Row_Array.Push(changerow.Row(A_Index - 1))
  3349. }
  3350. changerow := CV.vconcat(ComArrayMake(Row_Array))
  3351. Loop height
  3352. {
  3353. if A_Index - 1 == y
  3354. Col_Array.Push(changerow)
  3355. else
  3356. Col_Array.Push(this.At.MAT.Col(A_Index - 1))
  3357. }
  3358. this.At.MAT := CV.hconcat(ComArrayMake(Col_Array))
  3359. }
  3360. }
  3361. }
  3362. Class ML
  3363. {
  3364. Class SVM
  3365. {
  3366. GetUncompressedSupportVectors()
  3367. {
  3368. Return this.svm.GetUncompressedSupportVectors()
  3369. }
  3370. Predict(samples, flags := 0)
  3371. {
  3372. dst := noArray()
  3373. this.svm.Predict(samples.MAT, dst.MAT, flags)
  3374. tomat(dst, dst.MAT)
  3375. Return dst
  3376. }
  3377. SetC(val)
  3378. {
  3379. this.svm.SetC(val)
  3380. }
  3381. SetGamma(val)
  3382. {
  3383. this.svm.SetGamma(val)
  3384. }
  3385. SetKernel(kernelType)
  3386. {
  3387. this.svm.SetKernel(kernelType)
  3388. }
  3389. SetTermCriteria(val*)
  3390. {
  3391. if val.Length == 3
  3392. this.svm.SetTermCriteria(CV2.TermCriteria(val*))
  3393. else
  3394. this.svm.SetTermCriteria(val[1])
  3395. }
  3396. SetType(val)
  3397. {
  3398. this.svm.SetType(val)
  3399. }
  3400. Train(trainingDataMat, ROW_SAMPLE, labelsMat)
  3401. {
  3402. Return this.svm.Train(trainingDataMat.MAT, ROW_SAMPLE, labelsMat.MAT)
  3403. }
  3404. TrainAuto(samples, layout, responses, kFold, Cgrid, gammaGrid, pGrid, nuGrid, coeffGrid, degreeGrid, balanced)
  3405. {
  3406. }
  3407. Static Create()
  3408. {
  3409. svm := CV2.ML.SVM()
  3410. svm.svm := CV2.SVM_Init().Create()
  3411. Return svm
  3412. }
  3413. Static Load(svm_file)
  3414. {
  3415. svm := CV2.ML.SVM()
  3416. svm.svm := CV2.SVM_Init().Load(svm_file)
  3417. Return svm
  3418. }
  3419. }
  3420. }
  3421. Class UMAT
  3422. {
  3423. GetMAT(flags)
  3424. {
  3425. dst := CV2.MAT()
  3426. tomat(dst, this.MAT.GetMAT(flags))
  3427. Return dst
  3428. }
  3429. }
  3430. Class Video
  3431. {
  3432. Get(propId := "")
  3433. {
  3434. if !propId
  3435. this.Video.Get()
  3436. Return this.Video.Get(propId)
  3437. }
  3438. Grab()
  3439. {
  3440. Return this.Video.Grab()
  3441. }
  3442. Open(video)
  3443. {
  3444. this.Video.Open(video)
  3445. }
  3446. Read()
  3447. {
  3448. Frame := CV2.MAT()
  3449. Frame.MAT := CV2.MAT_Init()
  3450. Ret := this.Video.Read(Frame.MAT)
  3451. tomat(Frame, Frame.MAT)
  3452. Return [Ret, Frame]
  3453. }
  3454. Release()
  3455. {
  3456. Try
  3457. this.Video.Release()
  3458. }
  3459. Retrieve()
  3460. {
  3461. Frame := CV2.MAT()
  3462. Retval := this.Video.Retrieve()
  3463. tomat(Frame, CV2.CV.extended()[1])
  3464. Return [Retval, Frame]
  3465. }
  3466. Set(propId, value)
  3467. {
  3468. Return this.Video.Set(propId, value)
  3469. }
  3470. Write(frame)
  3471. {
  3472. this.Video.Write(frame.MAT)
  3473. }
  3474. }
  3475. }
  3476. Class None
  3477. {
  3478. }
  3479. DllCall("QueryPerformanceFrequency", "Int64*", &CLOCKS_PER_SEC := 0)
  3480. clock()
  3481. {
  3482. DllCall("QueryPerformanceCounter", "Int64*", &Time := 0)
  3483. Return Time
  3484. }
  3485. getCurrentDirectory()
  3486. {
  3487. Return A_ScriptDir
  3488. }
  3489. int(num)
  3490. {
  3491. Return Integer(num)
  3492. }
  3493. input(Prompt := "")
  3494. {
  3495. InputObj := InputBox(Prompt)
  3496. if InputObj.Result == "Cancel" || InputObj.Result == "Timeout"
  3497. Return -1
  3498. else
  3499. Return InputObj.Value
  3500. }
  3501. isinstance(object, classinfo)
  3502. {
  3503. if Type(object) == "CV2.MAT"
  3504. object := object.MAT
  3505. Return object is classinfo
  3506. }
  3507. len(Object)
  3508. {
  3509. if Type(Object) == "String"
  3510. Return StrLen(Object)
  3511. else if Type(Object) == "Array"
  3512. Return Object.Length
  3513. else if Type(Object) == "Map"
  3514. Return Object.Count
  3515. else if Type(Object) == "ComObjArray"
  3516. Return Object.MaxIndex + 1
  3517. else if Type(Object) == "Counter"
  3518. Return Object.Content.Count
  3519. else if Type(Object) == "Numahk.NDArray"
  3520. Return Object.array.Length
  3521. else if Type(Object) == "Object"
  3522. Return ObjOwnPropCount(Object)
  3523. }
  3524. lpcstr(pszSound)
  3525. {
  3526. Return FileRead(pszSound, "RAW")
  3527. }
  3528. lstClone(Lst)
  3529. {
  3530. tmp := []
  3531. if !(Lst is Array)
  3532. Return Lst
  3533. For i in Lst
  3534. {
  3535. if i is Array
  3536. tmp.Push(lstclone(i))
  3537. else
  3538. tmp.Push(i)
  3539. }
  3540. Return tmp
  3541. }
  3542. matToBitmap(img)
  3543. {
  3544. if img.MAT.depth !== cv2.CV_8U
  3545. MsgBox "Unable to Change"
  3546. if img.MAT.channels == 1
  3547. img := cv2.cvtcolor(img, cv2.COLOR_GRAY2BGRA)
  3548. else if img.MAT.channels == 3
  3549. img := cv2.cvtcolor(img, cv2.COLOR_BGR2BGRA)
  3550. si := Buffer(A_PtrSize = 8 ? 24 : 16, 0)
  3551. NumPut("UInt", 1, si, 0)
  3552. DllCall("gdiplus\GdiplusStartup", "Ptr*", &pToken := 0, "Ptr", si, "Ptr", 0)
  3553. DllCall("gdiplus\GdipCreateBitmapFromScan0", "Int", img.Cols, "Int", img.Rows, "Int", img.Step1, "Int", 2498570, "Ptr", img.data, "Ptr*", &pBitmap := 0)
  3554. Return pBitmap
  3555. }
  3556. multiple(Lst, Number)
  3557. {
  3558. tmp := lstclone(Lst)
  3559. Loop Number - 1
  3560. {
  3561. For i in tmp
  3562. Lst.Push(lstclone(i))
  3563. }
  3564. Return Lst
  3565. }
  3566. noArray(uflag := 0)
  3567. {
  3568. if uflag
  3569. {
  3570. dst := cv2.UMAT()
  3571. dst.MAT := cv2.UMAT_Init()
  3572. }
  3573. else
  3574. {
  3575. dst := cv2.MAT()
  3576. dst.MAT := cv2.MAT_Init()
  3577. }
  3578. Return dst
  3579. }
  3580. ; fdwSound
  3581. NULL := 0x00
  3582. SND_ASYNC := 0x01
  3583. SND_LOOP := 0x08
  3584. SND_MEMORY := 0x04
  3585. SND_NODEFAULT := 0x02
  3586. SND_NOSTOP := 0x10
  3587. SND_SYNC := 0x00
  3588. SND_NOWAIT := 0x002000
  3589. SND_ALIAS := 0x010000
  3590. SND_ALIAS_ID := 0x110000
  3591. SND_FILENAME := 0x020000
  3592. SND_RESOURCE := 0x040004
  3593. SND_PURGE := 0x40
  3594. SND_APPLICATION := 0x80
  3595. playSound(pszSound, hmod, fdwSound)
  3596. {
  3597. if pszSound is String
  3598. pszSound := FileRead(pszSound, "RAW")
  3599. DllCall("winmm.dll\PlaySound","Ptr", pszSound, "UInt", hmod, "UInt", fdwSound)
  3600. }
  3601. point(args*)
  3602. {
  3603. Return ComArrayMake(args)
  3604. }
  3605. printc(args*)
  3606. {
  3607. str := ""
  3608. For i in args
  3609. str .= i
  3610. MsgBox str
  3611. }
  3612. printf(fs, args*)
  3613. {
  3614. MsgBox sprintf(fs, args*)
  3615. }
  3616. rand()
  3617. {
  3618. Return Random(0, 32767)
  3619. }
  3620. range(start, stop)
  3621. {
  3622. tmp := []
  3623. loop stop - start
  3624. tmp.push(start + A_Index - 1)
  3625. return tmp
  3626. }
  3627. roiMethod(src, size, value)
  3628. {
  3629. NewCols := ComObjArray(VT_VARIANT := 12, src.Cols)
  3630. x := size[1]
  3631. y := size[2]
  3632. Width := size[3]
  3633. Height := size[4]
  3634. cropw := (value.Cols > src.Cols - x) ? src.Cols - x : value.Cols
  3635. croph := (value.Rows > src.Rows - y) ? src.Rows - y : value.Rows
  3636. value.MAT := value[0, 0, cropw, croph].MAT
  3637. Loop src.Cols
  3638. {
  3639. index := A_Index - 1
  3640. if A_Index - 1 < x || A_Index > width + x
  3641. NewCols[A_Index - 1] := src.Col(A_Index - 1).MAT
  3642. else
  3643. {
  3644. tmpRows := ComObjArray(VT_VARIANT := 12, src.Rows)
  3645. Loop src.Rows
  3646. {
  3647. if A_Index - 1 < y || A_Index > height + y
  3648. tmpRows[A_Index - 1] := src.Col(index).MAT.Row(A_Index - 1)
  3649. else
  3650. tmpRows[A_Index - 1] := value.Col(index - x).MAT.Row(A_Index - 1 - y)
  3651. }
  3652. NewCols[A_Index - 1] := CV2.CV.vconcat(tmpRows)
  3653. }
  3654. }
  3655. src.MAT := CV2.CV.hconcat(NewCols)
  3656. }
  3657. scalar(args*)
  3658. {
  3659. Return ComArrayMake(args)
  3660. }
  3661. GWL_EXSTYLE := -20
  3662. GWL_HINSTANCE := -6
  3663. GWL_HWNDPARENT := -8
  3664. GWL_ID := -12
  3665. GWL_STYLE := -16
  3666. GWL_USERDATA := -21
  3667. GWL_WNDPROC := -4
  3668. DWL_DLGPROC := 4
  3669. DWL_MSGRESULT := 0
  3670. DWL_USER := 8
  3671. WS_EX_ACCEPTFILES := 0x00000010
  3672. WS_EX_APPWINDOW := 0x00040000
  3673. WS_EX_CLIENTEDGE := 0x00000200
  3674. WS_EX_COMPOSITED := 0x02000000
  3675. WS_EX_CONTEXTHELP := 0x00000400
  3676. WS_EX_CONTROLPARENT := 0x00010000
  3677. WS_EX_DLGMODALFRAME := 0x00000001
  3678. WS_EX_LAYERED := 0x00080000
  3679. WS_EX_LAYOUTRTL := 0x00400000
  3680. WS_EX_LEFT := 0x00000000
  3681. WS_EX_LEFTSCROLLBAR := 0x00004000
  3682. WS_EX_LTRREADING := 0x00000000
  3683. WS_EX_MDICHILD := 0x00000040
  3684. WS_EX_NOACTIVATE := 0x08000000
  3685. WS_EX_NOINHERITLAYOUT := 0x00100000
  3686. WS_EX_NOPARENTNOTIFY := 0x00000004
  3687. WS_EX_TOOLWINDOW := 0x00000080
  3688. WS_EX_TOPMOST := 0x00000008
  3689. WS_EX_WINDOWEDGE := 0x00000100
  3690. WS_EX_OVERLAPPEDWINDOW := (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE)
  3691. WS_EX_PALETTEWINDOW := (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST)
  3692. WS_EX_RIGHT := 0x00001000
  3693. WS_EX_RIGHTSCROLLBAR := 0x00000000
  3694. WS_EX_RTLREADING := 0x00002000
  3695. WS_EX_STATICEDGE := 0x00020000
  3696. WS_EX_TRANSPARENT := 0x00000020
  3697. SW_HIDE := 0
  3698. SW_SHOWNORMAL := 1
  3699. SW_NORMAL := 1
  3700. SW_SHOWMINIMIZED := 2
  3701. SW_SHOWMAXIMIZED := 3
  3702. SW_MAXIMIZE := 3
  3703. SW_SHOWNOACTIVATE := 4
  3704. SW_SHOW := 5
  3705. SW_MINIMIZE := 6
  3706. SW_SHOWMINNOACTIVE := 7
  3707. SW_SHOWNA := 8
  3708. SW_RESTORE := 9
  3709. SW_SHOWDEFAULT := 10
  3710. SW_FORCEMINIMIZE := 11
  3711. SW_MAX := 11
  3712. WM_NULL := 0x0000
  3713. WM_CREATE := 0x0001
  3714. WM_DESTROY := 0x0002
  3715. WM_MOVE := 0x0003
  3716. WM_SIZE := 0x0005
  3717. WS_OVERLAPPED := 0x00000000
  3718. WS_POPUP := 0x80000000
  3719. WS_CHILD := 0x40000000
  3720. WS_MINIMIZE := 0x20000000
  3721. WS_VISIBLE := 0x10000000
  3722. WS_DISABLED := 0x08000000
  3723. WS_CLIPSIBLINGS := 0x04000000
  3724. WS_CLIPCHILDREN := 0x02000000
  3725. WS_MAXIMIZE := 0x01000000
  3726. WS_BORDER := 0x00800000
  3727. WS_DLGFRAME := 0x00400000
  3728. WS_CAPTION := WS_BORDER | WS_DLGFRAME
  3729. WS_VSCROLL := 0x00200000
  3730. WS_HSCROLL := 0x00100000
  3731. WS_SYSMENU := 0x00080000
  3732. WS_THICKFRAME := 0x00040000
  3733. WS_GROUP := 0x00020000
  3734. WS_TABSTOP := 0x00010000
  3735. setBorderless(Winhwnd)
  3736. {
  3737. dwNewLong := DllCall("GetWindowLong", "UInt", Winhwnd, "Int", GWL_EXSTYLE) | WS_EX_TOPMOST
  3738. DllCall("SetWindowLong", "UInt", Winhwnd, "Int", GWL_STYLE, "UInt", dwNewLong)
  3739. DllCall("ShowWindow", "UInt", Winhwnd, "UInt", SW_SHOW)
  3740. }
  3741. showBitmap(pBitmap, ShowCase := 1, img := "", title := "Default", show := 1, delete := 1)
  3742. {
  3743. if ShowCase == 1
  3744. {
  3745. DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", "Ptr", pBitmap, "Ptr*", &hbm := 0, "Int", Background := 0xffffffff)
  3746. MyGui := Gui()
  3747. MyGui.Title := title
  3748. MyGui.Add("Picture", "", "HBITMAP:" hbm)
  3749. if show
  3750. MyGui.Show()
  3751. if delete
  3752. {
  3753. DllCall("DeleteObject", "Ptr", hbm)
  3754. DllCall("gdiplus\GdipDisposeImage", "Ptr", pBitmap)
  3755. }
  3756. Return MyGui
  3757. }
  3758. ; Need to Include CGdip.ahk
  3759. else if ShowCase == 2
  3760. {
  3761. if isSet(CreateCompatibleDC) && isSet(CreateDIBSection) && isSet(SelectObject) && isSet(CGdip) && isSet(UpdateLayeredWindow)
  3762. {
  3763. hdc := CreateCompatibleDC()
  3764. hbm := CreateDIBSection(img.Cols, img.Rows)
  3765. obm := SelectObject(hdc, hbm)
  3766. canvas := CGdip.Graphics.FromHDC(hdc)
  3767. canvas.SetSmoothingMode(4)
  3768. canvas.DrawImage(pBitmap, 0, 0, img.Cols, img.Rows, 0, 0, img.Cols, img.Rows)
  3769. AHKGui := Gui()
  3770. AHKGui.Title := title
  3771. AHKGui.Opt("-Caption +E0x80000")
  3772. if show
  3773. {
  3774. AHKGui.Show("NA")
  3775. UpdateLayeredWindow(AHKGui.hwnd, hdc, 0, 0, img.Cols, img.Rows)
  3776. }
  3777. if delete
  3778. {
  3779. DllCall("DeleteDC", "Ptr", hdc)
  3780. DllCall("DeleteObject", "Ptr", hbm)
  3781. DllCall("DeleteObject", "Ptr", obm)
  3782. DllCall("gdiplus\GdipDeleteGraphics", "Ptr", canvas)
  3783. DllCall("gdiplus\GdipDisposeImage", "Ptr", pBitmap)
  3784. }
  3785. Return AHKGui
  3786. }
  3787. }
  3788. }
  3789. size(args*)
  3790. {
  3791. Return ComArrayMake(args)
  3792. }
  3793. sprintf(fs, args*)
  3794. {
  3795. if args.Length && args[1] is Array
  3796. args := args[1]
  3797. if RegExMatch(fs, "i)%\.(.*)LF", &Num := 0)
  3798. Return Round(args[-1], Num[1])
  3799. if RegExMatch(fs, "i)%\.(.*)F", &Num := 0)
  3800. Return Round(args[-1], Num[1])
  3801. fs := StrReplace(fs, "%d", "{:d}")
  3802. fs := StrReplace(fs, "%i", "{:i}")
  3803. fs := StrReplace(fs, "%x", "{:x}")
  3804. fs := StrReplace(fs, "%o", "{:o}")
  3805. fs := StrReplace(fs, "%f", "{:f}")
  3806. fs := StrReplace(fs, "%e", "{:e}")
  3807. fs := StrReplace(fs, "%E", "{:E}")
  3808. fs := StrReplace(fs, "%g", "{:g}")
  3809. fs := StrReplace(fs, "%G", "{:G}")
  3810. fs := StrReplace(fs, "%a", "{:a}")
  3811. fs := StrReplace(fs, "%A", "{:A}")
  3812. fs := StrReplace(fs, "%p", "{:p}")
  3813. fs := StrReplace(fs, "%s", "{:s}")
  3814. fs := StrReplace(fs, "%c", "{:c}")
  3815. s := Format(fs, args*)
  3816. Return s
  3817. }
  3818. toMat(src, img)
  3819. {
  3820. src.MAT := img
  3821. if Type(src.MAT) == "Cv_Mat_Object"
  3822. {
  3823. src.At := CV2.MAT.At(src)
  3824. src.Channels := src.MAT.Channels
  3825. src.Data := src.MAT.Data
  3826. src.Depth := src.MAT.Depth
  3827. src.Shape := [src.MAT.Rows, src.MAT.Cols, src.MAT.Channels]
  3828. src.Size := src.MAT.Size
  3829. src.Step1 := src.MAT.Step1
  3830. src.Total := src.MAT.Total
  3831. src.Type := src.MAT.Type
  3832. }
  3833. src.Cols := src.MAT.Cols
  3834. src.Dims := src.MAT.Dims
  3835. src.Rows := src.MAT.Rows
  3836. Return src
  3837. }

CVUI库源码

  1. ; Version: 2.7
  2. ; Author: Mono
  3. ; Reference: https://github.com/1024210879/cvui
  4. #Include CV2.ahk
  5. ; 最新版本支持多线程
  6. ; cv2.setNumThreads(1)
  7. ; Access points to internal global namespaces.
  8. __internal := CVUI._Internal()
  9. __imageuid := Map()
  10. __textuid := Map()
  11. _render := CVUI.Render()
  12. _render._internal := CVUI._Internal()
  13. theContext := CVUI._Context()
  14. aOverlay := noArray()
  15. Class CVUI
  16. {
  17. Static VERSION := '2.7'
  18. Static ROW := 0
  19. Static COLUMN := 1
  20. Static DOWN := 2
  21. Static CLICK := 3
  22. Static OVER := 4
  23. Static OUT := 5
  24. Static UP := 6
  25. Static IS_DOWN := 7
  26. ; Constants regarding mouse buttons
  27. Static LEFT_BUTTON := 0
  28. Static MIDDLE_BUTTON := 1
  29. Static RIGHT_BUTTON := 2
  30. ; Constants regarding components
  31. Static TRACKBAR_HIDE_SEGMENT_LABELS := 1
  32. Static TRACKBAR_HIDE_STEP_SCALE := 2
  33. Static TRACKBAR_DISCRETE := 4
  34. Static TRACKBAR_HIDE_MIN_MAX_LABELS := 8
  35. Static TRACKBAR_HIDE_VALUE_LABEL := 16
  36. Static TRACKBAR_HIDE_LABELS := 32
  37. ; Internal things
  38. Static CVUI_ANTIALISED := cv2.LINE_AA
  39. Static CVUI_FILLED := -1
  40. ; Represent a 2D point.
  41. Class _Point
  42. {
  43. __New(theX := 0, theY := 0)
  44. {
  45. this.x := theX
  46. this.y := theY
  47. }
  48. inside(theRect)
  49. {
  50. return theRect.contains(this)
  51. }
  52. }
  53. ; Represent a rectangle.
  54. Class _Rect
  55. {
  56. __New(theX := 0, theY := 0, theWidth := 0, theHeight := 0)
  57. {
  58. this.x := theX
  59. this.y := theY
  60. this.width := theWidth
  61. this.height := theHeight
  62. }
  63. contains(thePoint)
  64. {
  65. return thePoint.x >= this.x and thePoint.x <= (this.x + this.width) and thePoint.y >= this.y and thePoint.y <= (this.y + this.height)
  66. }
  67. area()
  68. {
  69. return this.width * this.height
  70. }
  71. }
  72. ; Represent the size of something, i.e. width and height.
  73. ; It is essentially a simplified version of _Rect where x and y are zero.
  74. Class _Size Extends CVUI._Rect
  75. {
  76. __New(theWidth := 0, theHeight := 0)
  77. {
  78. this.x := 0
  79. this.y := 0
  80. this.width := theWidth
  81. this.height := theHeight
  82. }
  83. }
  84. ; Describe a block structure used by cvui to handle `begin*()` and `end*()` calls.
  85. Class _Block
  86. {
  87. __New()
  88. {
  89. this.where := None ; where the block should be rendered to.
  90. this.rect := CVUI._Rect() ; the size and position of the block.
  91. this.fill := CVUI._Rect() ; the filled area occuppied by the block as it gets modified by its inner components.
  92. this.anchor := CVUI._Point() ; the point where the next component of the block should be rendered.
  93. this.padding := 0 ; padding among components within this block.
  94. this.type := CVUI.ROW ; type of the block, e.g. ROW or COLUMN.
  95. this.reset()
  96. }
  97. reset()
  98. {
  99. this.rect.x := 0
  100. this.rect.y := 0
  101. this.rect.width := 0
  102. this.rect.height := 0
  103. this.fill := this.rect
  104. this.fill.width := 0
  105. this.fill.height := 0
  106. this.anchor.x := 0
  107. this.anchor.y := 0
  108. this.padding := 0
  109. }
  110. }
  111. ; Describe a component label, including info about a shortcut.
  112. ; If a label contains "Re&start", then:
  113. ; - hasShortcut will be true
  114. ; - shortcut will be 's'
  115. ; - textBeforeShortcut will be "Re"
  116. ; - textAfterShortcut will be "tart"
  117. Class _Label
  118. {
  119. __New()
  120. {
  121. this.hasShortcut := False
  122. this.shortcut := ''
  123. this.textBeforeShortcut := ''
  124. this.textAfterShortcut := ''
  125. }
  126. }
  127. ; Describe a mouse button
  128. Class _MouseButton
  129. {
  130. __New()
  131. {
  132. this.justReleased := False ; if the mouse button was released, i.e. click event.
  133. this.justPressed := False ; if the mouse button was just pressed, i.e. true for a frame when a button is down.
  134. this.pressed := False ; if the mouse button is pressed or not.
  135. }
  136. reset()
  137. {
  138. this.justPressed := False
  139. this.justReleased := False
  140. this.pressed := False
  141. }
  142. }
  143. ; Describe the information of the mouse cursor
  144. Class _Mouse
  145. {
  146. __New()
  147. {
  148. this.buttons := Map( ; status of each button. Use cvui.{RIGHT,LEFT,MIDDLE}_BUTTON to access the buttons.
  149. CVUI.LEFT_BUTTON, CVUI._MouseButton(),
  150. CVUI.MIDDLE_BUTTON, CVUI._MouseButton(),
  151. CVUI.RIGHT_BUTTON, CVUI._MouseButton()
  152. )
  153. this.anyButton := CVUI._MouseButton() ; represent the behavior of all mouse buttons combined
  154. this.position := CVUI._Point(0, 0) ; x and y coordinates of the mouse at the moment.
  155. }
  156. }
  157. ; Describe a (window) context.
  158. Class _Context
  159. {
  160. __New()
  161. {
  162. this.windowName := '' ; name of the window related to this context.
  163. this.mouse := CVUI._Mouse() ; the mouse cursor related to this context.
  164. }
  165. }
  166. ; Describe the inner parts of the trackbar component.
  167. Class _TrackbarParams
  168. {
  169. __New(theMin := 0., theMax := 25., theStep := 1., theSegments := 0, theLabelFormat := '%.0Lf', theOptions := 0)
  170. {
  171. this.min := theMin
  172. this.max := theMax
  173. this.step := theStep
  174. this.segments := theSegments
  175. this.options := theOptions
  176. this.labelFormat := theLabelFormat
  177. }
  178. }
  179. ; This Class contains all stuff that cvui uses internally to render
  180. ; and control interaction with components.
  181. Class _Internal
  182. {
  183. __New()
  184. {
  185. this.defaultContext := ''
  186. this.currentContext := ''
  187. this.contexts := Map() ; indexed by the window name.
  188. this.buffer := []
  189. this.lastKeyPressed := -1 ; TODO: collect it per window
  190. this.delayWaitKey := -1
  191. this.screen := CVUI._Block()
  192. tmp := []
  193. Loop 100
  194. tmp.Push(CVUI._Block())
  195. this.stack := tmp ; TODO: make it dynamic
  196. this.stackCount := -1
  197. this.trackbarMarginX := 14
  198. }
  199. isMouseButton(theButton, theQuery)
  200. {
  201. aRet := False
  202. if (theQuery == CVUI.CLICK) or (theQuery == CVUI.UP)
  203. aRet := theButton.justReleased
  204. else if (theQuery == CVUI.DOWN)
  205. aRet := theButton.justPressed
  206. else if (theQuery == CVUI.IS_DOWN)
  207. aRet := theButton.pressed
  208. return aRet
  209. }
  210. mouseW(theWindowName := '')
  211. {
  212. /*
  213. Return the last position of the mouse.
  214. \param theWindowName name of the window whose mouse cursor will be used. If nothing is informed (default), the function will return the position of the mouse cursor for the default window (the one informed in `cvui::init()`).
  215. \return a point containing the position of the mouse cursor in the speficied window.
  216. */
  217. return this.getContext(theWindowName).mouse.position
  218. }
  219. mouseQ(theQuery)
  220. {
  221. /*
  222. Query the mouse for events, e.g. "is any button down now?". Available queries are
  223. * `cvui::DOWN`: any mouse button was pressed. `cvui::mouse()` returns `true` for a single frame only.
  224. * `cvui::UP`: any mouse button was released. `cvui::mouse()` returns `true` for a single frame only.
  225. * `cvui::CLICK`: any mouse button was clicked (went down then up, no matter the amount of frames in between). `cvui::mouse()` returns `true` for a single frame only.
  226. * `cvui::IS_DOWN`: any mouse button is currently pressed. `cvui::mouse()` returns `true` for as long as the button is down/pressed.
  227. It is easier to think of this function as the answer to a questions. For instance, asking if any mouse button went down
  228. ```
  229. if (cvui::mouse(cvui::DOWN)) {
  230. // Any mouse button just went down.
  231. }
  232. ```
  233. The window whose mouse will be queried depends on the context. If `cvui::mouse(query)` is being called after
  234. `cvui::context()`, the window informed in the context will be queried. If no context is available, the default
  235. window (informed in `cvui::init()`) will be used.
  236. Parameters
  237. ----------
  238. theQuery int
  239. Integer describing the intended mouse query. Available queries are `cvui::DOWN`, `cvui::UP`, `cvui::CLICK`, and `cvui::IS_DOWN`.
  240. \sa mouse(const cv::String&)
  241. \sa mouse(const cv::String&, int)
  242. \sa mouse(const cv::String&, int, int)
  243. \sa mouse(int, int)
  244. */
  245. return this.mouseWQ('', theQuery)
  246. }
  247. mouseWQ(theWindowName, theQuery)
  248. {
  249. /*
  250. Query the mouse for events in a particular window. This function behave exactly like `cvui::mouse(int theQuery)`
  251. with the difference that queries are targeted at a particular window.
  252. \param theWindowName name of the window that will be queried.
  253. \param theQuery an integer describing the intended mouse query. Available queries are `cvui::DOWN`, `cvui::UP`, `cvui::CLICK`, and `cvui::IS_DOWN`.
  254. \sa mouse(const cv::String&)
  255. \sa mouse(const cv::String&, int, int)
  256. \sa mouse(int, int)
  257. \sa mouse(int)
  258. */
  259. aButton := this.getContext(theWindowName).mouse.anyButton
  260. aRet := this.isMouseButton(aButton, theQuery)
  261. return aRet
  262. }
  263. mouseBQ(theButton, theQuery)
  264. {
  265. /*
  266. Query the mouse for events in a particular button. This function behave exactly like `cvui::mouse(int theQuery)`,
  267. with the difference that queries are targeted at a particular mouse button instead.
  268. \param theButton an integer describing the mouse button to be queried. Possible values are `cvui::LEFT_BUTTON`, `cvui::MIDDLE_BUTTON` and `cvui::LEFT_BUTTON`.
  269. \param theQuery an integer describing the intended mouse query. Available queries are `cvui::DOWN`, `cvui::UP`, `cvui::CLICK`, and `cvui::IS_DOWN`.
  270. \sa mouse(const cv::String&)
  271. \sa mouse(const cv::String&, int, int)
  272. \sa mouse(int)
  273. */
  274. return this.mouseWBQ('', theButton, theQuery)
  275. }
  276. mouseWBQ(theWindowName, theButton, theQuery)
  277. {
  278. /*
  279. Query the mouse for events in a particular button in a particular window. This function behave exactly
  280. like `cvui::mouse(int theButton, int theQuery)`, with the difference that queries are targeted at
  281. a particular mouse button in a particular window instead.
  282. \param theWindowName name of the window that will be queried.
  283. \param theButton an integer describing the mouse button to be queried. Possible values are `cvui::LEFT_BUTTON`, `cvui::MIDDLE_BUTTON` and `cvui::LEFT_BUTTON`.
  284. \param theQuery an integer describing the intended mouse query. Available queries are `cvui::DOWN`, `cvui::UP`, `cvui::CLICK`, and `cvui::IS_DOWN`.
  285. */
  286. if theButton != CVUI.RIGHT_BUTTON and theButton != CVUI.MIDDLE_BUTTON and theButton != CVUI.LEFT_BUTTON
  287. __internal.error(6, 'Invalid mouse button. Are you using one of the available cvui.{RIGHT,MIDDLE,LEFT}_BUTTON ?')
  288. aButton := this.getContext(theWindowName).mouse.buttons[theButton]
  289. aRet := this.isMouseButton(aButton, theQuery)
  290. return aRet
  291. }
  292. init(theWindowName, theDelayWaitKey)
  293. {
  294. this.defaultContext := theWindowName
  295. this.currentContext := theWindowName
  296. this.delayWaitKey := theDelayWaitKey
  297. this.lastKeyPressed := -1
  298. }
  299. bitsetHas(theBitset, theValue)
  300. {
  301. return (theBitset & theValue) != 0
  302. }
  303. error(theId, theMessage)
  304. {
  305. printc('[CVUI] Fatal error (code ', theId, '): ', theMessage)
  306. cv2.waitKey(100000)
  307. exit(-1)
  308. }
  309. getContext(theWindowName := '')
  310. {
  311. if len(theWindowName) != 0
  312. ; Get context in particular
  313. return this.contexts[theWindowName]
  314. else if len(this.currentContext) != 0
  315. ; No window provided, return currently active context.
  316. return this.contexts[this.currentContext]
  317. else if len(this.defaultContext) != 0
  318. ; We have no active context, so let's use the default one.
  319. return this.contexts[this.defaultContext]
  320. else
  321. ; Apparently we have no window at all! <o>
  322. ; This should not happen. Probably cvui::init() was never called.
  323. this.error(5, 'Unable to read context. Did you forget to call cvui.init()?')
  324. }
  325. updateLayoutFlow(theBlock, theSize)
  326. {
  327. if theBlock.type == CVUI.ROW
  328. {
  329. aValue := theSize.width + theBlock.padding
  330. theBlock.anchor.x += aValue
  331. theBlock.fill.width += aValue
  332. theBlock.fill.height := max(theSize.height, theBlock.fill.height)
  333. }
  334. else if theBlock.type == CVUI.COLUMN
  335. {
  336. aValue := theSize.height + theBlock.padding
  337. theBlock.anchor.y += aValue
  338. theBlock.fill.height += aValue
  339. theBlock.fill.width := max(theSize.width, theBlock.fill.width)
  340. }
  341. }
  342. blockStackEmpty()
  343. {
  344. return this.stackCount == -1
  345. }
  346. topBlock()
  347. {
  348. if this.stackCount < 0
  349. this.error(3, 'You are using a function that should be enclosed by begin*() and end*(), but you probably forgot to call begin*().')
  350. return this.stack[this.stackCount + 1]
  351. }
  352. pushBlock()
  353. {
  354. this.stackCount += 1
  355. return this.stack[this.stackCount + 1]
  356. }
  357. popBlock()
  358. {
  359. ; Check if there is anything to be popped out from the stack.
  360. if this.stackCount < 0
  361. this.error(1, 'Mismatch in the number of begin*()/end*() calls. You are calling one more than the other.')
  362. aIndex := this.stackCount
  363. this.stackCount -= 1
  364. return this.stack[aIndex + 1]
  365. }
  366. createLabel(theLabel)
  367. {
  368. theLabel := StrSplit(theLabel)
  369. i := 0
  370. aBefore := ''
  371. aAfter := ''
  372. aLabel := CVUI._Label()
  373. aLabel.hasShortcut := False
  374. aLabel.shortcut := 0
  375. aLabel.textBeforeShortcut := ''
  376. aLabel.textAfterShortcut := ''
  377. while i < len(theLabel)
  378. {
  379. c := theLabel[i + 1]
  380. if c == '&' and i < len(theLabel) - 1
  381. {
  382. aLabel.hasShortcut := True
  383. aLabel.shortcut := theLabel[i + 2]
  384. i += 1
  385. }
  386. else if aLabel.hasShortcut == False
  387. aBefore .= c
  388. else
  389. aAfter .= c
  390. i += 1
  391. }
  392. aLabel.textBeforeShortcut := aBefore
  393. aLabel.textAfterShortcut := aAfter
  394. return aLabel
  395. }
  396. text(theBlock, theX, theY, theText, theFontScale, theColor, theUpdateLayout)
  397. {
  398. tmp := cv2.getTextSize(theText, cv2.FONT_HERSHEY_SIMPLEX, theFontScale, 1)
  399. aSizeInfo := tmp[1]
  400. aBaseline := tmp[2]
  401. aTextSize := CVUI._Size(aSizeInfo[0], aSizeInfo[1])
  402. aPos := CVUI._Point(theX, theY + aTextSize.height)
  403. _render.text(theBlock, theText, aPos, theFontScale, theColor)
  404. if theUpdateLayout
  405. {
  406. ; Add an extra pixel to the height to overcome OpenCV font size problems.
  407. aTextSize.height += 1
  408. this.updateLayoutFlow(theBlock, aTextSize)
  409. }
  410. }
  411. counter(theBlock, theX, theY, theValue, theStep, theFormat)
  412. {
  413. aContentArea := CVUI._Rect(theX + 22, theY, 48, 22)
  414. if this.buttonWH(theBlock, theX, theY, 22, 22, '-', False)
  415. theValue[1] -= theStep
  416. aText := sprintf(theFormat, theValue[1])
  417. _render.counter(theBlock, aContentArea, aText)
  418. if this.buttonWH(theBlock, aContentArea.x + aContentArea.width, theY, 22, 22, "+", False)
  419. theValue[1] += theStep
  420. ; Update the layout flow
  421. aSize := CVUI._Size(22 * 2 + aContentArea.width, aContentArea.height)
  422. this.updateLayoutFlow(theBlock, aSize)
  423. return theValue[1]
  424. }
  425. checkbox(theBlock, theX, theY, theLabel, theState, theColor)
  426. {
  427. aMouse := this.getContext().mouse
  428. aRect := CVUI._Rect(theX, theY, 15, 15)
  429. tmp := cv2.getTextSize(theLabel, cv2.FONT_HERSHEY_SIMPLEX, 0.4, 1)
  430. aSizeInfo := tmp[1]
  431. aBaseline := tmp[2]
  432. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  433. aHitArea := CVUI._Rect(theX, theY, aRect.width + aTextSize.width + 6, aRect.height)
  434. aMouseIsOver := aHitArea.contains(aMouse.position)
  435. if aMouseIsOver
  436. {
  437. _render.checkbox(theBlock, CVUI.OVER, aRect)
  438. if aMouse.anyButton.justReleased
  439. theState[1] := not theState[1]
  440. }
  441. else
  442. _render.checkbox(theBlock, CVUI.OUT, aRect)
  443. _render.checkboxLabel(theBlock, aRect, theLabel, aTextSize, theColor)
  444. if theState[1]
  445. _render.checkboxCheck(theBlock, aRect)
  446. ; Update the layout flow
  447. aSize := CVUI._Size(aHitArea.width, aHitArea.height)
  448. this.updateLayoutFlow(theBlock, aSize)
  449. return theState[1]
  450. }
  451. clamp01(theValue)
  452. {
  453. theValue := (theValue > 1.) ? 1. : theValue
  454. theValue := (theValue < 0.) ? 0. : theValue
  455. return theValue
  456. }
  457. trackbarForceValuesAsMultiplesOfSmallStep(theParams, theValue)
  458. {
  459. if this.bitsetHas(theParams.options, CVUI.TRACKBAR_DISCRETE) and (theParams.step != 0.)
  460. {
  461. k := float(theValue[1] - theParams.min) / theParams.step
  462. k := round(k)
  463. theValue[1] := theParams.min + theParams.step * k
  464. }
  465. }
  466. trackbarXPixelToValue(theParams, theBounding, thePixelX)
  467. {
  468. aRatio := float(thePixelX - (theBounding.x + this.trackbarMarginX)) / (theBounding.width - 2 * this.trackbarMarginX)
  469. aRatio := this.clamp01(aRatio)
  470. aValue := theParams.min + aRatio * (theParams.max - theParams.min)
  471. return aValue
  472. }
  473. trackbarValueToXPixel(theParams, theBounding, theValue)
  474. {
  475. aRatio := float(theValue - theParams.min) / (theParams.max - theParams.min)
  476. aRatio := this.clamp01(aRatio)
  477. aPixelsX := theBounding.x + this.trackbarMarginX + aRatio * (theBounding.width - 2 * this.trackbarMarginX)
  478. return int(aPixelsX)
  479. }
  480. iarea(theX, theY, theWidth, theHeight)
  481. {
  482. aMouse := this.getContext().mouse
  483. ; By default, return that the mouse is out of the interaction area.
  484. aRet := CVUI.OUT
  485. ; Check if the mouse is over the interaction area.
  486. aMouseIsOver := CVUI._Rect(theX, theY, theWidth, theHeight).contains(aMouse.position)
  487. if aMouseIsOver
  488. {
  489. if aMouse.anyButton.pressed
  490. aRet := CVUI.DOWN
  491. else
  492. aRet := CVUI.OVER
  493. }
  494. ; Tell if the button was clicked or not
  495. if aMouseIsOver and aMouse.anyButton.justReleased
  496. aRet := CVUI.CLICK
  497. return aRet
  498. }
  499. buttonWH(theBlock, theX, theY, theWidth, theHeight, theLabel, theUpdateLayout)
  500. {
  501. ; Calculate the space that the label will fill
  502. tmp := cv2.getTextSize(theLabel, cv2.FONT_HERSHEY_SIMPLEX, 0.4, 1)
  503. aSizeInfo := tmp[1]
  504. aBaseline := tmp[2]
  505. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  506. ; Make the button big enough to house the label
  507. aRect := CVUI._Rect(theX, theY, theWidth, theHeight)
  508. ; CVUI.Render the button according to mouse interaction, e.g. OVER, DOWN, OUT.
  509. aStatus := this.iarea(theX, theY, aRect.width, aRect.height)
  510. _render.button(theBlock, aStatus, aRect, theLabel)
  511. _render.buttonLabel(theBlock, aStatus, aRect, theLabel, aTextSize)
  512. ; Update the layout flow according to button size
  513. ; if we were told to update.
  514. if theUpdateLayout
  515. {
  516. aSize := CVUI._Size(theWidth, theHeight)
  517. this.updateLayoutFlow(theBlock, aSize)
  518. }
  519. aWasShortcutPressed := False
  520. ; Handle keyboard shortcuts
  521. if this.lastKeyPressed != -1
  522. {
  523. aLabel := this.createLabel(theLabel)
  524. if aLabel.hasShortcut and StrLower(aLabel.shortcut) == StrLower(chr(this.lastKeyPressed))
  525. aWasShortcutPressed := True
  526. }
  527. ; Return true if the button was clicked
  528. return (aStatus == CVUI.CLICK) or aWasShortcutPressed
  529. }
  530. button(theBlock, theX, theY, theLabel)
  531. {
  532. ; Calculate the space that the label will fill
  533. tmp := cv2.getTextSize(theLabel, cv2.FONT_HERSHEY_SIMPLEX, 0.4, 1)
  534. aSizeInfo := tmp[1]
  535. aBaseline := tmp[2]
  536. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  537. ; Create a button based on the size of the text
  538. return this.buttonWH(theBlock, theX, theY, aTextSize.width + 30, aTextSize.height + 18, theLabel, True)
  539. }
  540. buttonI(theBlock, theX, theY, theIdle, theOver, theDown, theUpdateLayout)
  541. {
  542. aIdleRows := theIdle.shape[1]
  543. aIdleCols := theIdle.shape[2]
  544. aRect := CVUI._Rect(theX, theY, aIdleCols, aIdleRows)
  545. aStatus := this.iarea(theX, theY, aRect.width, aRect.height)
  546. if aStatus == CVUI.OUT
  547. _render.image(theBlock, aRect, theIdle)
  548. else if aStatus == CVUI.OVER
  549. _render.image(theBlock, aRect, theOver)
  550. else if aStatus == CVUI.DOWN
  551. _render.image(theBlock, aRect, theDown)
  552. ; Update the layout flow according to button size
  553. ; if we were told to update.
  554. if theUpdateLayout
  555. {
  556. aSize := CVUI._Size(aRect.width, aRect.height)
  557. this.updateLayoutFlow(theBlock, aSize)
  558. }
  559. ; Return true if the button was clicked
  560. return aStatus == CVUI.CLICK
  561. }
  562. image(theBlock, theX, theY, theImage)
  563. {
  564. aImageRows := theImage.shape[1]
  565. aImageCols := theImage.shape[2]
  566. aRect := CVUI._Rect(theX, theY, aImageCols, aImageRows)
  567. ; TODO check for render outside the frame area
  568. _render.image(theBlock, aRect, theImage)
  569. ; Update the layout flow according to image size
  570. aSize := CVUI._Size(aImageCols, aImageRows)
  571. this.updateLayoutFlow(theBlock, aSize)
  572. }
  573. trackbar(theBlock, theX, theY, theWidth, theValue, theParams)
  574. {
  575. aMouse := this.getContext().mouse
  576. aContentArea := CVUI._Rect(theX, theY, theWidth, 45)
  577. aMouseIsOver := aContentArea.contains(aMouse.position)
  578. aValue := theValue[1]
  579. _render.trackbar(theBlock, aMouseIsOver ? CVUI.OVER : CVUI.OUT, aContentArea, theValue[1], theParams)
  580. if aMouse.anyButton.pressed and aMouseIsOver
  581. {
  582. theValue[1] := this.trackbarXPixelToValue(theParams, aContentArea, aMouse.position.x)
  583. if this.bitsetHas(theParams.options, CVUI.TRACKBAR_DISCRETE)
  584. this.trackbarForceValuesAsMultiplesOfSmallStep(theParams, theValue)
  585. }
  586. ; Update the layout flow
  587. ; TODO use aSize := aContentArea.size()?
  588. this.updateLayoutFlow(theBlock, aContentArea)
  589. return theValue[1] != aValue
  590. }
  591. window(theBlock, theX, theY, theWidth, theHeight, theTitle)
  592. {
  593. aTitleBar := CVUI._Rect(theX, theY, theWidth, 20)
  594. aContent := CVUI._Rect(theX, theY + aTitleBar.height, theWidth, theHeight - aTitleBar.height)
  595. _render.window(theBlock, aTitleBar, aContent, theTitle)
  596. ; Update the layout flow
  597. aSize := CVUI._Size(theWidth, theHeight)
  598. this.updateLayoutFlow(theBlock, aSize)
  599. }
  600. rect(theBlock, theX, theY, theWidth, theHeight, theBorderColor, theFillingColor)
  601. {
  602. aAnchor := CVUI._Point(theX, theY)
  603. aRect := CVUI._Rect(theX, theY, theWidth, theHeight)
  604. aRect.x := (aRect.width < 0) ? (aAnchor.x + aRect.width) : aAnchor.x
  605. aRect.y := (aRect.height < 0) ? (aAnchor.y + aRect.height) : aAnchor.y
  606. aRect.width := abs(aRect.width)
  607. aRect.height := abs(aRect.height)
  608. _render.rect(theBlock, aRect, theBorderColor, theFillingColor)
  609. ; Update the layout flow
  610. aSize := CVUI._Size(aRect.width, aRect.height)
  611. this.updateLayoutFlow(theBlock, aSize)
  612. }
  613. sparkline(theBlock, theValues, theX, theY, theWidth, theHeight, theColor)
  614. {
  615. aRect := CVUI._Rect(theX, theY, theWidth, theHeight)
  616. aHowManyValues := len(theValues)
  617. if (aHowManyValues >= 2)
  618. {
  619. tmp := this.findMinMax(theValues)
  620. aMin := tmp[1]
  621. aMax := tmp[2]
  622. _render.sparkline(theBlock, theValues, aRect, aMin, aMax, theColor)
  623. }
  624. else
  625. this.text(theBlock, theX, theY, (aHowManyValues == 0) ? 'No data.' : 'Insufficient data points.', 0.4, 0xCECECE, False)
  626. ; Update the layout flow
  627. aSize := CVUI._Size(theWidth, theHeight)
  628. this.updateLayoutFlow(theBlock, aSize)
  629. }
  630. hexToScalar(theColor)
  631. {
  632. aAlpha := (theColor >> 24) & 0xff
  633. aRed := (theColor >> 16) & 0xff
  634. aGreen := (theColor >> 8) & 0xff
  635. aBlue := theColor & 0xff
  636. return [aBlue, aGreen, aRed, aAlpha]
  637. }
  638. isString(theObj)
  639. {
  640. return isinstance(theObj, String)
  641. }
  642. begin(theType, theWhere, theX, theY, theWidth, theHeight, thePadding)
  643. {
  644. aBlock := this.pushBlock()
  645. aBlock.where := theWhere
  646. aBlock.rect.x := theX
  647. aBlock.rect.y := theY
  648. aBlock.rect.width := theWidth
  649. aBlock.rect.height := theHeight
  650. aBlock.fill := aBlock.rect
  651. aBlock.fill.width := 0
  652. aBlock.fill.height := 0
  653. aBlock.anchor.x := theX
  654. aBlock.anchor.y := theY
  655. aBlock.padding := thePadding
  656. aBlock.type := theType
  657. }
  658. end(theType)
  659. {
  660. aBlock := this.popBlock()
  661. if aBlock.type != theType
  662. this.error(4, 'Calling wrong type of end*(). E.g. endColumn() instead of endRow(). Check if your begin*() calls are matched with their appropriate end*() calls.')
  663. ; If we still have blocks in the stack, we must update
  664. ; the current top with the dimensions that were filled by
  665. ; the newly popped block.
  666. if this.blockStackEmpty() == False
  667. {
  668. aTop := this.topBlock()
  669. aSize := CVUI._Size()
  670. ; If the block has rect.width < 0 or rect.heigth < 0, it means the
  671. ; user don't want to calculate the block's width/height. It's up to
  672. ; us do to the math. In that case, we use the block's fill rect to find
  673. ; out the occupied space. If the block's width/height is greater than
  674. ; zero, then the user is very specific about the desired size. In that
  675. ; case, we use the provided width/height, no matter what the fill rect
  676. ; actually is.
  677. aSize.width := (aBlock.rect.width < 0) ? aBlock.fill.width : aBlock.rect.width
  678. aSize.height := (aBlock.rect.height < 0) ? aBlock.fill.height : aBlock.rect.height
  679. this.updateLayoutFlow(aTop, aSize)
  680. }
  681. }
  682. ; Find the min and max values of a vector
  683. findMinMax(theValues)
  684. {
  685. aMin := theValues[1]
  686. aMax := theValues[1]
  687. for aValue in theValues
  688. {
  689. if aValue < aMin
  690. aMin := aValue
  691. if aValue > aMax
  692. aMax := aValue
  693. }
  694. return [aMin, aMax]
  695. }
  696. }
  697. ; Class that contains all rendering methods.
  698. Class Render
  699. {
  700. Static _internal := None
  701. rectangle(theWhere, theShape, theColor, theThickness := 1, theLineType := CVUI.CVUI_ANTIALISED)
  702. {
  703. aStartPoint := [int(theShape.x), int(theShape.y)]
  704. aEndPoint := [int(theShape.x + theShape.width), int(theShape.y + theShape.height)]
  705. cv2.rectangle(theWhere, aStartPoint, aEndPoint, theColor, theThickness, theLineType)
  706. }
  707. text(theBlock, theText, thePos, theFontScale, theColor)
  708. {
  709. aPosition := [int(thePos.x), int(thePos.y)]
  710. cv2.putText(theBlock.where, theText, aPosition, cv2.FONT_HERSHEY_SIMPLEX, theFontScale, this._internal.hexToScalar(theColor), 1, cv2.LINE_AA)
  711. }
  712. counter(theBlock, theShape, theValue)
  713. {
  714. this.rectangle(theBlock.where, theShape, [0x29, 0x29, 0x29], CVUI.CVUI_FILLED) ; fill
  715. this.rectangle(theBlock.where, theShape, [0x45, 0x45, 0x45]) ; border
  716. tmp := cv2.getTextSize(theValue, cv2.FONT_HERSHEY_SIMPLEX, 0.4, 1)
  717. aSizeInfo := tmp[1]
  718. aBaseline := tmp[2]
  719. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  720. aPos := CVUI._Point(theShape.x + theShape.width / 2 - aTextSize.width / 2, theShape.y + aTextSize.height / 2 + theShape.height / 2)
  721. cv2.putText(theBlock.where, theValue, [int(aPos.x), int(aPos.y)], cv2.FONT_HERSHEY_SIMPLEX, 0.4, [0xCE, 0xCE, 0xCE], 1, CVUI.CVUI_ANTIALISED)
  722. }
  723. button(theBlock, theState, theShape, theLabel)
  724. {
  725. ; Outline
  726. this.rectangle(theBlock.where, theShape, [0x29, 0x29, 0x29])
  727. ; Border
  728. theShape.x += 1
  729. theShape.y +=1
  730. theShape.width -= 2
  731. theShape.height -= 2
  732. this.rectangle(theBlock.where, theShape, [0x4A, 0x4A, 0x4A])
  733. ; Inside
  734. theShape.x += 1
  735. theShape.y +=1
  736. theShape.width -= 2
  737. theShape.height -= 2
  738. this.rectangle(theBlock.where, theShape, (theState == CVUI.OUT) ? [0x42, 0x42, 0x42] : ((theState == CVUI.OVER) ? [0x52, 0x52, 0x52] : [0x32, 0x32, 0x32]), CVUI.CVUI_FILLED)
  739. }
  740. image(theBlock, theRect, theImage)
  741. {
  742. theBlock.where[theRect.x, theRect.y, theRect.width, theRect.height] := theImage
  743. }
  744. putText(theBlock, theState, theColor, theText, thePosition)
  745. {
  746. aFontScale := (theState == CVUI.DOWN) ? 0.39 : 0.4
  747. aTextSize := CVUI._Rect()
  748. if theText != ''
  749. {
  750. aPosition := [int(thePosition.x), int(thePosition.y)]
  751. cv2.putText(theBlock.where, theText, aPosition, cv2.FONT_HERSHEY_SIMPLEX, aFontScale, theColor, 1, CVUI.CVUI_ANTIALISED)
  752. tmp := cv2.getTextSize(theText, cv2.FONT_HERSHEY_SIMPLEX, aFontScale, 1)
  753. aSizeInfo := tmp[1]
  754. aBaseline := tmp[2]
  755. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  756. }
  757. return aTextSize.width
  758. }
  759. putTextCentered(theBlock, thePosition, theText)
  760. {
  761. aFontScale := 0.3
  762. tmp := cv2.getTextSize(theText, cv2.FONT_HERSHEY_SIMPLEX, aFontScale, 1)
  763. aSizeInfo := tmp[1]
  764. aBaseline := tmp[2]
  765. aTextSize := CVUI._Rect(0, 0, aSizeInfo[0], aSizeInfo[1])
  766. aPositionDecentered := CVUI._Point(thePosition.x - aTextSize.width / 2, thePosition.y)
  767. cv2.putText(theBlock.where, theText, [int(aPositionDecentered.x), int(aPositionDecentered.y)], cv2.FONT_HERSHEY_SIMPLEX, aFontScale, [0xCE, 0xCE, 0xCE], 1, CVUI.CVUI_ANTIALISED)
  768. return aTextSize.width
  769. }
  770. buttonLabel(theBlock, theState, theRect, theLabel, theTextSize)
  771. {
  772. aPos := CVUI._Point(theRect.x + theRect.width / 2 - theTextSize.width / 2, theRect.y + theRect.height / 2 + theTextSize.height / 2)
  773. aColor := [0xCE, 0xCE, 0xCE]
  774. aLabel := this._internal.createLabel(theLabel)
  775. if aLabel.hasShortcut == False
  776. this.putText(theBlock, theState, aColor, theLabel, aPos)
  777. else
  778. {
  779. aWidth := this.putText(theBlock, theState, aColor, aLabel.textBeforeShortcut, aPos)
  780. aStart := aPos.x + aWidth
  781. aPos.x += aWidth
  782. aShortcut := ''
  783. aShortcut .= aLabel.shortcut
  784. aWidth := this.putText(theBlock, theState, aColor, aShortcut, aPos)
  785. aEnd := aStart + aWidth
  786. aPos.x += aWidth
  787. this.putText(theBlock, theState, aColor, aLabel.textAfterShortcut, aPos)
  788. cv2.line(theBlock.where, [int(aStart), int(aPos.y + 3)], [int(aEnd), int(aPos.y + 3)], aColor, 1, CVUI.CVUI_ANTIALISED)
  789. }
  790. }
  791. trackbarHandle(theBlock, theState, theShape, theValue, theParams, theWorkingArea)
  792. {
  793. aBarTopLeft := CVUI._Point(theWorkingArea.x, theWorkingArea.y + theWorkingArea.height / 2)
  794. aBarHeight := 7
  795. ; Draw the rectangle representing the handle
  796. aPixelX := this._internal.trackbarValueToXPixel(theParams, theShape, theValue)
  797. aIndicatorWidth := 3
  798. aIndicatorHeight := 4
  799. aPoint1 := CVUI._Point(aPixelX - aIndicatorWidth, aBarTopLeft.y - aIndicatorHeight)
  800. aPoint2 := CVUI._Point(aPixelX + aIndicatorWidth, aBarTopLeft.y + aBarHeight + aIndicatorHeight)
  801. aRect := CVUI._Rect(aPoint1.x, aPoint1.y, aPoint2.x - aPoint1.x, aPoint2.y - aPoint1.y)
  802. aFillColor := (theState == CVUI.OVER) ? 0x525252 : 0x424242
  803. this.rect(theBlock, aRect, 0x212121, 0x212121)
  804. aRect.x += 1
  805. aRect.y += 1
  806. aRect.width -= 2
  807. aRect.height -= 2
  808. this.rect(theBlock, aRect, 0x515151, aFillColor)
  809. aShowLabel := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_HIDE_VALUE_LABEL) == False
  810. ; Draw the handle label
  811. if aShowLabel
  812. {
  813. aTextPos := CVUI._Point(aPixelX, aPoint2.y + 11)
  814. aText := sprintf(theParams.labelFormat, theValue)
  815. this.putTextCentered(theBlock, aTextPos, aText)
  816. }
  817. }
  818. trackbarPath(theBlock, theState, theShape, theValue, theParams, theWorkingArea)
  819. {
  820. aBarHeight := 7
  821. aBarTopLeft := CVUI._Point(theWorkingArea.x, theWorkingArea.y + theWorkingArea.height / 2)
  822. aRect := CVUI._Rect(aBarTopLeft.x, aBarTopLeft.y, theWorkingArea.width, aBarHeight)
  823. aBorderColor := (theState == CVUI.OVER) ? 0x4e4e4e : 0x3e3e3e
  824. this.rect(theBlock, aRect, aBorderColor, 0x292929)
  825. cv2.line(theBlock.where, [int(aRect.x + 1), int(aRect.y + aBarHeight - 2)], [int(aRect.x + aRect.width - 2), int(aRect.y + aBarHeight - 2)], [0x0e, 0x0e, 0x0e])
  826. }
  827. trackbarSteps(theBlock, theState, theShape, theValue, theParams, theWorkingArea)
  828. {
  829. aBarTopLeft := CVUI._Point(theWorkingArea.x, theWorkingArea.y + theWorkingArea.height / 2)
  830. aColor := [0x51, 0x51, 0x51]
  831. aDiscrete := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_DISCRETE)
  832. aFixedStep := aDiscrete ? theParams.step : ((theParams.max - theParams.min) / 20)
  833. ; TODO check min, max and step to prevent infinite loop.
  834. aValue := theParams.min
  835. while aValue <= theParams.max
  836. {
  837. aPixelX := int(this._internal.trackbarValueToXPixel(theParams, theShape, aValue))
  838. aPoint1 := [aPixelX, int(aBarTopLeft.y)]
  839. aPoint2 := [aPixelX, int(aBarTopLeft.y - 3)]
  840. cv2.line(theBlock.where, aPoint1, aPoint2, aColor)
  841. aValue += aFixedStep
  842. }
  843. }
  844. trackbarSegmentLabel(theBlock, theShape, theParams, theValue, theWorkingArea, theShowLabel)
  845. {
  846. aColor := [0x51, 0x51, 0x51]
  847. aBarTopLeft := CVUI._Point(theWorkingArea.x, theWorkingArea.y + theWorkingArea.height / 2)
  848. aPixelX := int(this._internal.trackbarValueToXPixel(theParams, theShape, theValue))
  849. aPoint1 := [aPixelX, int(aBarTopLeft.y)]
  850. aPoint2 := [aPixelX, int(aBarTopLeft.y - 8)]
  851. cv2.line(theBlock.where, aPoint1, aPoint2, aColor)
  852. if theShowLabel
  853. {
  854. aText := sprintf(theParams.labelFormat, theValue)
  855. aTextPos := CVUI._Point(aPixelX, aBarTopLeft.y - 11)
  856. this.putTextCentered(theBlock, aTextPos, aText)
  857. }
  858. }
  859. trackbarSegments(theBlock, theState, theShape, theValue, theParams, theWorkingArea)
  860. {
  861. aSegments := (theParams.segments < 1) ? 1 : theParams.segments
  862. aSegmentLength := float(theParams.max - theParams.min) / aSegments
  863. aHasMinMaxLabels := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_HIDE_MIN_MAX_LABELS) == False
  864. ; CVUI.Render the min value label
  865. this.trackbarSegmentLabel(theBlock, theShape, theParams, theParams.min, theWorkingArea, aHasMinMaxLabels)
  866. ; Draw large steps and labels
  867. aHasSegmentLabels := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_HIDE_SEGMENT_LABELS) == False
  868. ; TODO check min, max and step to prevent infinite loop.
  869. aValue := theParams.min
  870. while aValue <= theParams.max
  871. {
  872. this.trackbarSegmentLabel(theBlock, theShape, theParams, aValue, theWorkingArea, aHasSegmentLabels)
  873. aValue += aSegmentLength
  874. }
  875. ; CVUI.Render the max value label
  876. this.trackbarSegmentLabel(theBlock, theShape, theParams, theParams.max, theWorkingArea, aHasMinMaxLabels)
  877. }
  878. trackbar(theBlock, theState, theShape, theValue, theParams)
  879. {
  880. aWorkingArea := CVUI._Rect(theShape.x + this._internal.trackbarMarginX, theShape.y, theShape.width - 2 * this._internal.trackbarMarginX, theShape.height)
  881. this.trackbarPath(theBlock, theState, theShape, theValue, theParams, aWorkingArea)
  882. aHideAllLabels := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_HIDE_LABELS)
  883. aShowSteps := this._internal.bitsetHas(theParams.options, CVUI.TRACKBAR_HIDE_STEP_SCALE) == False
  884. if aShowSteps and (aHideAllLabels == False)
  885. this.trackbarSteps(theBlock, theState, theShape, theValue, theParams, aWorkingArea)
  886. if aHideAllLabels == False
  887. this.trackbarSegments(theBlock, theState, theShape, theValue, theParams, aWorkingArea)
  888. this.trackbarHandle(theBlock, theState, theShape, theValue, theParams, aWorkingArea)
  889. }
  890. checkbox(theBlock, theState, theShape)
  891. {
  892. ; Outline
  893. this.rectangle(theBlock.where, theShape, (theState == CVUI.OUT) ? [0x63, 0x63, 0x63] : [0x80, 0x80, 0x80])
  894. ; Border
  895. theShape.x += 1
  896. theShape.y+=1
  897. theShape.width -= 2
  898. theShape.height -= 2
  899. this.rectangle(theBlock.where, theShape, [0x17, 0x17, 0x17])
  900. ; Inside
  901. theShape.x += 1
  902. theShape.y += 1
  903. theShape.width -= 2
  904. theShape.height -= 2
  905. this.rectangle(theBlock.where, theShape, [0x29, 0x29, 0x29], CVUI.CVUI_FILLED)
  906. }
  907. checkboxLabel(theBlock, theRect, theLabel, theTextSize, theColor)
  908. {
  909. aPos := CVUI._Point(theRect.x + theRect.width + 6, theRect.y + theTextSize.height + theRect.height / 2 - theTextSize.height / 2 - 1)
  910. this.text(theBlock, theLabel, aPos, 0.4, theColor)
  911. }
  912. checkboxCheck(theBlock, theShape)
  913. {
  914. theShape.x += 1
  915. theShape.y += 1
  916. theShape.width -= 2
  917. theShape.height -= 2
  918. this.rectangle(theBlock.where, theShape, [0xFF, 0xBF, 0x75], CVUI.CVUI_FILLED)
  919. }
  920. window(theBlock, theTitleBar, theContent, theTitle)
  921. {
  922. Global aOverlay
  923. aTransparecy := False
  924. aAlpha := 0.3
  925. aOverlay.MAT := theBlock.where.MAT.copy()
  926. tomat(aOverlay, aOverlay.MAT)
  927. ; CVUI.Render borders in the title bar
  928. this.rectangle(theBlock.where, theTitleBar, [0x4A, 0x4A, 0x4A])
  929. ; CVUI.Render the inside of the title bar
  930. theTitleBar.x += 1
  931. theTitleBar.y += 1
  932. theTitleBar.width -= 2
  933. theTitleBar.height -= 2
  934. this.rectangle(theBlock.where, theTitleBar, [0x21, 0x21, 0x21], CVUI.CVUI_FILLED)
  935. ; CVUI.Render title text.
  936. aPos := CVUI._Point(theTitleBar.x + 5, theTitleBar.y + 12)
  937. cv2.putText(theBlock.where, theTitle, [int(aPos.x), int(aPos.y)], cv2.FONT_HERSHEY_SIMPLEX, 0.4, [0xCE, 0xCE, 0xCE], 1, CVUI.CVUI_ANTIALISED)
  938. ; CVUI.Render borders of the body
  939. this.rectangle(theBlock.where, theContent, [0x4A, 0x4A, 0x4A])
  940. ; CVUI.Render the body filling.
  941. theContent.x += 1
  942. theContent.y += 1
  943. theContent.width -= 2
  944. theContent.height -= 2
  945. this.rectangle(aOverlay, theContent, [0x31, 0x31, 0x31], CVUI.CVUI_FILLED)
  946. if aTransparecy
  947. {
  948. theBlock.where.copyTo(aOverlay)
  949. this.rectangle(aOverlay, theContent, [0x31, 0x31, 0x31], CVUI.CVUI_FILLED)
  950. theBlock.where := cv2.addWeighted(aOverlay, aAlpha, theBlock.where, 1.0 - aAlpha, 0.0)
  951. }
  952. else
  953. this.rectangle(theBlock.where, theContent, [0x31, 0x31, 0x31], CVUI.CVUI_FILLED)
  954. }
  955. rect(theBlock, thePos, theBorderColor, theFillingColor)
  956. {
  957. aBorderColor := this._internal.hexToScalar(theBorderColor)
  958. aFillingColor := this._internal.hexToScalar(theFillingColor)
  959. aHasFilling := aFillingColor[4] != 0xff
  960. if aHasFilling
  961. this.rectangle(theBlock.where, thePos, aFillingColor, CVUI.CVUI_FILLED, CVUI.CVUI_ANTIALISED)
  962. ; CVUI.Render the border
  963. this.rectangle(theBlock.where, thePos, aBorderColor)
  964. }
  965. sparkline(theBlock, theValues, theRect, theMin, theMax, theColor)
  966. {
  967. aSize := len(theValues)
  968. i := 0
  969. aScale := theMax - theMin
  970. aGap := float(theRect.width) / aSize
  971. aPosX := theRect.x
  972. while i <= aSize - 2
  973. {
  974. x := aPosX
  975. y := (theValues[i + 1] - theMin) / aScale * -(theRect.height - 5) + theRect.y + theRect.height - 5
  976. aPoint1 := CVUI._Point(x, y)
  977. x := aPosX + aGap
  978. y := (theValues[i + 1] - theMin) / aScale * -(theRect.height - 5) + theRect.y + theRect.height - 5
  979. aPoint2 := CVUI._Point(x, y)
  980. cv2.line(theBlock.where, [int(aPoint1.x), int(aPoint1.y)], [int(aPoint2.x), int(aPoint2.y)], this._internal.hexToScalar(theColor))
  981. aPosX += aGap
  982. i += 1
  983. }
  984. }
  985. }
  986. initf1(theWindowName, theDelayWaitKey := -1, theCreateNamedWindow := True)
  987. {
  988. /*
  989. Initializes cvui. You must provide the name of the window where
  990. components will be added. It is also possible to tell cvui to handle
  991. OpenCV's event queue automatically (by informing a value greater than zero
  992. in the `theDelayWaitKey` parameter of the function). In that case, cvui will
  993. automatically call `cv2.waitKey()` within `cvui.update()`, so you don't
  994. have to worry about it. The value passed to `theDelayWaitKey` will be
  995. used as the delay for `cv2.waitKey()`.
  996. Parameters
  997. ----------
  998. theWindowName str
  999. name of the window where the components will be added.
  1000. theDelayWaitKey int
  1001. delay value passed to `cv2.waitKey()`. If a negative value is informed (default is `-1`), cvui will not automatically call `cv2.waitKey()` within `cvui.update()`, which will disable keyboard shortcuts for all components. If you want to enable keyboard shortcut for components (e.g. using & in a button label), you must specify a positive value for this param.
  1002. theCreateNamedWindow bool
  1003. if an OpenCV window named `theWindowName` should be created during the initialization. Windows are created using `cv2.namedWindow()`. If this parameter is `False`, ensure you call `cv2.namedWindow(WINDOW_NAME)` *before* initializing cvui, otherwise it will not be able to track UI interactions.
  1004. See Also
  1005. ----------
  1006. watch()
  1007. context()
  1008. */
  1009. printc('This is wrapper function to help code autocompletion.')
  1010. }
  1011. initf2(theWindowNames, theHowManyWindows, theDelayWaitKey := -1, theCreateNamedWindows := True)
  1012. {
  1013. /*
  1014. Initialize cvui using a list of names of windows where components will be added.
  1015. It is also possible to tell cvui to handle OpenCV's event queue automatically
  1016. (by informing a value greater than zero in the `theDelayWaitKey` parameter of the function).
  1017. In that case, cvui will automatically call `cv2.waitKey()` within `cvui.update()`,
  1018. so you don't have to worry about it. The value passed to `theDelayWaitKey` will be
  1019. used as the delay for `cv2.waitKey()`.
  1020. Parameters
  1021. ----------
  1022. theWindowNames str
  1023. array containing the name of the windows where components will be added. Those windows will be automatically if `theCreateNamedWindows` is `True`.
  1024. theHowManyWindows int
  1025. how many window names exist in the `theWindowNames` array.
  1026. theDelayWaitKey int
  1027. delay value passed to `cv2.waitKey()`. If a negative value is informed (default is `-1`), cvui will not automatically call `cv2.waitKey()` within `cvui.update()`, which will disable keyboard shortcuts for all components. If you want to enable keyboard shortcut for components (e.g. using & in a button label), you must specify a positive value for this param.
  1028. theCreateNamedWindows bool
  1029. if OpenCV windows named according to `theWindowNames` should be created during the initialization. Windows are created using `cv2.namedWindow()`. If this parameter is `False`, ensure you call `cv2.namedWindow(WINDOW_NAME)` for all windows *before* initializing cvui, otherwise it will not be able to track UI interactions.
  1030. See Also
  1031. ----------
  1032. watch()
  1033. context()
  1034. */
  1035. printc('This is wrapper function to help code autocompletion.')
  1036. }
  1037. Static watch(theWindowName, theCreateNamedWindow := True)
  1038. {
  1039. Global theContext
  1040. /*
  1041. Track UI interactions of a particular window. This function must be invoked
  1042. for any window that will receive cvui components. cvui automatically calls `cvui.watch()`
  1043. for any window informed in `cvui.init()`, so generally you don't have to watch them
  1044. yourthis. If you initialized cvui and told it *not* to create windows automatically,
  1045. you need to call `cvui.watch()` on those windows yourthis. `cvui.watch()` can
  1046. automatically create a window before watching it, if it does not exist.
  1047. Parameters
  1048. ----------
  1049. theWindowName str
  1050. name of the window whose UI interactions will be tracked.
  1051. theCreateNamedWindow bool
  1052. if an OpenCV window named `theWindowName` should be created before it is watched. Windows are created using `cv2.namedWindow()`. If this parameter is `False`, ensure you have called `cv2.namedWindow(WINDOW_NAME)` to create the window, otherwise cvui will not be able to track its UI interactions.
  1053. See Also
  1054. ----------
  1055. init()
  1056. context()
  1057. */
  1058. if theCreateNamedWindow
  1059. cv2.namedWindow(theWindowName)
  1060. theContext.windowName := theWindowName
  1061. theContext.mouse.position.x := 0
  1062. theContext.mouse.position.y := 0
  1063. theContext.mouse.anyButton.reset()
  1064. theContext.mouse.buttons[CVUI.RIGHT_BUTTON].reset()
  1065. theContext.mouse.buttons[CVUI.MIDDLE_BUTTON].reset()
  1066. theContext.mouse.buttons[CVUI.LEFT_BUTTON].reset()
  1067. __internal.contexts[theWindowName] := theContext.Clone()
  1068. cv2.setMouseCallback(theWindowName, _handleMouse)
  1069. }
  1070. Static contextf1(theWindowName)
  1071. {
  1072. /*
  1073. Inform cvui that all subsequent component calls belong to a window in particular.
  1074. When using cvui with multiple OpenCV windows, you must call cvui component calls
  1075. between `cvui.contex(NAME)` and `cvui.update(NAME)`, where `NAME` is the name of
  1076. the window. That way, cvui knows which window you are using (`NAME` in this case),
  1077. so it can track mouse events, for instance.
  1078. E.g.
  1079. ```
  1080. ; Code for window 'window1'.
  1081. cvui.context('window1')
  1082. cvui.text(frame, ...)
  1083. cvui.button(frame, ...)
  1084. cvui.update('window1')
  1085. ; somewhere else, code for 'window2'
  1086. cvui.context('window2')
  1087. cvui.printf(frame, ...)
  1088. cvui.printf(frame, ...)
  1089. cvui.update('window2')
  1090. ; Show everything in a window
  1091. cv2.imshow(frame)
  1092. ```
  1093. Pay attention to the pair `cvui.context(NAME)` and `cvui.update(NAME)`, which
  1094. encloses the component calls for that window. You need such pair for each window
  1095. of your application.
  1096. After calling `cvui.update()`, you can show the result in a window using `cv2.imshow()`.
  1097. If you want to save some typing, you can use `cvui.imshow()`, which calls `cvui.update()`
  1098. for you and then shows the frame in a window.
  1099. E.g.:
  1100. ```
  1101. ; Code for window 'window1'.
  1102. cvui.context('window1')
  1103. cvui.text(frame, ...)
  1104. cvui.button(frame, ...)
  1105. cvui.imshow('window1')
  1106. ; somewhere else, code for 'window2'
  1107. cvui.context('window2')
  1108. cvui.printf(frame, ...)
  1109. cvui.printf(frame, ...)
  1110. cvui.imshow('window2')
  1111. ```
  1112. In that case, you don't have to bother calling `cvui.update()` yoursince
  1113. `cvui.imshow()` will do it for you.
  1114. Parameters
  1115. ----------
  1116. theWindowName str
  1117. name of the window that will receive components from all subsequent cvui calls.
  1118. See Also
  1119. ----------
  1120. init()
  1121. watch()
  1122. */
  1123. __internal.currentContext := theWindowName
  1124. }
  1125. Static imshow(theWindowName, theFrame)
  1126. {
  1127. /*
  1128. Display an image in the specified window and update the internal structures of cvui.
  1129. This function can be used as a replacement for `cv2.imshow()`. If you want to use
  1130. `cv2.imshow() instead of `cvui.imshow()`, you must ensure you call `cvui.update()`
  1131. *after* all component calls and *before* `cv2.imshow()`, so cvui can update its
  1132. internal structures.
  1133. In general, it is easier to call `cvui.imshow()` alone instead of calling
  1134. `cvui.update()' immediately followed by `cv2.imshow()`.
  1135. Parameters
  1136. ----------
  1137. theWindowName str
  1138. name of the window that will be shown.
  1139. theFrame np.ndarray
  1140. image, i.e. `np.ndarray`, to be shown in the window.
  1141. See Also
  1142. ----------
  1143. update()
  1144. context()
  1145. watch()
  1146. */
  1147. CVUI.update(theWindowName)
  1148. cv2.imshow(theWindowName, theFrame)
  1149. }
  1150. Static lastKeyPressed()
  1151. {
  1152. /*
  1153. Return the last key that was pressed. This function will only
  1154. work if a value greater than zero was passed to `cvui.init()`
  1155. as the delay waitkey parameter.
  1156. See Also
  1157. ----------
  1158. init()
  1159. */
  1160. return __internal.lastKeyPressed
  1161. }
  1162. Static mousef1(theWindowName := '')
  1163. {
  1164. /*
  1165. Return the last position of the mouse.
  1166. Parameters
  1167. ----------
  1168. theWindowName str
  1169. name of the window whose mouse cursor will be used. If nothing is informed (default), the function will return the position of the mouse cursor for the default window (the one informed in `cvui.init()`).
  1170. Returns
  1171. ----------
  1172. a point containing the position of the mouse cursor in the speficied window.
  1173. */
  1174. printc('This is wrapper function to help code autocompletion.')
  1175. }
  1176. Static mousef2(theQuery)
  1177. {
  1178. /*
  1179. Query the mouse for events, e.g. 'is any button down now?'. Available queries are
  1180. * `cvui.DOWN`: any mouse button was pressed. `cvui.mouse()` returns `True` for a single frame only.
  1181. * `cvui.UP`: any mouse button was released. `cvui.mouse()` returns `True` for a single frame only.
  1182. * `cvui.CLICK`: any mouse button was clicked (went down then up, no matter the amount of frames in between). `cvui.mouse()` returns `True` for a single frame only.
  1183. * `cvui.IS_DOWN`: any mouse button is currently pressed. `cvui.mouse()` returns `True` for as long as the button is down/pressed.
  1184. It is easier to think of this function as the answer to a questions. For instance, asking if any mouse button went down
  1185. ```
  1186. if cvui.mouse(cvui.DOWN):
  1187. ; Any mouse button just went down.
  1188. ```
  1189. The window whose mouse will be queried depends on the context. If `cvui.mouse(query)` is being called after
  1190. `cvui.context()`, the window informed in the context will be queried. If no context is available, the default
  1191. window (informed in `cvui.init()`) will be used.
  1192. Parameters
  1193. ----------
  1194. theQuery int
  1195. an integer describing the intended mouse query. Available queries are `cvui.DOWN`, `cvui.UP`, `cvui.CLICK`, and `cvui.IS_DOWN`.
  1196. See Also
  1197. ----------
  1198. mouse(str)
  1199. mouse(str, int)
  1200. mouse(str, int, int)
  1201. mouse(int, int)
  1202. */
  1203. printc('This is wrapper function to help code autocompletion.')
  1204. }
  1205. Static mousef3(theWindowName, theQuery)
  1206. {
  1207. /*
  1208. Query the mouse for events in a particular window. This function behave exactly like `cvui.mouse(int theQuery)`
  1209. with the difference that queries are targeted at a particular window.
  1210. Parameters
  1211. ----------
  1212. theWindowName str
  1213. name of the window that will be queried.
  1214. theQuery int
  1215. an integer describing the intended mouse query. Available queries are `cvui.DOWN`, `cvui.UP`, `cvui.CLICK`, and `cvui.IS_DOWN`.
  1216. See Also
  1217. ----------
  1218. mouse(str)
  1219. mouse(str, int, int)
  1220. mouse(int, int)
  1221. mouse(int)
  1222. */
  1223. printc('This is wrapper function to help code autocompletion.')
  1224. }
  1225. Static mousef4(theButton, theQuery)
  1226. {
  1227. /*
  1228. Query the mouse for events in a particular button. This function behave exactly like `cvui.mouse(int theQuery)`,
  1229. with the difference that queries are targeted at a particular mouse button instead.
  1230. Parameters
  1231. ----------
  1232. theButton int
  1233. an integer describing the mouse button to be queried. Possible values are `cvui.CVUI.LEFT_BUTTON`, `cvui.CVUI.MIDDLE_BUTTON` and `cvui.CVUI.LEFT_BUTTON`.
  1234. theQuery int
  1235. an integer describing the intended mouse query. Available queries are `cvui.DOWN`, `cvui.UP`, `cvui.CLICK`, and `cvui.IS_DOWN`.
  1236. See Also
  1237. ----------
  1238. mouse(str)
  1239. mouse(str, int, int)
  1240. mouse(int)
  1241. */
  1242. printc('This is wrapper function to help code autocompletion.')
  1243. }
  1244. Static mousef5(theWindowName, theButton, theQuery)
  1245. {
  1246. /*
  1247. Query the mouse for events in a particular button in a particular window. This function behave exactly
  1248. like `cvui.mouse(int theButton, int theQuery)`, with the difference that queries are targeted at
  1249. a particular mouse button in a particular window instead.
  1250. Parameters
  1251. ----------
  1252. theWindowName str
  1253. name of the window that will be queried.
  1254. theButton int
  1255. an integer describing the mouse button to be queried. Possible values are `cvui.CVUI.LEFT_BUTTON`, `cvui.CVUI.MIDDLE_BUTTON` and `cvui.CVUI.LEFT_BUTTON`.
  1256. theQuery int
  1257. an integer describing the intended mouse query. Available queries are `cvui.DOWN`, `cvui.UP`, `cvui.CLICK`, and `cvui.IS_DOWN`.
  1258. */
  1259. printc('This is wrapper function to help code autocompletion.')
  1260. }
  1261. Static buttonf1(theWhere, theX, theY, theLabel)
  1262. {
  1263. /*
  1264. Display a button. The size of the button will be automatically adjusted to
  1265. properly house the label content.
  1266. Parameters
  1267. ----------
  1268. theWhere np.ndarray
  1269. image/frame where the component should be rendered.
  1270. theX int
  1271. position X where the component should be placed.
  1272. theY int
  1273. position Y where the component should be placed.
  1274. theLabel str
  1275. text displayed inside the button.
  1276. Returns
  1277. ----------
  1278. `true` everytime the user clicks the button.
  1279. */
  1280. printc('This is wrapper function to help code autocompletion.')
  1281. }
  1282. Static buttonf2(theWhere, theX, theY, theWidth, theHeight, theLabel)
  1283. {
  1284. /*
  1285. Display a button. The button size will be defined by the width and height parameters,
  1286. no matter the content of the label.
  1287. Parameters
  1288. ----------
  1289. theWhere np.ndarray
  1290. image/frame where the component should be rendered.
  1291. theX int
  1292. position X where the component should be placed.
  1293. theY int
  1294. position Y where the component should be placed.
  1295. theWidth int
  1296. width of the button.
  1297. theHeight int
  1298. height of the button.
  1299. theLabel str
  1300. text displayed inside the button.
  1301. Returns
  1302. ----------
  1303. `true` everytime the user clicks the button.
  1304. */
  1305. printc('This is wrapper function to help code autocompletion.')
  1306. }
  1307. Static buttonf3(theWhere, theX, theY, theIdle, theOver, theDown)
  1308. {
  1309. /*
  1310. Display a button whose graphics are images (np.ndarray). The button accepts three images to describe its states,
  1311. which are idle (no mouse interaction), over (mouse is over the button) and down (mouse clicked the button).
  1312. The button size will be defined by the width and height of the images.
  1313. Parameters
  1314. ----------
  1315. theWhere np.ndarray
  1316. image/frame where the component should be rendered.
  1317. theX int
  1318. position X where the component should be placed.
  1319. theY int
  1320. position Y where the component should be placed.
  1321. theIdle np.ndarray
  1322. an image that will be rendered when the button is not interacting with the mouse cursor.
  1323. theOver np.ndarray
  1324. an image that will be rendered when the mouse cursor is over the button.
  1325. theDown np.ndarray
  1326. an image that will be rendered when the mouse cursor clicked the button (or is clicking).
  1327. Returns
  1328. ----------
  1329. `true` everytime the user clicks the button.
  1330. See Also
  1331. ----------
  1332. button()
  1333. image()
  1334. iarea()
  1335. */
  1336. printc('This is wrapper function to help code autocompletion.')
  1337. }
  1338. Static imagef1(theWhere, theX, theY, theImage)
  1339. {
  1340. /*
  1341. Display an image (np.ndarray).
  1342. Parameters
  1343. ----------
  1344. theWhere np.ndarray
  1345. image/frame where the provded image should be rendered.
  1346. theX int
  1347. position X where the image should be placed.
  1348. theY int
  1349. position Y where the image should be placed.
  1350. theImage np.ndarray
  1351. image to be rendered in the specified destination.
  1352. See Also
  1353. ----------
  1354. button()
  1355. iarea()
  1356. */
  1357. printc('This is wrapper function to help code autocompletion.')
  1358. }
  1359. Static checkboxf1(theWhere, theX, theY, theLabel, theState, theColor := 0xCECECE)
  1360. {
  1361. /*
  1362. Display a checkbox. You can use the state parameter to monitor if the
  1363. checkbox is checked or not.
  1364. Parameters
  1365. ----------
  1366. theWhere np.ndarray
  1367. image/frame where the component should be rendered.
  1368. theX int
  1369. position X where the component should be placed.
  1370. theY int
  1371. position Y where the component should be placed.
  1372. theLabel str
  1373. text displayed besides the clickable checkbox square.
  1374. theState [bool]
  1375. array or list of booleans whose first position, i.e. theState[0], will be used to store the current state of the checkbox `True` means the checkbox is checked.
  1376. theColor uint
  1377. color of the label in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1378. Returns
  1379. ----------
  1380. a boolean value that indicates the current state of the checkbox, `true` if it is checked.
  1381. */
  1382. printc('This is wrapper function to help code autocompletion.')
  1383. }
  1384. Static textf1(theWhere, theX, theY, theText, theFontScale := 0.4, theColor := 0xCECECE)
  1385. {
  1386. /*
  1387. Display a piece of text.
  1388. Parameters
  1389. ----------
  1390. theWhere np.ndarray
  1391. image/frame where the component should be rendered.
  1392. theX int
  1393. position X where the component should be placed.
  1394. theY int
  1395. position Y where the component should be placed.
  1396. theText str
  1397. the text content.
  1398. theFontScale float
  1399. size of the text.
  1400. theColor uint
  1401. color of the text in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1402. See Also
  1403. ----------
  1404. printf()
  1405. */
  1406. printc('This is wrapper function to help code autocompletion.')
  1407. }
  1408. Static printff1(theWhere, theX, theY, theFontScale, theColor, theFmt)
  1409. {
  1410. /*
  1411. Display a piece of text that can be formated using `C stdio's printf()` style. For instance
  1412. if you want to display text mixed with numbers, you can use
  1413. ```
  1414. printf(frame, 10, 15, 0.4, 0xff0000, 'Text %d and %f', 7, 3.1415)
  1415. ```
  1416. Parameters
  1417. ----------
  1418. theWhere np.ndarray
  1419. image/frame where the component should be rendered.
  1420. theX int
  1421. position X where the component should be placed.
  1422. theY int
  1423. position Y where the component should be placed.
  1424. theFontScale float
  1425. size of the text.
  1426. theColor uint
  1427. color of the text in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1428. theFmt str
  1429. formating string as it would be supplied for `stdio's printf()`, e.g. `'Text %d and %f', 7, 3.1415`.
  1430. See Also
  1431. ----------
  1432. text()
  1433. */
  1434. printc('This is wrapper function to help code autocompletion.')
  1435. }
  1436. Static printff2(theWhere, theX, theY, theFmt)
  1437. {
  1438. /*
  1439. Display a piece of text that can be formated using `C stdio's printf()` style. For instance
  1440. if you want to display text mixed with numbers, you can use
  1441. ```
  1442. printf(frame, 10, 15, 0.4, 0xff0000, 'Text %d and %f', 7, 3.1415)
  1443. ```
  1444. The size and color of the text will be based on cvui's default values.
  1445. Parameters
  1446. ----------
  1447. theWhere np.ndarray
  1448. image/frame where the component should be rendered.
  1449. theX int
  1450. position X where the component should be placed.
  1451. theY int
  1452. position Y where the component should be placed.
  1453. theFmt str
  1454. formating string as it would be supplied for `stdio's printf()`, e.g. `'Text %d and %f', 7, 3.1415`.
  1455. See Also
  1456. ----------
  1457. text()
  1458. */
  1459. printc('This is wrapper function to help code autocompletion.')
  1460. }
  1461. Static counterf1(theWhere, theX, theY, theValue, theStep := 1, theFormat := '%d')
  1462. {
  1463. /*
  1464. Display a counter for integer values that the user can increase/descrease
  1465. by clicking the up and down arrows.
  1466. Parameters
  1467. ----------
  1468. theWhere np.ndarray
  1469. image/frame where the component should be rendered.
  1470. theX int
  1471. position X where the component should be placed.
  1472. theY int
  1473. position Y where the component should be placed.
  1474. theValue [number]
  1475. array or list of numbers whose first position, i.e. theValue[1], will be used to store the current value of the counter.
  1476. theStep number
  1477. amount that should be increased/decreased when the user interacts with the counter buttons
  1478. theFormat str
  1479. how the value of the counter should be presented, as it was printed by `stdio's printf()`. E.g. `'%d'` means the value will be displayed as an integer, `'%0d'` integer with one leading zero, etc.
  1480. Returns
  1481. ----------
  1482. number that corresponds to the current value of the counter.
  1483. */
  1484. printc('This is wrapper function to help code autocompletion.')
  1485. }
  1486. Static trackbarf1(theWhere, theX, theY, theWidth, theValue, theMin, theMax, theSegments := 1, theLabelFormat := '%.1Lf', theOptions := 0, theDiscreteStep := 1)
  1487. {
  1488. /*
  1489. Display a trackbar for numeric values that the user can increase/decrease
  1490. by clicking and/or dragging the marker right or left. This component can use
  1491. different types of data as its value, so it is imperative provide the right
  1492. label format, e.g. '%d' for ints, otherwise you might end up with weird errors.
  1493. Example
  1494. ```
  1495. ; using float
  1496. trackbar(where, x, y, width, &floatValue, 0.0, 50.0)
  1497. ; using float
  1498. trackbar(where, x, y, width, &floatValue, 0.0f, 50.0f)
  1499. ; using char
  1500. trackbar(where, x, y, width, &charValue, (char)1, (char)10)
  1501. ```
  1502. Parameters
  1503. ----------
  1504. theWhere np.ndarray
  1505. image/frame where the component should be rendered.
  1506. theX int
  1507. position X where the component should be placed.
  1508. theY int
  1509. position Y where the component should be placed.
  1510. theWidth int
  1511. width of the trackbar.
  1512. theValue [number]
  1513. array or list of numbers whose first position, i.e. theValue[1], will be used to store the current value of the trackbar. It will be modified when the user interacts with the trackbar. Any numeric type can be used, e.g. int, float, long double, etc.
  1514. theMin number
  1515. minimum value allowed for the trackbar.
  1516. theMax number
  1517. maximum value allowed for the trackbar.
  1518. theSegments int
  1519. number of segments the trackbar will have (default is 1). Segments can be seen as groups of numbers in the scale of the trackbar. For example, 1 segment means a single groups of values (no extra labels along the scale), 2 segments mean the trackbar values will be divided in two groups and a label will be placed at the middle of the scale.
  1520. theLabelFormat str
  1521. formating string that will be used to render the labels. If you are using a trackbar with integers values, for instance, you can use `%d` to render labels.
  1522. theOptions uint
  1523. options to customize the behavior/appearance of the trackbar, expressed as a bitset. Available options are defined as `cvui.TRACKBAR_` constants and they can be combined using the bitwise `|` operand. Available options are `TRACKBAR_HIDE_SEGMENT_LABELS` (do not render segment labels, but do render min/max labels), `TRACKBAR_HIDE_STEP_SCALE` (do not render the small lines indicating values in the scale), `TRACKBAR_DISCRETE` (changes of the trackbar value are multiples of theDiscreteStep param), `TRACKBAR_HIDE_MIN_MAX_LABELS` (do not render min/max labels), `TRACKBAR_HIDE_VALUE_LABEL` (do not render the current value of the trackbar below the moving marker), `TRACKBAR_HIDE_LABELS` (do not render labels at all).
  1524. theDiscreteStep number
  1525. amount that the trackbar marker will increase/decrease when the marker is dragged right/left (if option TRACKBAR_DISCRETE is ON)
  1526. Returns
  1527. ----------
  1528. `true` when the value of the trackbar changed.
  1529. See Also
  1530. ----------
  1531. counter()
  1532. */
  1533. printc('This is wrapper function to help code autocompletion.')
  1534. }
  1535. Static windowf1(theWhere, theX, theY, theWidth, theHeight, theTitle)
  1536. {
  1537. /*
  1538. Display a window (a block with a title and a body).
  1539. Parameters
  1540. ----------
  1541. theWhere np.ndarray
  1542. image/frame where the component should be rendered.
  1543. theX int
  1544. position X where the component should be placed.
  1545. theY int
  1546. position Y where the component should be placed.
  1547. theWidth int
  1548. width of the window.
  1549. theHeight int
  1550. height of the window.
  1551. theTitle str
  1552. text displayed as the title of the window.
  1553. See Also
  1554. ----------
  1555. rect()
  1556. */
  1557. printc('This is wrapper function to help code autocompletion.')
  1558. }
  1559. Static rectf1(theWhere, theX, theY, theWidth, theHeight, theBorderColor, theFillingColor := 0xff000000)
  1560. {
  1561. /*
  1562. Display a filled rectangle.
  1563. Parameters
  1564. ----------
  1565. theWhere np.ndarray
  1566. image/frame where the component should be rendered.
  1567. theX int
  1568. position X where the component should be placed.
  1569. theY int
  1570. position Y where the component should be placed.
  1571. theWidth int
  1572. width of the rectangle.
  1573. theHeight int
  1574. height of the rectangle.
  1575. theBorderColor uint
  1576. color of rectangle's border in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1577. theFillingColor uint
  1578. color of rectangle's filling in the format `0xAARRGGBB`, e.g. `0x00ff0000` for red, `0xff000000` for transparent filling.
  1579. See Also
  1580. ----------
  1581. image()
  1582. */
  1583. printc('This is wrapper function to help code autocompletion.')
  1584. }
  1585. Static sparklinef1(theWhere, theValues, theX, theY, theWidth, theHeight, theColor := 0x00FF00)
  1586. {
  1587. /*
  1588. Display the values of a vector as a sparkline.
  1589. Parameters
  1590. ----------
  1591. theWhere np.ndarray
  1592. image/frame where the component should be rendered.
  1593. theValues number[]
  1594. array or list containing the numeric values to be used in the sparkline.
  1595. theX int
  1596. position X where the component should be placed.
  1597. theY int
  1598. position Y where the component should be placed.
  1599. theWidth int
  1600. width of the sparkline.
  1601. theHeight int
  1602. height of the sparkline.
  1603. theColor uint
  1604. color of sparkline in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1605. See Also
  1606. ----------
  1607. trackbar()
  1608. */
  1609. printc('This is wrapper function to help code autocompletion.')
  1610. }
  1611. Static iarea(theX, theY, theWidth, theHeight)
  1612. {
  1613. /*
  1614. Create an interaction area that reports activity with the mouse cursor.
  1615. The tracked interactions are returned by the function and they are
  1616. `OUT` when the cursor is not over the iarea.
  1617. `OVER` when the cursor is over the iarea.
  1618. `DOWN` when the cursor is pressed over the iarea, but not released yet.
  1619. `CLICK` when the cursor clicked (pressed and released) within the iarea.
  1620. This function creates no visual output on the screen. It is intended to
  1621. be used as an auxiliary tool to create interactions.
  1622. Parameters
  1623. ----------
  1624. theX int
  1625. position X where the interactive area should be placed.
  1626. theY int
  1627. position Y where the interactive area should be placed.
  1628. theWidth int
  1629. width of the interactive area.
  1630. theHeight int
  1631. height of the interactive area.
  1632. Returns
  1633. ----------
  1634. integer value representing the current state of interaction with the mouse cursor. It can be `OUT` (cursor is not over the area), `OVER` (cursor is over the area), `DOWN` (cursor is pressed over the area, but not released yet) and `CLICK` (cursor clicked, i.e. pressed and released, within the area).
  1635. See Also
  1636. ----------
  1637. button()
  1638. image()
  1639. */
  1640. return __internal.iarea(theX, theY, theWidth, theHeight)
  1641. }
  1642. Static beginRowf1(theWhere, theX, theY, theWidth := -1, theHeight := -1, thePadding := 0)
  1643. {
  1644. /*
  1645. Start a new row.
  1646. One of the most annoying tasks when building UI is to calculate
  1647. where each component should be placed on the screen. cvui has
  1648. a set of methods that abstract the process of positioning
  1649. components, so you don't have to think about assigning a
  1650. X and Y coordinate. Instead you just add components and cvui
  1651. will place them as you go.
  1652. You use `beginRow()` to start a group of elements. After `beginRow()`
  1653. has been called, all subsequent component calls don't have to specify
  1654. the frame where the component should be rendered nor its position.
  1655. The position of the component will be automatically calculated by cvui
  1656. based on the components within the group. All components are placed
  1657. side by side, from left to right.
  1658. E.g.
  1659. ```
  1660. beginRow(frame, x, y, width, height)
  1661. text('test')
  1662. button('btn')
  1663. endRow()
  1664. ```
  1665. Rows and columns can be nested, so you can create columns/rows within
  1666. columns/rows as much as you want. It's important to notice that any
  1667. component within `beginRow()` and `endRow()` *do not* specify the position
  1668. where the component is rendered, which is also True for `beginRow()`.
  1669. As a consequence, **be sure you are calling `beginRow(width, height)`
  1670. when the call is nested instead of `beginRow(x, y, width, height)`**,
  1671. otherwise cvui will throw an error.
  1672. E.g.
  1673. ```
  1674. beginRow(frame, x, y, width, height)
  1675. text('test')
  1676. button('btn')
  1677. beginColumn() ; no frame nor x,y parameters here!
  1678. text('column1')
  1679. text('column2')
  1680. endColumn()
  1681. endRow()
  1682. ```
  1683. Don't forget to call `endRow()` to finish the row, otherwise cvui will throw an error.
  1684. Parameters
  1685. ----------
  1686. theWhere np.ndarray
  1687. image/frame where the components within this block should be rendered.
  1688. theX int
  1689. position X where the row should be placed.
  1690. theY int
  1691. position Y where the row should be placed.
  1692. theWidth int
  1693. width of the row. If a negative value is specified, the width of the row will be automatically calculated based on the content of the block.
  1694. theHeight int
  1695. height of the row. If a negative value is specified, the height of the row will be automatically calculated based on the content of the block.
  1696. thePadding int
  1697. space, in pixels, among the components of the block.
  1698. See Also
  1699. ----------
  1700. beginColumn()
  1701. endRow()
  1702. endColumn()
  1703. */
  1704. printc('This is wrapper function to help code autocompletion.')
  1705. }
  1706. Static endRow()
  1707. {
  1708. /*
  1709. End a row. You must call this function only if you have previously called
  1710. its counter part, the `beginRow()` function.
  1711. See Also
  1712. ----------
  1713. beginRow()
  1714. beginColumn()
  1715. endColumn()
  1716. */
  1717. __internal.end(CVUI.ROW)
  1718. }
  1719. Static beginColumnf1(theWhere, theX, theY, theWidth := -1, theHeight := -1, thePadding := 0)
  1720. {
  1721. /*
  1722. Start a new column.
  1723. One of the most annoying tasks when building UI is to calculate
  1724. where each component should be placed on the screen. cvui has
  1725. a set of methods that abstract the process of positioning
  1726. components, so you don't have to think about assigning a
  1727. X and Y coordinate. Instead you just add components and cvui
  1728. will place them as you go.
  1729. You use `beginColumn()` to start a group of elements. After `beginColumn()`
  1730. has been called, all subsequent component calls don't have to specify
  1731. the frame where the component should be rendered nor its position.
  1732. The position of the component will be automatically calculated by cvui
  1733. based on the components within the group. All components are placed
  1734. below each other, from the top of the screen towards the bottom.
  1735. E.g.
  1736. ```
  1737. beginColumn(frame, x, y, width, height)
  1738. text('test')
  1739. button('btn')
  1740. endColumn()
  1741. ```
  1742. Rows and columns can be nested, so you can create columns/rows within
  1743. columns/rows as much as you want. It's important to notice that any
  1744. component within `beginColumn()` and `endColumn()` *do not* specify the position
  1745. where the component is rendered, which is also True for `beginColumn()`.
  1746. As a consequence, **be sure you are calling `beginColumn(width, height)`
  1747. when the call is nested instead of `beginColumn(x, y, width, height)`**,
  1748. otherwise cvui will throw an error.
  1749. E.g.
  1750. ```
  1751. beginColumn(frame, x, y, width, height)
  1752. text('test')
  1753. button('btn')
  1754. beginRow() ; no frame nor x,y parameters here!
  1755. text('column1')
  1756. text('column2')
  1757. endRow()
  1758. endColumn()
  1759. ```
  1760. Don't forget to call `endColumn()` to finish the column, otherwise cvui will throw an error.
  1761. Parameters
  1762. ----------
  1763. theWhere np.ndarray
  1764. image/frame where the components within this block should be rendered.
  1765. theX int
  1766. position X where the row should be placed.
  1767. theY int
  1768. position Y where the row should be placed.
  1769. theWidth int
  1770. width of the column. If a negative value is specified, the width of the column will be automatically calculated based on the content of the block.
  1771. theHeight int
  1772. height of the column. If a negative value is specified, the height of the column will be automatically calculated based on the content of the block.
  1773. thePadding int
  1774. space, in pixels, among the components of the block.
  1775. See Also
  1776. ----------
  1777. beginRow()
  1778. endColumn()
  1779. endRow()
  1780. */
  1781. printc('This is wrapper function to help code autocompletion.')
  1782. }
  1783. Static endColumn()
  1784. {
  1785. /*
  1786. End a column. You must call this function only if you have previously called
  1787. its counter part, i.e. `beginColumn()`.
  1788. See Also
  1789. ----------
  1790. beginColumn()
  1791. beginRow()
  1792. endRow()
  1793. */
  1794. __internal.end(CVUI.COLUMN)
  1795. }
  1796. Static beginRowf2(theWidth := -1, theHeight := -1, thePadding := 0)
  1797. {
  1798. /*
  1799. Start a row. This function behaves in the same way as `beginRow(frame, x, y, width, height)`,
  1800. however it is suposed to be used within `begin*()/end*()` blocks since they require components
  1801. not to inform frame nor x,y coordinates.
  1802. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1803. Parameters
  1804. ----------
  1805. theWidth int
  1806. width of the row. If a negative value is specified, the width of the row will be automatically calculated based on the content of the block.
  1807. theHeight int
  1808. height of the row. If a negative value is specified, the height of the row will be automatically calculated based on the content of the block.
  1809. thePadding int
  1810. space, in pixels, among the components of the block.
  1811. See Also
  1812. ----------
  1813. beginColumn()
  1814. endRow()
  1815. endColumn()
  1816. */
  1817. printc('This is wrapper function to help code autocompletion.')
  1818. }
  1819. Static beginColumnf2(theWidth := -1, theHeight := -1, thePadding := 0)
  1820. {
  1821. /*
  1822. Start a column. This function behaves in the same way as `beginColumn(frame, x, y, width, height)`,
  1823. however it is suposed to be used within `begin*()/end*()` blocks since they require components
  1824. not to inform frame nor x,y coordinates.
  1825. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1826. Parameters
  1827. ----------
  1828. theWidth int
  1829. width of the column. If a negative value is specified, the width of the column will be automatically calculated based on the content of the block.
  1830. theHeight int
  1831. height of the column. If a negative value is specified, the height of the column will be automatically calculated based on the content of the block.
  1832. thePadding int
  1833. space, in pixels, among the components of the block.
  1834. See Also
  1835. ----------
  1836. beginColumn()
  1837. endRow()
  1838. endColumn()
  1839. */
  1840. printc('This is wrapper function to help code autocompletion.')
  1841. }
  1842. Static space(theValue := 5)
  1843. {
  1844. /*
  1845. Add an arbitrary amount of space between components within a `begin*()` and `end*()` block.
  1846. The function is aware of context, so if it is used within a `beginColumn()` and
  1847. `endColumn()` block, the space will be vertical. If it is used within a `beginRow()`
  1848. and `endRow()` block, space will be horizontal.
  1849. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1850. Parameters
  1851. ----------
  1852. theValue int
  1853. the amount of space to be added.
  1854. See Also
  1855. ----------
  1856. beginColumn()
  1857. beginRow()
  1858. endRow()
  1859. endColumn()
  1860. */
  1861. aBlock := __internal.topBlock()
  1862. aSize := CVUI._Size(theValue, theValue)
  1863. __internal.updateLayoutFlow(aBlock, aSize)
  1864. }
  1865. Static textf2(theText, theFontScale := 0.4, theColor := 0xCECECE)
  1866. {
  1867. /*
  1868. Display a piece of text within a `begin*()` and `end*()` block.
  1869. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1870. Parameters
  1871. ----------
  1872. theText str
  1873. text content.
  1874. theFontScale float
  1875. size of the text.
  1876. theColor uint
  1877. color of the text in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  1878. See Also
  1879. ----------
  1880. printf()
  1881. beginColumn()
  1882. beginRow()
  1883. endRow()
  1884. endColumn()
  1885. */
  1886. printc('This is wrapper function to help code autocompletion.')
  1887. }
  1888. Static buttonf4(theWidth, theHeight, theLabel)
  1889. {
  1890. /*
  1891. Display a button within a `begin*()` and `end*()` block.
  1892. The button size will be defined by the width and height parameters,
  1893. no matter the content of the label.
  1894. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1895. Parameters
  1896. ----------
  1897. theWidth int
  1898. width of the button.
  1899. theHeight int
  1900. height of the button.
  1901. theLabel str
  1902. text displayed inside the button. You can set shortcuts by pre-pending them with '&'
  1903. Returns
  1904. ----------
  1905. `true` everytime the user clicks the button.
  1906. See Also
  1907. ----------
  1908. beginColumn()
  1909. beginRow()
  1910. endRow()
  1911. endColumn()
  1912. */
  1913. printc('This is wrapper function to help code autocompletion.')
  1914. }
  1915. Static buttonf5(theLabel)
  1916. {
  1917. /*
  1918. Display a button within a `begin*()` and `end*()` block. The size of the button will be
  1919. automatically adjusted to properly house the label content.
  1920. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1921. Parameters
  1922. ----------
  1923. theLabel str
  1924. text displayed inside the button. You can set shortcuts by pre-pending them with '&'
  1925. Returns
  1926. ----------
  1927. `true` everytime the user clicks the button.
  1928. See Also
  1929. ----------
  1930. beginColumn()
  1931. beginRow()
  1932. endRow()
  1933. endColumn()
  1934. */
  1935. printc('This is wrapper function to help code autocompletion.')
  1936. }
  1937. Static buttonf6(theIdle, theOver, theDown)
  1938. {
  1939. /*
  1940. Display a button whose graphics are images (np.ndarray).
  1941. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1942. The button accepts three images to describe its states,
  1943. which are idle (no mouse interaction), over (mouse is over the button) and down (mouse clicked the button).
  1944. The button size will be defined by the width and height of the images.
  1945. Parameters
  1946. ----------
  1947. theIdle np.ndarray
  1948. image that will be rendered when the button is not interacting with the mouse cursor.
  1949. theOver np.ndarray
  1950. image that will be rendered when the mouse cursor is over the button.
  1951. theDown np.ndarray
  1952. image that will be rendered when the mouse cursor clicked the button (or is clicking).
  1953. Returns
  1954. ----------
  1955. `true` everytime the user clicks the button.
  1956. See Also
  1957. ----------
  1958. button()
  1959. image()
  1960. iarea()
  1961. beginColumn()
  1962. beginRow()
  1963. endRow()
  1964. endColumn()
  1965. */
  1966. printc('This is wrapper function to help code autocompletion.')
  1967. }
  1968. Static imagef2(theImage)
  1969. {
  1970. /*
  1971. Display an image (np.ndarray) within a `begin*()` and `end*()` block
  1972. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1973. Parameters
  1974. ----------
  1975. theImage np.ndarray
  1976. image to be rendered in the specified destination.
  1977. See Also
  1978. ----------
  1979. button()
  1980. iarea()
  1981. beginColumn()
  1982. beginRow()
  1983. endRow()
  1984. endColumn()
  1985. */
  1986. printc('This is wrapper function to help code autocompletion.')
  1987. }
  1988. Static checkboxf2(theLabel, theState, theColor := 0xCECECE)
  1989. {
  1990. /*
  1991. Display a checkbox within a `begin*()` and `end*()` block. You can use the state parameter
  1992. to monitor if the checkbox is checked or not.
  1993. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  1994. Parameters
  1995. ----------
  1996. theLabel str
  1997. text displayed besides the clickable checkbox square.
  1998. theState [bool]
  1999. array or list of booleans whose first position, i.e. theState[0], will be used to store the current state of the checkbox `True` means the checkbox is checked.
  2000. theColor uint
  2001. color of the label in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  2002. Returns
  2003. ----------
  2004. a boolean value that indicates the current state of the checkbox, `true` if it is checked.
  2005. See Also
  2006. ----------
  2007. beginColumn()
  2008. beginRow()
  2009. endRow()
  2010. endColumn()
  2011. */
  2012. printc('This is wrapper function to help code autocompletion.')
  2013. }
  2014. Static printff3(theFontScale, theColor, theFmt)
  2015. {
  2016. /*
  2017. Display a piece of text within a `begin*()` and `end*()` block.
  2018. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2019. The text can be formated using `C stdio's printf()` style. For instance if you want to display text mixed
  2020. with numbers, you can use
  2021. ```
  2022. printf(0.4, 0xff0000, 'Text %d and %f', 7, 3.1415)
  2023. ```
  2024. Parameters
  2025. ----------
  2026. theFontScale float
  2027. size of the text.
  2028. theColor uint
  2029. color of the text in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  2030. theFmt str
  2031. formating string as it would be supplied for `C stdio's printf()`, e.g. `'Text %d and %f', 7, 3.1415`.
  2032. See Also
  2033. ----------
  2034. text()
  2035. beginColumn()
  2036. beginRow()
  2037. endRow()
  2038. endColumn()
  2039. */
  2040. printc('This is wrapper function to help code autocompletion.')
  2041. }
  2042. Static printff4(theFmt)
  2043. {
  2044. /*
  2045. Display a piece of text that can be formated using `C stdio's printf()` style.
  2046. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2047. For instance if you want to display text mixed with numbers, you can use
  2048. ```
  2049. printf(frame, 10, 15, 0.4, 0xff0000, 'Text %d and %f', 7, 3.1415)
  2050. ```
  2051. The size and color of the text will be based on cvui's default values.
  2052. Parameters
  2053. ----------
  2054. theFmt str
  2055. formating string as it would be supplied for `stdio's printf()`, e.g. `'Text %d and %f', 7, 3.1415`.
  2056. See Also
  2057. ----------
  2058. text()
  2059. beginColumn()
  2060. beginRow()
  2061. endRow()
  2062. endColumn()
  2063. */
  2064. printc('This is wrapper function to help code autocompletion.')
  2065. }
  2066. Static counterf2(theValue, theStep := 1, theFormat := '%d')
  2067. {
  2068. /*
  2069. Display a counter for integer values that the user can increase/descrease
  2070. by clicking the up and down arrows.
  2071. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2072. Parameters
  2073. ----------
  2074. theValue [number]
  2075. array or list of numbers whose first position, i.e. theValue[1], will be used to store the current value of the counter.
  2076. theStep number
  2077. amount that should be increased/decreased when the user interacts with the counter buttons.
  2078. theFormat str
  2079. how the value of the counter should be presented, as it was printed by `C stdio's printf()`. E.g. `'%d'` means the value will be displayed as an integer, `'%0d'` integer with one leading zero, etc.
  2080. Returns
  2081. ----------
  2082. number that corresponds to the current value of the counter.
  2083. See Also
  2084. ----------
  2085. printf()
  2086. beginColumn()
  2087. beginRow()
  2088. endRow()
  2089. endColumn()
  2090. */
  2091. printc('This is wrapper function to help code autocompletion.')
  2092. }
  2093. Static trackbarf2(theWidth, theValue, theMin, theMax, theSegments := 1, theLabelFormat := '%.1Lf', theOptions := 0, theDiscreteStep := 1)
  2094. {
  2095. /*
  2096. Display a trackbar for numeric values that the user can increase/decrease
  2097. by clicking and/or dragging the marker right or left.
  2098. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2099. This component uses templates so it is imperative that you make it very explicit
  2100. the type of `theValue`, `theMin`, `theMax` and `theStep`, otherwise you might end up with
  2101. weird compilation errors.
  2102. Example
  2103. ```
  2104. ; using float
  2105. trackbar(width, &floatValue, 0.0, 50.0)
  2106. ; using float
  2107. trackbar(width, &floatValue, 0.0f, 50.0f)
  2108. ; using char
  2109. trackbar(width, &charValue, (char)1, (char)10)
  2110. ```
  2111. Parameters
  2112. ----------
  2113. theWidth int
  2114. the width of the trackbar.
  2115. theValue [number]
  2116. array or list of numbers whose first position, i.e. theValue[1], will be used to store the current value of the trackbar. It will be modified when the user interacts with the trackbar. Any numeric type can be used, e.g. int, float, long double, etc.
  2117. theMin number
  2118. minimum value allowed for the trackbar.
  2119. theMax number
  2120. maximum value allowed for the trackbar.
  2121. theSegments int
  2122. number of segments the trackbar will have (default is 1). Segments can be seen as groups of numbers in the scale of the trackbar. For example, 1 segment means a single groups of values (no extra labels along the scale), 2 segments mean the trackbar values will be divided in two groups and a label will be placed at the middle of the scale.
  2123. theLabelFormat str
  2124. formating string that will be used to render the labels, e.g. `%.2Lf`. No matter the type of the `theValue` param, internally trackbar stores it as a `long float`, so the formating string will *always* receive a `long float` value to format. If you are using a trackbar with integers values, for instance, you can supress decimals using a formating string as `%.0Lf` to format your labels.
  2125. theOptions uint
  2126. options to customize the behavior/appearance of the trackbar, expressed as a bitset. Available options are defined as `TRACKBAR_` constants and they can be combined using the bitwise `|` operand. Available options are `TRACKBAR_HIDE_SEGMENT_LABELS` (do not render segment labels, but do render min/max labels), `TRACKBAR_HIDE_STEP_SCALE` (do not render the small lines indicating values in the scale), `TRACKBAR_DISCRETE` (changes of the trackbar value are multiples of informed step param), `TRACKBAR_HIDE_MIN_MAX_LABELS` (do not render min/max labels), `TRACKBAR_HIDE_VALUE_LABEL` (do not render the current value of the trackbar below the moving marker), `TRACKBAR_HIDE_LABELS` (do not render labels at all).
  2127. theDiscreteStep number
  2128. amount that the trackbar marker will increase/decrease when the marker is dragged right/left (if option TRACKBAR_DISCRETE is ON)
  2129. Returns
  2130. ----------
  2131. `true` when the value of the trackbar changed.
  2132. See Also
  2133. ----------
  2134. counter()
  2135. beginColumn()
  2136. beginRow()
  2137. endRow()
  2138. endColumn()
  2139. */
  2140. printc('This is wrapper function to help code autocompletion.')
  2141. }
  2142. Static windowf2(theWidth, theHeight, theTitle)
  2143. {
  2144. /*
  2145. Display a window (a block with a title and a body) within a `begin*()` and `end*()` block.
  2146. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2147. Parameters
  2148. ----------
  2149. theWidth int
  2150. width of the window.
  2151. theHeight int
  2152. height of the window.
  2153. theTitle str
  2154. text displayed as the title of the window.
  2155. See Also
  2156. ----------
  2157. rect()
  2158. beginColumn()
  2159. beginRow()
  2160. endRow()
  2161. endColumn()
  2162. */
  2163. printc('This is wrapper function to help code autocompletion.')
  2164. }
  2165. Static rectf2(theWidth, theHeight, theBorderColor, theFillingColor := 0xff000000)
  2166. {
  2167. /*
  2168. Display a rectangle within a `begin*()` and `end*()` block.
  2169. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2170. Parameters
  2171. ----------
  2172. theWidth int
  2173. width of the rectangle.
  2174. theHeight int
  2175. height of the rectangle.
  2176. theBorderColor uint
  2177. color of rectangle's border in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  2178. theFillingColor uint
  2179. color of rectangle's filling in the format `0xAARRGGBB`, e.g. `0x00ff0000` for red, `0xff000000` for transparent filling.
  2180. See Also
  2181. ----------
  2182. window()
  2183. beginColumn()
  2184. beginRow()
  2185. endRow()
  2186. endColumn()
  2187. */
  2188. printc('This is wrapper function to help code autocompletion.')
  2189. }
  2190. Static sparklinef2(theValues, theWidth, theHeight, theColor := 0x00FF00)
  2191. {
  2192. /*
  2193. Display the values of a vector as a sparkline within a `begin*()` and `end*()` block.
  2194. IMPORTANT this function can only be used within a `begin*()/end*()` block, otherwise it does nothing.
  2195. Parameters
  2196. ----------
  2197. theValues number[]
  2198. array or list of numeric values that will be rendered as a sparkline.
  2199. theWidth int
  2200. width of the sparkline.
  2201. theHeight int
  2202. height of the sparkline.
  2203. theColor uint
  2204. color of sparkline in the format `0xRRGGBB`, e.g. `0xff0000` for red.
  2205. See Also
  2206. ----------
  2207. beginColumn()
  2208. beginRow()
  2209. endRow()
  2210. endColumn()
  2211. */
  2212. printc('This is wrapper function to help code autocompletion.')
  2213. }
  2214. Static update(theWindowName := '')
  2215. {
  2216. /*
  2217. Update the library internal things. You need to call this function **AFTER** you are done adding/manipulating
  2218. UI elements in order for them to react to mouse interactions.
  2219. Parameters
  2220. ----------
  2221. theWindowName str
  2222. name of the window whose components are being updated. If no window name is provided, cvui uses the default window.
  2223. See Also
  2224. ----------
  2225. init()
  2226. watch()
  2227. context()
  2228. */
  2229. aContext := __internal.getContext(theWindowName)
  2230. aContext.mouse.anyButton.justReleased := False
  2231. aContext.mouse.anyButton.justPressed := False
  2232. for i in range(CVUI.LEFT_BUTTON, CVUI.RIGHT_BUTTON + 1)
  2233. {
  2234. aContext.mouse.buttons[i].justReleased := False
  2235. aContext.mouse.buttons[i].justPressed := False
  2236. }
  2237. __internal.screen.reset()
  2238. ; If we were told to keep track of the keyboard shortcuts, we
  2239. ; proceed to handle opencv event queue.
  2240. if __internal.delayWaitKey > 0
  2241. __internal.lastKeyPressed := cv2.waitKey(__internal.delayWaitKey)
  2242. if __internal.blockStackEmpty() == False
  2243. __internal.error(2, 'Calling update() before finishing all begin*()/end*() calls. Did you forget to call a begin*() or an end*()? Check if every begin*() has an appropriate end*() call before you call update().')
  2244. }
  2245. Static init(theArgs*)
  2246. {
  2247. if __internal.isString(theArgs[1])
  2248. {
  2249. ; Signature init(theWindowName, theDelayWaitKey := -1, theCreateNamedWindow := True)
  2250. aWindowName := theArgs[1]
  2251. aDelayWaitKey := (len(theArgs) >= 2) ? theArgs[2] : -1
  2252. aCreateNamedWindow := (len(theArgs) >= 3) ? theArgs[3] : True
  2253. __internal.init(aWindowName, aDelayWaitKey)
  2254. CVUI.watch(aWindowName, aCreateNamedWindow)
  2255. }
  2256. else
  2257. {
  2258. ; Signature init(theWindowNames[], theHowManyWindows, theDelayWaitKey := -1, theCreateNamedWindows := True)
  2259. aWindowNames := theArgs[1]
  2260. aHowManyWindows := theArgs[2]
  2261. aDelayWaitKey := (len(theArgs) >= 3) ? theArgs[3] : -1
  2262. aCreateNamedWindows := (len(theArgs) >= 4) ? theArgs[4] : True
  2263. __internal.init(aWindowNames[1], aDelayWaitKey)
  2264. for i in range(0, aHowManyWindows)
  2265. CVUI.watch(aWindowNames[i + 1], aCreateNamedWindows)
  2266. }
  2267. }
  2268. Static text(theArgs*)
  2269. {
  2270. if isinstance(theArgs[1], ComObject)
  2271. {
  2272. ; Signature text(theWhere, theX, theY, theText, theFontScale := 0.4, theColor := 0xCECECE)
  2273. aWhere := theArgs[1]
  2274. aX := theArgs[2]
  2275. aY := theArgs[3]
  2276. aText := theArgs[4]
  2277. aFontScale := (len(theArgs) >= 5) ? theArgs[5] : 0.4
  2278. aColor := (len(theArgs) >= 6) ? theArgs[6] : 0xCECECE
  2279. __internal.screen.where := aWhere
  2280. aBlock := __internal.screen
  2281. }
  2282. else
  2283. {
  2284. ; Signature text(theText, theFontScale := 0.4, theColor := 0xCECECE)
  2285. aBlock := __internal.topBlock()
  2286. aX := aBlock.anchor.x
  2287. aY := aBlock.anchor.y
  2288. aText := theArgs[1]
  2289. aFontScale := (len(theArgs) >= 2) ? theArgs[2] : 0.4
  2290. aColor := (len(theArgs) >= 3) ? theArgs[3] : 0xCECECE
  2291. }
  2292. if __textuid.Has(aX "/" aY "/" aText)
  2293. Return
  2294. __textuid[aX "/" aY "/" aText] := 1
  2295. __internal.text(aBlock, aX, aY, aText, aFontScale, aColor, True)
  2296. }
  2297. Static printf(theArgs*)
  2298. {
  2299. if isinstance(theArgs[1], ComObject)
  2300. {
  2301. ; Signature printf(theWhere, theX, theY, ...)
  2302. aWhere := theArgs[1]
  2303. aX := theArgs[2]
  2304. aY := theArgs[3]
  2305. __internal.screen.where := aWhere
  2306. aBlock := __internal.screen
  2307. theArgs.RemoveAt(1, 3)
  2308. aArgs := theArgs
  2309. }
  2310. else
  2311. {
  2312. ; Row/column function
  2313. aBlock := __internal.topBlock()
  2314. aX := aBlock.anchor.x
  2315. aY := aBlock.anchor.y
  2316. aArgs := theArgs
  2317. }
  2318. if __internal.isString(aArgs[1])
  2319. {
  2320. ; Signature printf(theWhere, theX, theY, theFmt, ...)
  2321. aFontScale := 0.4
  2322. aColor := 0xCECECE
  2323. aFmt := aArgs[1]
  2324. aArgs.RemoveAt(1)
  2325. aFmtArgs := aArgs
  2326. }
  2327. else
  2328. {
  2329. ; Signature printf(theWhere, theX, theY, theFontScale, theColor, theFmt, ...)
  2330. aFontScale := aArgs[1]
  2331. aColor := aArgs[2]
  2332. aFmt := aArgs[3]
  2333. aArgs.RemoveAt(1, 3)
  2334. aFmtArgs := aArgs
  2335. }
  2336. aText := sprintf(aFmt, aFmtArgs)
  2337. __internal.text(aBlock, aX, aY, aText, aFontScale, aColor, True)
  2338. }
  2339. Static counter(theArgs*)
  2340. {
  2341. if isinstance(theArgs[1], ComObject)
  2342. {
  2343. ; Signature counter(theWhere, theX, theY, theValue, theStep := 1, theFormat := "")
  2344. aWhere := theArgs[1]
  2345. aX := theArgs[2]
  2346. aY := theArgs[3]
  2347. aValue := theArgs[4]
  2348. aStep := (len(theArgs) >= 5) ? theArgs[5] : 1
  2349. aFormat := (len(theArgs) >= 6) ? theArgs[6] : ''
  2350. __internal.screen.where := aWhere
  2351. aBlock := __internal.screen
  2352. }
  2353. else
  2354. {
  2355. ; Signature counter(theValue, theStep := 1, theFormat := "%d")
  2356. aBlock := __internal.topBlock()
  2357. aX := aBlock.anchor.x
  2358. aY := aBlock.anchor.y
  2359. aValue := theArgs[1]
  2360. aStep := (len(theArgs) >= 2) ? theArgs[2] : 1
  2361. aFormat := (len(theArgs) >= 3) ? theArgs[3] : ''
  2362. }
  2363. if not aFormat
  2364. {
  2365. aIsInt := isinstance(aValue[1], Integer) == True and isinstance(aStep, Integer)
  2366. aFormat := aIsInt ? '%d' : '%.1f'
  2367. }
  2368. return __internal.counter(aBlock, aX, aY, aValue, aStep, aFormat)
  2369. }
  2370. Static checkbox(theArgs*)
  2371. {
  2372. if isinstance(theArgs[1], ComObject)
  2373. {
  2374. ; Signature checkbox(theWhere, theX, theY, theLabel, theState, theColor := 0xCECECE)
  2375. aWhere := theArgs[1]
  2376. aX := theArgs[2]
  2377. aY := theArgs[3]
  2378. aLabel := theArgs[4]
  2379. aState := theArgs[5]
  2380. aColor := (len(theArgs) >= 6) ? theArgs[6] : 0xCECECE
  2381. __internal.screen.where := aWhere
  2382. aBlock := __internal.screen
  2383. }
  2384. else
  2385. {
  2386. ; Signature checkbox(theLabel, theState, theColor := 0xCECECE)
  2387. aBlock := __internal.topBlock()
  2388. aX := aBlock.anchor.x
  2389. aY := aBlock.anchor.y
  2390. aLabel := theArgs[1]
  2391. aState := theArgs[2]
  2392. aColor := (len(theArgs) >= 3) ? theArgs[3] : 0xCECECE
  2393. }
  2394. return __internal.checkbox(aBlock, aX, aY, aLabel, aState, aColor)
  2395. }
  2396. Static mouse(theArgs*)
  2397. {
  2398. if len(theArgs) == 3
  2399. {
  2400. ; Signature mouse(theWindowName, theButton, theQuery)
  2401. aWindowName := theArgs[1]
  2402. aButton := theArgs[2]
  2403. aQuery := theArgs[3]
  2404. return __internal.mouseWBQ(aWindowName, aButton, aQuery)
  2405. }
  2406. else if len(theArgs) == 2
  2407. {
  2408. ; Signatures mouse(theWindowName, theQuery) or mouse(theButton, theQuery)
  2409. if __internal.isString(theArgs[1])
  2410. {
  2411. ; Signature mouse(theWindowName, theQuery)
  2412. aWindowName := theArgs[1]
  2413. aQuery := theArgs[2]
  2414. return __internal.mouseWQ(aWindowName, aQuery)
  2415. }
  2416. else
  2417. {
  2418. ; Signature mouse(theButton, theQuery)
  2419. aButton := theArgs[1]
  2420. aQuery := theArgs[2]
  2421. return __internal.mouseBQ(aButton, aQuery)
  2422. }
  2423. }
  2424. else if len(theArgs) == 1 and isinstance(theArgs[0], Integer)
  2425. {
  2426. ; Signature mouse(theQuery)
  2427. aQuery := theArgs[1]
  2428. return __internal.mouseQ(aQuery)
  2429. }
  2430. else
  2431. {
  2432. ; Signature mouse(theWindowName := '')
  2433. aWindowName := (len(theArgs) == 1) ? theArgs[1] : ''
  2434. return __internal.mouseW(aWindowName)
  2435. }
  2436. }
  2437. Static button(theArgs*)
  2438. {
  2439. if isinstance(theArgs[1], ComObject) and isinstance(theArgs[2], ComObject) == False
  2440. {
  2441. ; Signature button(Mat, theX, theY, ...)
  2442. aWhere := theArgs[1]
  2443. aX := theArgs[2]
  2444. aY := theArgs[3]
  2445. __internal.screen.where := aWhere
  2446. aBlock := __internal.screen
  2447. theArgs.RemoveAt(1, 3)
  2448. aArgs := theArgs
  2449. }
  2450. else
  2451. {
  2452. ; Row/column function
  2453. aBlock := __internal.topBlock()
  2454. aX := aBlock.anchor.x
  2455. aY := aBlock.anchor.y
  2456. aArgs := theArgs
  2457. }
  2458. if len(aArgs) == 1
  2459. {
  2460. ; Signature button(theLabel)
  2461. aLabel := aArgs[1]
  2462. return __internal.button(aBlock, aX, aY, aLabel)
  2463. }
  2464. else if len(aArgs) == 3
  2465. {
  2466. if isinstance(aArgs[1], Integer)
  2467. {
  2468. ; Signature button(theWidth, theHeight, theLabel)
  2469. aWidth := aArgs[1]
  2470. aHeight := aArgs[2]
  2471. aLabel := aArgs[3]
  2472. return __internal.buttonWH(aBlock, aX, aY, aWidth, aHeight, aLabel, True)
  2473. }
  2474. else
  2475. {
  2476. ; Signature button(theIdle, theOver, theDown)
  2477. aIdle := aArgs[1]
  2478. aOver := aArgs[2]
  2479. aDown := aArgs[3]
  2480. return __internal.buttonI(aBlock, aX, aY, aIdle, aOver, aDown, True)
  2481. }
  2482. }
  2483. else
  2484. ; TODO check this case here
  2485. printc('Problem?')
  2486. }
  2487. Static image(theArgs*)
  2488. {
  2489. uid := theArgs[-1]
  2490. uidFlag := (uid is String)
  2491. if !uidFlag
  2492. uid := "Default"
  2493. if isinstance(theArgs[1], ComObject) and len(theArgs) > 1 + uidFlag
  2494. uid := theArgs[2] "/" theArgs[3] "/" uid
  2495. else
  2496. uid := __internal.topBlock().anchor.x "/" __internal.topBlock().anchor.y "/" uid
  2497. if __imageuid.Has(uid)
  2498. Return
  2499. __imageuid[uid] := 1
  2500. if isinstance(theArgs[1], ComObject) and len(theArgs) > 1 + uidFlag
  2501. {
  2502. ; Signature image(Mat, ...)
  2503. aWhere := theArgs[1]
  2504. aX := theArgs[2]
  2505. aY := theArgs[3]
  2506. aImage := theArgs[4]
  2507. __internal.screen.where := aWhere
  2508. __internal.image(__internal.screen, aX, aY, aImage)
  2509. }
  2510. else
  2511. {
  2512. ; Row/column function, signature is image(...)
  2513. aImage := theArgs[1]
  2514. aBlock := __internal.topBlock()
  2515. __internal.image(aBlock, aBlock.anchor.x, aBlock.anchor.y, aImage)
  2516. }
  2517. }
  2518. Static trackbar(theArgs*)
  2519. {
  2520. ; TODO re-factor this two similar blocks by slicing theArgs into aArgs
  2521. if isinstance(theArgs[1], ComObject)
  2522. {
  2523. ; Signature trackbar(theWhere, theX, theY, theWidth, theValue, theMin, theMax, theSegments := 1, theLabelFormat := "%.1Lf", theOptions := 0, theDiscreteStep := 1)
  2524. aWhere := theArgs[1]
  2525. aX := theArgs[2]
  2526. aY := theArgs[3]
  2527. aWidth := theArgs[4]
  2528. aValue := theArgs[5]
  2529. aMin := theArgs[6]
  2530. aMax := theArgs[7]
  2531. aSegments := (len(theArgs) >= 8) ? theArgs[8] : 1
  2532. aLabelFormat := (len(theArgs) >= 9) ? theArgs[9] : '%.1Lf'
  2533. aOptions := (len(theArgs) >= 10) ? theArgs[10] : 0
  2534. aDiscreteStep := (len(theArgs) >= 11) ? theArgs[11] : 1
  2535. __internal.screen.where := aWhere
  2536. aBlock := __internal.screen
  2537. }
  2538. else
  2539. {
  2540. ; Signature trackbar(theWidth, theValue, theMin, theMax, theSegments := 1, theLabelFormat := "%.1Lf", theOptions := 0, theDiscreteStep := 1)
  2541. aBlock := __internal.topBlock()
  2542. aX := aBlock.anchor.x
  2543. aY := aBlock.anchor.y
  2544. aWidth := theArgs[1]
  2545. aValue := theArgs[2]
  2546. aMin := theArgs[3]
  2547. aMax := theArgs[4]
  2548. aSegments := (len(theArgs) >= 5) ? theArgs[5] : 1
  2549. aLabelFormat := (len(theArgs) >= 6) ? theArgs[6] : '%.1Lf'
  2550. aOptions := (len(theArgs) >= 7) ? theArgs[7] : 0
  2551. aDiscreteStep := (len(theArgs) >= 8) ? theArgs[8] : 1
  2552. }
  2553. ; TODO adjust aLabelFormat based on type of aValue
  2554. aParams := CVUI._TrackbarParams(aMin, aMax, aDiscreteStep, aSegments, aLabelFormat, aOptions)
  2555. aResult := __internal.trackbar(aBlock, aX, aY, aWidth, aValue, aParams)
  2556. return aResult
  2557. }
  2558. Static window(theArgs*)
  2559. {
  2560. if isinstance(theArgs[1], ComObject)
  2561. {
  2562. ; Signature window(theWhere, theX, theY, theWidth, theHeight, theTitle)
  2563. aWhere := theArgs[1]
  2564. aX := theArgs[2]
  2565. aY := theArgs[3]
  2566. aWidth := theArgs[4]
  2567. aHeight := theArgs[5]
  2568. aTitle := theArgs[6]
  2569. __internal.screen.where := aWhere
  2570. __internal.window(__internal.screen, aX, aY, aWidth, aHeight, aTitle)
  2571. }
  2572. else
  2573. {
  2574. ; Row/column function, signature window(theWidth, theHeight, theTitle)
  2575. aWidth := theArgs[1]
  2576. aHeight := theArgs[2]
  2577. aTitle := theArgs[3]
  2578. aBlock := __internal.topBlock()
  2579. __internal.window(aBlock, aBlock.anchor.x, aBlock.anchor.y, aWidth, aHeight, aTitle)
  2580. }
  2581. }
  2582. Static rect(theArgs*)
  2583. {
  2584. if isinstance(theArgs[1], ComObject)
  2585. {
  2586. ; Signature rect(theWhere, theX, theY, theWidth, theHeight, theBorderColor, theFillingColor := 0xff000000)
  2587. aWhere := theArgs[1]
  2588. aX := theArgs[2]
  2589. aY := theArgs[3]
  2590. aWidth := theArgs[4]
  2591. aHeight := theArgs[5]
  2592. aBorderColor := theArgs[6]
  2593. aFillingColor := (len(theArgs) >= 7) ? theArgs[7] : 0xff000000
  2594. __internal.screen.where := aWhere
  2595. aBlock := __internal.screen
  2596. }
  2597. else
  2598. {
  2599. ; Signature rect(theWidth, theHeight, theBorderColor, theFillingColor := 0xff000000)
  2600. aBlock := __internal.topBlock()
  2601. aX := aBlock.anchor.x
  2602. aY := aBlock.anchor.y
  2603. aWidth := theArgs[1]
  2604. aHeight := theArgs[2]
  2605. aBorderColor := theArgs[3]
  2606. aFillingColor := (len(theArgs) >= 4) ? theArgs[4] : 0xff000000
  2607. }
  2608. __internal.rect(aBlock, aX, aY, aWidth, aHeight, aBorderColor, aFillingColor)
  2609. }
  2610. Static sparkline(theArgs*)
  2611. {
  2612. if isinstance(theArgs[1], ComObject)
  2613. {
  2614. ; Signature sparkline(theWhere, theValues, theX, theY, theWidth, theHeight, theColor := 0x00FF00)
  2615. aWhere := theArgs[1]
  2616. aValues := theArgs[2]
  2617. aX := theArgs[3]
  2618. aY := theArgs[4]
  2619. aWidth := theArgs[5]
  2620. aHeight := theArgs[6]
  2621. aColor := (len(theArgs) >= 7) ? theArgs[7] : 0x00FF00
  2622. __internal.screen.where := aWhere
  2623. aBlock := __internal.screen
  2624. }
  2625. else
  2626. {
  2627. ; Signature sparkline(theValues, theWidth, theHeight, theColor := 0x00FF00)
  2628. aBlock := __internal.topBlock()
  2629. aValues := theArgs[1]
  2630. aX := aBlock.anchor.x
  2631. aY := aBlock.anchor.y
  2632. aWidth := theArgs[2]
  2633. aHeight := theArgs[3]
  2634. aColor := (len(theArgs) >= 4) ? theArgs[4] : 0x00FF00
  2635. }
  2636. __internal.sparkline(aBlock, aValues, aX, aY, aWidth, aHeight, aColor)
  2637. }
  2638. Static beginRow(theArgs*)
  2639. {
  2640. if len(theArgs) and isinstance(theArgs[1], ComObject)
  2641. {
  2642. ; Signature beginRow(theWhere, theX, theY, theWidth := -1, theHeight := -1, thePadding := 0):
  2643. aWhere := theArgs[1]
  2644. aX := theArgs[2]
  2645. aY := theArgs[3]
  2646. aWidth := (len(theArgs) >= 4) ? theArgs[4] : -1
  2647. aHeight := (len(theArgs) >= 5) ? theArgs[5] : -1
  2648. aPadding := (len(theArgs) >= 6) ? theArgs[6] : 0
  2649. __internal.begin(CVUI.ROW, aWhere, aX, aY, aWidth, aHeight, aPadding)
  2650. }
  2651. else
  2652. {
  2653. ; Signature beginRow(theWidth := -1, theHeight := -1, thePadding := 0)
  2654. aWidth := (len(theArgs) >= 1) ? theArgs[1] : -1
  2655. aHeight := (len(theArgs) >= 2) ? theArgs[2] : -1
  2656. aPadding := (len(theArgs) >= 3) ? theArgs[3] : 0
  2657. aBlock := __internal.topBlock()
  2658. __internal.begin(CVUI.ROW, aBlock.where, aBlock.anchor.x, aBlock.anchor.y, aWidth, aHeight, aPadding)
  2659. }
  2660. }
  2661. Static beginColumn(theArgs*)
  2662. {
  2663. if len(theArgs) > 0 and isinstance(theArgs[1], ComObject)
  2664. {
  2665. ; Signature beginColumn(theWhere, theX, theY, theWidth := -1, theHeight := -1, thePadding := 0):
  2666. aWhere := theArgs[1]
  2667. aX := theArgs[2]
  2668. aY := theArgs[3]
  2669. aWidth := (len(theArgs) >= 4) ? theArgs[4] : -1
  2670. aHeight := (len(theArgs) >= 5) ? theArgs[5] : -1
  2671. aPadding := (len(theArgs) >= 6) ? theArgs[6] : 0
  2672. __internal.begin(CVUI.COLUMN, aWhere, aX, aY, aWidth, aHeight, aPadding)
  2673. }
  2674. else
  2675. {
  2676. ; Signature beginColumn(theWidth := -1, theHeight := -1, thePadding := 0):
  2677. aWidth := (len(theArgs) >= 1) ? theArgs[1] : -1
  2678. aHeight := (len(theArgs) >= 2) ? theArgs[2] : -1
  2679. aPadding := (len(theArgs) >= 3) ? theArgs[3] : 0
  2680. aBlock := __internal.topBlock()
  2681. __internal.begin(CVUI.COLUMN, aBlock.where, aBlock.anchor.x, aBlock.anchor.y, aWidth, aHeight, aPadding)
  2682. }
  2683. }
  2684. }
  2685. _handleMouse(theEvent, theX, theY, theFlags)
  2686. {
  2687. Global theContext
  2688. aButtons := [CVUI.LEFT_BUTTON, CVUI.MIDDLE_BUTTON, CVUI.RIGHT_BUTTON]
  2689. aEventsDown := [cv2.EVENT_LBUTTONDOWN, cv2.EVENT_MBUTTONDOWN, cv2.EVENT_RBUTTONDOWN]
  2690. aEventsUp := [cv2.EVENT_LBUTTONUP, cv2.EVENT_MBUTTONUP, cv2.EVENT_RBUTTONUP]
  2691. for i in range(CVUI.LEFT_BUTTON, CVUI.RIGHT_BUTTON + 1)
  2692. {
  2693. aBtn := aButtons[i + 1]
  2694. if theEvent == aEventsDown[i + 1]
  2695. {
  2696. theContext.mouse.anyButton.justPressed := True
  2697. theContext.mouse.anyButton.pressed := True
  2698. theContext.mouse.buttons[aBtn].justPressed := True
  2699. theContext.mouse.buttons[aBtn].pressed := True
  2700. }
  2701. else if theEvent == aEventsUp[i + 1]
  2702. {
  2703. theContext.mouse.anyButton.justReleased := True
  2704. theContext.mouse.anyButton.pressed := False
  2705. theContext.mouse.buttons[aBtn].justReleased := True
  2706. theContext.mouse.buttons[aBtn].pressed := False
  2707. }
  2708. }
  2709. theContext.mouse.position.x := theX
  2710. theContext.mouse.position.y := theY
  2711. }

CV2 v1.0.5测试代码

  1. #Include CV2.ahk
  2. ; setMouseCallback使用示例与单线程设置
  3. cv2.setNumThreads(1)
  4. addr := 0
  5. img := cv2.imread("123.png")
  6. cv2.namedWindow("Image")
  7. a := {b:2}
  8. cv2.setMouseCallback("Image", drawcircle, a)
  9. while 1
  10. {
  11. cv2.imshow("Image", img)
  12. }
  13. drawcircle(event, x, y, flag, param)
  14. {
  15. Global addr
  16. if (event == 1)
  17. {
  18. if !addr
  19. addr := ObjFromPtrAddRef(param)
  20. cv2.circle(img, [x, y], 100, [255, 0, 0], 0)
  21. }
  22. }
  23. ; sprintf新增保留小数位数写法
  24. MsgBox sprintf("%.1LF", 12.0)
  25. printf("%.2LF", 12.0)
  26. ; getTextSize示例
  27. text := "Funny text inside the box"
  28. fontFace := cv2.FONT_HERSHEY_SCRIPT_SIMPLEX
  29. fontScale := 2
  30. thickness := 3
  31. Ret := cv2.getTextSize(text, fontFace, fontScale, thickness)
  32. MsgBox Ret[1][0]
  33. ; svm示例
  34. ; 效率会比较低,后续会优化at函数
  35. svm := cv2.ml.svm.create()
  36. svm.setType(cv2.ml_SVM_C_SVC)
  37. svm.setKernel(cv2.ml_SVM_LINEAR)
  38. svm.setTermCriteria(cv2.TERM_CRITERIA_MAX_ITER, 100, 1e-6)
  39. labelsMat := cv2.MAT_(4, 1, cv2.CV_32SC1, 1, -1, -1, -1)
  40. trainingDataMat := cv2.MAT_(4, 2, cv2.CV_32F, [[101, 10], [55, 10], [101, 55], [10, 101]])
  41. svm.train(trainingDataMat, cv2.ml_ROW_SAMPLE, labelsMat)
  42. width := 120
  43. height := 120
  44. image := cv2.Mat.zeros(height, width, cv2.CV_8UC3)
  45. green := [0,255,0]
  46. blue := [255,0,0]
  47. loop image.rows
  48. {
  49. i := A_Index - 1
  50. loop image.cols
  51. {
  52. j := A_Index - 1
  53. sampleMat := cv2.Mat_(1, 2, CV2.CV_32F, j, i)
  54. response := svm.predict(sampleMat)
  55. if response.at[0, 0] == -1
  56. image.at[i, j] := green
  57. else if response.at[0, 0] == 1
  58. image.at[i, j] := blue
  59. }
  60. }
  61. cv2.imshow(image)
  62. cv2.waitKey()
  63. ; QRCodeDetector示例
  64. img := cv2.imread("123.png")
  65. qrcode := cv2.QRCodeDetector()
  66. MsgBox qrcode.detectAndDecode(img)[1]

CVUI库使用示例1

  1. #Include cvui.ahk
  2. WINDOW_NAME := "CVUI Canny Edge"
  3. lena := cv2.imread("lena.jpg")
  4. frame := lena.clone()
  5. low_threshold := [50]
  6. high_threshold := [150]
  7. use_canny := [false]
  8. cv2.namedWindow(WINDOW_NAME)
  9. cvui.init(WINDOW_NAME)
  10. while (true)
  11. {
  12. if (use_canny)
  13. {
  14. frame := cv2.cvtColor(lena, cv2.COLOR_BGR2GRAY)
  15. frame := cv2.Canny(frame, low_threshold[1], high_threshold[1], 3)
  16. }
  17. else
  18. {
  19. lena.copyTo(frame)
  20. }
  21. cvui.window(frame, 10, 50, 180, 180, "Settings")
  22. cvui.checkbox(frame, 15, 80, "Use Canny Edge", use_canny)
  23. cvui.trackbar(frame, 15, 110, 165, low_threshold, 5, 150)
  24. cvui.trackbar(frame, 15, 180, 165, high_threshold, 80, 300)
  25. cvui.update()
  26. cv2.imshow(WINDOW_NAME, frame)
  27. if (cv2.waitKey(20) == 27)
  28. {
  29. break
  30. }
  31. }

CVUI库使用示例2

  1. #Include cvui.ahk
  2. WINDOW_NAME := "CVUI Test"
  3. icon := cv2.imread("IconSmall.jpg", cv2.IMREAD_COLOR)
  4. frame := cv2.Mat(250, 600, cv2.CV_8UC3)
  5. checked := [false]
  6. count := [0]
  7. cv2.namedWindow(WINDOW_NAME)
  8. cvui.init(WINDOW_NAME)
  9. while (true)
  10. {
  11. cvui.text(frame, 50, 30, "Hey there!")
  12. cvui.text(frame, 200, 30, "Use hex 0xRRGGBB colors easily", 0.4, 0xff0000)
  13. if (cvui.button(frame, 50, 50, "Button"))
  14. printf("Button clicked!")
  15. cvui.window(frame, 50, 100, 120, 100, "Window")
  16. cvui.counter(frame, 200, 100, count)
  17. cvui.image(frame, 10, 10, icon)
  18. cvui.checkbox(frame, 200, 150, "Checkbox", checked)
  19. cvui.update()
  20. cv2.imshow(WINDOW_NAME, frame)
  21. cv2.waitKey(30)
  22. }

CVUI库使用示例3

  1. #Include cvui.ahk
  2. WINDOW_NAME := 'Mouse complex buttons- ROI interaction'
  3. lena := cv2.imread('lena.jpg')
  4. frame := noArray()
  5. anchors := [cvui._Point(), cvui._Point(), cvui._Point()] ; one anchor for each mouse button
  6. rois := [cvui._Rect(), cvui._Rect(), cvui._Rect()] ; one ROI for each mouse button
  7. colors := [0xff0000, 0x00ff00, 0x0000ff]
  8. ; Init cvui and tell it to create a OpenCV window, i.e. cv.namedWindow(WINDOW_NAME).
  9. cvui.init(WINDOW_NAME)
  10. while (True)
  11. {
  12. frame.MAT := lena.MAT.clone()
  13. ; Show the coordinates of the mouse pointer on the screen
  14. cvui.text(frame, 10, 10, 'Click (any) mouse button then drag the pointer around to select a ROI.')
  15. cvui.text(frame, 10, 25, 'Use different mouse buttons (right, middle and left) to select different ROIs.')
  16. ; Iterate all mouse buttons (left, middle and right button)
  17. button := cvui.LEFT_BUTTON
  18. while button <= cvui.RIGHT_BUTTON
  19. {
  20. ; Get the anchor, ROI and color associated with the mouse button
  21. anchor := anchors[button + 1]
  22. roi := rois[button + 1]
  23. color := colors[button + 1]
  24. ; The function 'bool cvui.mouse(int button, int query)' allows you to query a particular mouse button for events.
  25. ; E.g. cvui.mouse(cvui.RIGHT_BUTTON, cvui.DOWN)
  26. ; Available queries:
  27. ; - cvui.DOWN: mouse button was pressed. cvui.mouse() returns true for single frame only.
  28. ; - cvui.UP: mouse button was released. cvui.mouse() returns true for single frame only.
  29. ; - cvui.CLICK: mouse button was clicked (went down then up, no matter the amount of frames in between). cvui.mouse() returns true for single frame only.
  30. ; - cvui.IS_DOWN: mouse button is currently pressed. cvui.mouse() returns true for as long as the button is down/pressed.
  31. ; Did the mouse button go down?
  32. if cvui.mouse(button, cvui.DOWN)
  33. {
  34. ; Position the anchor at the mouse pointer.
  35. anchor.x := cvui.mouse().x
  36. anchor.y := cvui.mouse().y
  37. }
  38. ; Is any mouse button down (pressed)?
  39. if cvui.mouse(button, cvui.IS_DOWN)
  40. {
  41. ; Adjust roi dimensions according to mouse pointer
  42. width := cvui.mouse().x - anchor.x
  43. height := cvui.mouse().y - anchor.y
  44. roi.x := (width < 0) ? (anchor.x + width) : anchor.x
  45. roi.y := (height < 0) ? (anchor.y + height) : anchor.y
  46. roi.width := abs(width)
  47. roi.height := abs(height)
  48. ; Show the roi coordinates and size
  49. cvui.printf(frame, roi.x + 5, roi.y + 5, 0.3, color, '(%d,%d)', roi.x, roi.y)
  50. cvui.printf(frame, cvui.mouse().x + 5, cvui.mouse().y + 5, 0.3, color, 'w:%d, h:%d', roi.width, roi.height)
  51. }
  52. ; Ensure ROI is within bounds
  53. tmp := lena.shape
  54. lenaRows := tmp[1]
  55. lenaCols := tmp[2]
  56. lenaChannels := tmp[3]
  57. roi.x := (roi.x < 0) ? 0 : roi.x
  58. roi.y := (roi.y < 0) ? 0 : roi.y
  59. roi.width := (roi.x + roi.width > lenaCols) ? (roi.width + lenaCols - (roi.x + roi.width)) : roi.width
  60. roi.height := (roi.y + roi.height > lenaRows) ? (roi.height + lenaRows - (roi.y + roi.height)) : roi.height
  61. ; If the ROI is valid, render it in the frame and show in a window.
  62. if roi.area() > 0
  63. {
  64. cvui.rect(frame, roi.x, roi.y, roi.width, roi.height, color)
  65. cvui.printf(frame, roi.x + 5, roi.y - 10, 0.3, color, 'ROI %d', button)
  66. lenaRoi := lena[roi.x, roi.y, roi.width, roi.height]
  67. cv2.imshow('ROI button' button, lenaRoi)
  68. }
  69. button += 1
  70. }
  71. ; This function must be called *AFTER* all UI components. It does
  72. ; all the behind the scenes magic to handle mouse clicks, etc.
  73. cvui.update()
  74. ; Show everything on the screen
  75. cv2.imshow(WINDOW_NAME, frame)
  76. ; Check if ESC key was pressed
  77. if cv2.waitKey(20) == 27
  78. break
  79. }

CVUI库使用示例4

  1. #Include cvui.ahk
  2. WINDOW_NAME := 'Interaction area'
  3. frame1 := cv2.mat(300, 600, cv2.CV_8UC3, [49, 52, 49])
  4. frame := frame1.Clone()
  5. ; Init cvui and tell it to create a OpenCV window, i.e. cv2.namedWindow(WINDOW_NAME).
  6. cv2.namedWindow(WINDOW_NAME)
  7. cvui.init(WINDOW_NAME)
  8. while (True)
  9. {
  10. ; frame := frame1.Clone()这样写会导致内存泄漏,需要替换为:
  11. frame.MAT := frame1.MAT.Clone()
  12. ; Render a rectangle on the screen.
  13. rectangle := cvui._Rect(50, 50, 100, 100)
  14. cvui.rect(frame, rectangle.x, rectangle.y, rectangle.width, rectangle.height, 0xff0000)
  15. ; Check what is the current status of the mouse cursor
  16. ; regarding the previously rendered rectangle.
  17. status := cvui.iarea(rectangle.x, rectangle.y, rectangle.width, rectangle.height)
  18. ; cvui::iarea() will return the current mouse status:
  19. ; CLICK: mouse just clicked the interaction are
  20. ; DOWN: mouse button was pressed on the interaction area, but not released yet.
  21. ; OVER: mouse cursor is over the interaction area
  22. ; OUT: mouse cursor is outside the interaction area
  23. if status == cvui.CLICK
  24. printc('Rectangle was clicked!')
  25. if status == cvui.DOWN
  26. cvui.printf(frame, 240, 70, "Mouse is: DOWN")
  27. if status == cvui.OVER
  28. cvui.printf(frame, 240, 70, "Mouse is: OVER")
  29. if status == cvui.OUT
  30. cvui.printf(frame, 240, 70, "Mouse is: OUT")
  31. ; Show the coordinates of the mouse pointer on the screen
  32. cvui.printf(frame, 240, 50, "Mouse pointer is at (%d,%d)", cvui.mouse().x, cvui.mouse().y)
  33. ; This function must be called *AFTER* all UI components. It does
  34. ; all the behind the scenes magic to handle mouse clicks, etc.
  35. cvui.update()
  36. ; Show everything on the screen
  37. cv2.imshow(WINDOW_NAME, frame)
  38. ; Check if ESC key was pressed
  39. if cv2.waitKey(20) == 27
  40. break
  41. }

测试集

123.png

CVUI库与CV2库——设计UI新思路(五)

lena.jpg

CVUI库与CV2库——设计UI新思路(五)

IconSmall.jpg

CVUI库与CV2库——设计UI新思路(五)

CVUI示例截图

CVUI库与CV2库——设计UI新思路(五)

CVUI库与CV2库——设计UI新思路(五)

CVUI库与CV2库——设计UI新思路(五)

CVUI库与CV2库——设计UI新思路(五)

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
函数

ZeroMQ 跨线程、跨进程、跨语言、跨系统、跨网络 —— 连接一切

2022-9-1 22:40:55

其他应用

windows效率之道

2022-9-2 9:27:12

7 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
  1. hexuren
    1河许人给您捐赠了¥5
  2. hexuren

    恭喜有新的突破

    • 陌诺Mono

      CVUI设计的界面反馈这一块还需要再打磨一下,这两天会再完善 目前是能显示和传参,但是参数传进去了没法同步修改,估计得改点细节

    • 陌诺Mono

      已经锁定问题了,主要是测试代码问题

  3. dbgba
    dbgba给您捐赠了¥5
  4. 陌诺Mono

    该库有内存泄漏风险(调用cvui.window函数时);建议暂时不要用该函数,之后会就此问题进行修复

个人中心
购物车
优惠劵
私信列表
搜索