1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 """
28 This file started life as cvtypes.py with the following header (that I can't read)
29
30 Wrapper-Modul cvtypes.py zur Verwendung der OpenCV-Bibliothek beta5
31 unter Python, wobei der Zugriff ueber ctypes erfolgt.
32 Autor: Michael Otto
33 To do: noch fehlende Strukturen wrappen (z. B. CvKalman)
34 noch fehlende Konstanten wrappen (z. B. CV_MAX_DIM_HEAP)
35 noch fehlende Makros und Inlinefunktionen wrappen
36 ausgiebig testen
37 Log: 2006/07/25 Dokumentationsstrings hinzugefuegt
38 2006/07/10 Fehler in cvGEMM, cvMatMulAdd und cvMatMul beseitigt
39 2006/06/28 Modul erzeugt
40
41 I hacked it both automatically and by hand to bring it up to date with OpenCV 1.0 and
42 to use prototype for the functions. I also added from_param methods to allow lists to many
43 functions that expect a C array.
44
45 I checked with Michael and he graciously agreed to let me give it away. This software is
46 free for any use. If you or your lawyer are stupid enough to believe that Micheal or I have
47 any liability for it, you should not use it, otherwise be our guest.
48
49 Gary Bishop February 2007
50
51 Updated 12 May 2007 to include modifications provided by Russell Warren
52 """
53
54
55
56 import ctypes, os, sys
57 from ctypes import Structure, Union, POINTER, SetPointerType, CFUNCTYPE, cdll, byref, sizeof
58 from ctypes import c_char_p, c_double, c_float, c_byte, c_ubyte, c_int, c_void_p, c_ulong
59 from ctypes import c_uint32, c_short, c_char, c_longlong
60 import math
61
62
63 if os.name == 'posix' and sys.platform.startswith('linux'):
64 try:
65 _cxDLL = cdll.LoadLibrary('libcxcore.so.1')
66 _cvDLL = cdll.LoadLibrary('libcv.so.1')
67 _hgDLL = cdll.LoadLibrary('libhighgui.so.1')
68 except:
69 raise ImportError("Cannot import OpenCV's .so files. Make sure you have their path included in your PATH variable.")
70 elif os.name == 'posix' and sys.platform.startswith('darwin'):
71 try:
72 _cxDLL = cdll.LoadLibrary('libcxcore.dylib')
73 _cvDLL = cdll.LoadLibrary('libcv.dylib')
74 _hgDLL = cdll.LoadLibrary('libhighgui.dylib')
75 except:
76 raise ImportError("Cannot import OpenCV's .dynlib files. Make sure you have their path included in your PATH variable.")
77 elif os.name == 'nt':
78 try:
79 _cxDLL = cdll.cxcore100
80 _cvDLL = cdll.cv100
81 _hgDLL = cdll.highgui100
82 except:
83 raise ImportError("Cannot import OpenCV's .DLL files. Make sure you have their path included in your PATH variable.")
84 else:
85 raise NotImplemented
86
87
88
89 CV_BLUR_NO_SCALE = 0
90 CV_BLUR = 1
91 CV_GAUSSIAN = 2
92 CV_MEDIAN = 3
93 CV_BILATERAL = 4
94 CV_INPAINT_NS = 0
95 CV_INPAINT_TELEA = 1
96 CV_SCHARR = -1
97 CV_MAX_SOBEL_KSIZE = 7
98 CV_BGR2BGRA = 0
99 CV_RGB2RGBA = CV_BGR2BGRA
100 CV_BGRA2BGR = 1
101 CV_RGBA2RGB = CV_BGRA2BGR
102 CV_BGR2RGBA = 2
103 CV_RGB2BGRA = CV_BGR2RGBA
104 CV_RGBA2BGR = 3
105 CV_BGRA2RGB = CV_RGBA2BGR
106 CV_BGR2RGB = 4
107 CV_RGB2BGR = CV_BGR2RGB
108 CV_BGRA2RGBA = 5
109 CV_RGBA2BGRA = CV_BGRA2RGBA
110 CV_BGR2GRAY = 6
111 CV_RGB2GRAY = 7
112 CV_GRAY2BGR = 8
113 CV_GRAY2RGB = CV_GRAY2BGR
114 CV_GRAY2BGRA = 9
115 CV_GRAY2RGBA = CV_GRAY2BGRA
116 CV_BGRA2GRAY = 10
117 CV_RGBA2GRAY = 11
118 CV_BGR2BGR565 = 12
119 CV_RGB2BGR565 = 13
120 CV_BGR5652BGR = 14
121 CV_BGR5652RGB = 15
122 CV_BGRA2BGR565 = 16
123 CV_RGBA2BGR565 = 17
124 CV_BGR5652BGRA = 18
125 CV_BGR5652RGBA = 19
126 CV_GRAY2BGR565 = 20
127 CV_BGR5652GRAY = 21
128 CV_BGR2BGR555 = 22
129 CV_RGB2BGR555 = 23
130 CV_BGR5552BGR = 24
131 CV_BGR5552RGB = 25
132 CV_BGRA2BGR555 = 26
133 CV_RGBA2BGR555 = 27
134 CV_BGR5552BGRA = 28
135 CV_BGR5552RGBA = 29
136 CV_GRAY2BGR555 = 30
137 CV_BGR5552GRAY = 31
138 CV_BGR2XYZ = 32
139 CV_RGB2XYZ = 33
140 CV_XYZ2BGR = 34
141 CV_XYZ2RGB = 35
142 CV_BGR2YCrCb = 36
143 CV_RGB2YCrCb = 37
144 CV_YCrCb2BGR = 38
145 CV_YCrCb2RGB = 39
146 CV_BGR2HSV = 40
147 CV_RGB2HSV = 41
148 CV_BGR2Lab = 44
149 CV_RGB2Lab = 45
150 CV_BayerBG2BGR = 46
151 CV_BayerGB2BGR = 47
152 CV_BayerRG2BGR = 48
153 CV_BayerGR2BGR = 49
154 CV_BayerBG2RGB = CV_BayerRG2BGR
155 CV_BayerGB2RGB = CV_BayerGR2BGR
156 CV_BayerRG2RGB = CV_BayerBG2BGR
157 CV_BayerGR2RGB = CV_BayerGB2BGR
158 CV_BGR2Luv = 50
159 CV_RGB2Luv = 51
160 CV_BGR2HLS = 52
161 CV_RGB2HLS = 53
162 CV_HSV2BGR = 54
163 CV_HSV2RGB = 55
164 CV_Lab2BGR = 56
165 CV_Lab2RGB = 57
166 CV_Luv2BGR = 58
167 CV_Luv2RGB = 59
168 CV_HLS2BGR = 60
169 CV_HLS2RGB = 61
170 CV_COLORCVT_MAX = 100
171 CV_INTER_NN = 0
172 CV_INTER_LINEAR = 1
173 CV_INTER_CUBIC = 2
174 CV_INTER_AREA = 3
175 CV_WARP_FILL_OUTLIERS = 8
176 CV_WARP_INVERSE_MAP = 16
177 CV_SHAPE_RECT = 0
178 CV_SHAPE_CROSS = 1
179 CV_SHAPE_ELLIPSE = 2
180 CV_SHAPE_CUSTOM = 100
181 CV_MOP_OPEN = 2
182 CV_MOP_CLOSE = 3
183 CV_MOP_GRADIENT = 4
184 CV_MOP_TOPHAT = 5
185 CV_MOP_BLACKHAT = 6
186 CV_TM_SQDIFF = 0
187 CV_TM_SQDIFF_NORMED = 1
188 CV_TM_CCORR = 2
189 CV_TM_CCORR_NORMED = 3
190 CV_TM_CCOEFF = 4
191 CV_TM_CCOEFF_NORMED = 5
192 CV_LKFLOW_PYR_A_READY = 1
193 CV_LKFLOW_PYR_B_READY = 2
194 CV_LKFLOW_INITIAL_GUESSES = 4
195 CV_POLY_APPROX_DP = 0
196 CV_DOMINANT_IPAN = 1
197 CV_CONTOURS_MATCH_I1 = 1
198 CV_CONTOURS_MATCH_I2 = 2
199 CV_CONTOURS_MATCH_I3 = 3
200 CV_CONTOUR_TREES_MATCH_I1 = 1
201 CV_CLOCKWISE = 1
202 CV_COUNTER_CLOCKWISE = 2
203 CV_COMP_CORREL = 0
204 CV_COMP_CHISQR = 1
205 CV_COMP_INTERSECT = 2
206 CV_COMP_BHATTACHARYYA = 3
207 CV_VALUE = 1
208 CV_ARRAY = 2
209 CV_DIST_MASK_3 = 3
210 CV_DIST_MASK_5 = 5
211 CV_DIST_MASK_PRECISE = 0
212 CV_THRESH_BINARY = 0
213 CV_THRESH_BINARY_INV = 1
214 CV_THRESH_TRUNC = 2
215 CV_THRESH_TOZERO = 3
216 CV_THRESH_TOZERO_INV = 4
217 CV_THRESH_MASK = 7
218 CV_THRESH_OTSU = 8
219 CV_ADAPTIVE_THRESH_MEAN_C = 0
220 CV_ADAPTIVE_THRESH_GAUSSIAN_C = 1
221 CV_FLOODFILL_FIXED_RANGE = 1 << 16
222 CV_FLOODFILL_MASK_ONLY = 1 << 17
223 CV_CANNY_L2_GRADIENT = 1 << 31
224 CV_HOUGH_STANDARD = 0
225 CV_HOUGH_PROBABILISTIC = 1
226 CV_HOUGH_MULTI_SCALE = 2
227 CV_HOUGH_GRADIENT = 3
228 CV_HAAR_DO_CANNY_PRUNING = 1
229 CV_HAAR_SCALE_IMAGE = 2
230 CV_CALIB_USE_INTRINSIC_GUESS = 1
231 CV_CALIB_FIX_ASPECT_RATIO = 2
232 CV_CALIB_FIX_PRINCIPAL_POINT = 4
233 CV_CALIB_ZERO_TANGENT_DIST = 8
234 CV_CALIB_CB_ADAPTIVE_THRESH = 1
235 CV_CALIB_CB_NORMALIZE_IMAGE = 2
236 CV_CALIB_CB_FILTER_QUADS = 4
237 CV_FM_7POINT = 1
238 CV_FM_8POINT = 2
239 CV_FM_LMEDS_ONLY = 4
240 CV_FM_RANSAC_ONLY = 8
241 CV_FM_LMEDS = CV_FM_LMEDS_ONLY + CV_FM_8POINT
242 CV_FM_RANSAC = CV_FM_RANSAC_ONLY + CV_FM_8POINT
243
244
245
246 CV_RETR_EXTERNAL = 0
247 CV_RETR_LIST = 1
248 CV_RETR_CCOMP = 2
249 CV_RETR_TREE = 3
250
251
252 CV_CHAIN_CODE = 0
253 CV_CHAIN_APPROX_NONE = 1
254 CV_CHAIN_APPROX_SIMPLE = 2
255 CV_CHAIN_APPROX_TC89_L1 = 3
256 CV_CHAIN_APPROX_TC89_KCOS = 4
257 CV_LINK_RUNS = 5
258
259
260 CV_WINDOW_AUTOSIZE = 1
261 CV_EVENT_MOUSEMOVE = 0
262 CV_EVENT_LBUTTONDOWN = 1
263 CV_EVENT_RBUTTONDOWN = 2
264 CV_EVENT_MBUTTONDOWN = 3
265 CV_EVENT_LBUTTONUP = 4
266 CV_EVENT_RBUTTONUP = 5
267 CV_EVENT_MBUTTONUP = 6
268 CV_EVENT_LBUTTONDBLCLK = 7
269 CV_EVENT_RBUTTONDBLCLK = 8
270 CV_EVENT_MBUTTONDBLCLK = 9
271 CV_EVENT_FLAG_LBUTTON = 1
272 CV_EVENT_FLAG_RBUTTON = 2
273 CV_EVENT_FLAG_MBUTTON = 4
274 CV_EVENT_FLAG_CTRLKEY = 8
275 CV_EVENT_FLAG_SHIFTKEY = 16
276 CV_EVENT_FLAG_ALTKEY = 32
277 CV_LOAD_IMAGE_UNCHANGED = -1
278 CV_LOAD_IMAGE_GRAYSCALE = 0
279 CV_LOAD_IMAGE_COLOR = 1
280 CV_LOAD_IMAGE_ANYDEPTH = 2
281
282
283 CV_LOAD_IMAGE_ANYCOLOR = 4
284 CV_CVTIMG_FLIP = 1
285 CV_CVTIMG_SWAP_RB = 2
286 CV_CAP_ANY = 0
287 CV_CAP_MIL = 100
288 CV_CAP_VFW = 200
289 CV_CAP_V4L = 200
290 CV_CAP_V4L2 = 200
291 CV_CAP_FIREWARE = 300
292 CV_CAP_IEEE1394 = 300
293 CV_CAP_DC1394 = 300
294 CV_CAP_CMU1394 = 300
295 CV_CAP_STEREO = 400
296 CV_CAP_TYZX = 400
297 CV_TYZX_LEFT = 400
298 CV_TYZX_RIGHT = 401
299 CV_TYZX_COLOR = 402
300 CV_TYZX_Z = 403
301 CV_CAP_QT = 500
302 CV_CAP_PROP_POS_MSEC = 0
303 CV_CAP_PROP_POS_FRAMES = 1
304 CV_CAP_PROP_POS_AVI_RATIO = 2
305 CV_CAP_PROP_FRAME_WIDTH = 3
306 CV_CAP_PROP_FRAME_HEIGHT = 4
307 CV_CAP_PROP_FPS = 5
308 CV_CAP_PROP_FOURCC = 6
309 CV_CAP_PROP_FRAME_COUNT = 7
310 CV_CAP_PROP_FORMAT = 8
311 CV_CAP_PROP_MODE = 9
312 CV_CAP_PROP_BRIGHTNESS = 10
313 CV_CAP_PROP_CONTRAST = 11
314 CV_CAP_PROP_SATURATION = 12
315 CV_CAP_PROP_HUE = 13
316 CV_CAP_PROP_GAIN = 14
317 CV_CAP_PROP_CONVERT_RGB = 15
318
319
320 CV_AUTOSTEP = 0x7fffffff
321 CV_MAX_ARR = 10
322 CV_NO_DEPTH_CHECK = 1
323 CV_NO_CN_CHECK = 2
324 CV_NO_SIZE_CHECK = 4
325 CV_CMP_EQ = 0
326 CV_CMP_GT = 1
327 CV_CMP_GE = 2
328 CV_CMP_LT = 3
329 CV_CMP_LE = 4
330 CV_CMP_NE = 5
331 CV_CHECK_RANGE = 1
332 CV_CHECK_QUIET = 2
333 CV_RAND_UNI = 0
334 CV_RAND_NORMAL = 1
335 CV_GEMM_A_T = 1
336 CV_GEMM_B_T = 2
337 CV_GEMM_C_T = 4
338 CV_SVD_MODIFY_A = 1
339 CV_SVD_U_T = 2
340 CV_SVD_V_T = 4
341 CV_LU = 0
342 CV_SVD = 1
343 CV_SVD_SYM = 2
344 CV_COVAR_SCRAMBLED = 0
345 CV_COVAR_NORMAL = 1
346 CV_COVAR_USE_AVG = 2
347 CV_COVAR_SCALE = 4
348 CV_COVAR_ROWS = 8
349 CV_COVAR_COLS = 16
350 CV_PCA_DATA_AS_ROW = 0
351 CV_PCA_DATA_AS_COL = 1
352 CV_PCA_USE_AVG = 2
353 CV_C = 1
354 CV_L1 = 2
355 CV_L2 = 4
356 CV_NORM_MASK = 7
357 CV_RELATIVE = 8
358 CV_DIFF = 16
359 CV_MINMAX = 32
360 CV_DIFF_C = (CV_DIFF | CV_C)
361 CV_DIFF_L1 = (CV_DIFF | CV_L1)
362 CV_DIFF_L2 = (CV_DIFF | CV_L2)
363 CV_RELATIVE_C = (CV_RELATIVE | CV_C)
364 CV_RELATIVE_L1 = (CV_RELATIVE | CV_L1)
365 CV_RELATIVE_L2 = (CV_RELATIVE | CV_L2)
366 CV_REDUCE_SUM = 0
367 CV_REDUCE_AVG = 1
368 CV_REDUCE_MAX = 2
369 CV_REDUCE_MIN = 3
370 CV_DXT_FORWARD = 0
371 CV_DXT_INVERSE = 1
372 CV_DXT_SCALE = 2
373 CV_DXT_INV_SCALE = CV_DXT_INVERSE + CV_DXT_SCALE
374 CV_DXT_INVERSE_SCALE = CV_DXT_INV_SCALE
375 CV_DXT_ROWS = 4
376 CV_DXT_MUL_CONJ = 8
377 CV_FRONT = 1
378 CV_BACK = 0
379 CV_GRAPH_VERTEX = 1
380 CV_GRAPH_TREE_EDGE = 2
381 CV_GRAPH_BACK_EDGE = 4
382 CV_GRAPH_FORWARD_EDGE = 8
383 CV_GRAPH_CROSS_EDGE = 16
384 CV_GRAPH_ANY_EDGE = 30
385 CV_GRAPH_NEW_TREE = 32
386 CV_GRAPH_BACKTRACKING = 64
387 CV_GRAPH_OVER = -1
388 CV_GRAPH_ALL_ITEMS = -1
389 CV_GRAPH_ITEM_VISITED_FLAG = 1 << 30
390 CV_GRAPH_SEARCH_TREE_NODE_FLAG = 1 << 29
391 CV_GRAPH_FORWARD_EDGE_FLAG = 1 << 28
392 CV_FILLED = -1
393 CV_AA = 16
394 CV_FONT_HERSHEY_SIMPLEX = 0
395 CV_FONT_HERSHEY_PLAIN = 1
396 CV_FONT_HERSHEY_DUPLEX = 2
397 CV_FONT_HERSHEY_COMPLEX = 3
398 CV_FONT_HERSHEY_TRIPLEX = 4
399 CV_FONT_HERSHEY_COMPLEX_SMALL = 5
400 CV_FONT_HERSHEY_SCRIPT_SIMPLEX = 6
401 CV_FONT_HERSHEY_SCRIPT_COMPLEX = 7
402 CV_FONT_ITALIC = 16
403 CV_FONT_VECTOR0 = CV_FONT_HERSHEY_SIMPLEX
404 CV_ErrModeLeaf = 0
405 CV_ErrModeParent = 1
406 CV_ErrModeSilent = 2
407
408
409
410
411 -def cfunc(name, dll, result, *args):
412 '''build and apply a ctypes prototype complete with parameter flags
413 e.g.
414 cvMinMaxLoc = cfunc('cvMinMaxLoc', _cxDLL, None,
415 ('image', POINTER(IplImage), 1),
416 ('min_val', POINTER(double), 2),
417 ('max_val', POINTER(double), 2),
418 ('min_loc', POINTER(CvPoint), 2),
419 ('max_loc', POINTER(CvPoint), 2),
420 ('mask', POINTER(IplImage), 1, None))
421 means locate cvMinMaxLoc in dll _cxDLL, it returns nothing.
422 The first argument is an input image. The next 4 arguments are output, and the last argument is
423 input with an optional value. A typical call might look like:
424
425 min_val,max_val,min_loc,max_loc = cvMinMaxLoc(img)
426 '''
427 atypes = []
428 aflags = []
429 for arg in args:
430 atypes.append(arg[1])
431 aflags.append((arg[2], arg[0]) + arg[3:])
432 return CFUNCTYPE(result, *atypes)((name, dll), tuple(aflags))
433
435 '''Just like a POINTER but accept a list of ctype as an argument'''
438
440 if isinstance(param, (list,tuple)):
441 return (self.etype * len(param))(*param)
442
444 '''Just like POINTER(POINTER(ctype)) but accept a list of lists of ctype'''
447
449 if isinstance(param, (list,tuple)):
450 val = (POINTER(self.etype) * len(param))()
451 for i,v in enumerate(param):
452 if isinstance(v, (list,tuple)):
453 val[i] = (self.etype * len(v))(*v)
454 else:
455 raise TypeError, 'nested list or tuple required at %d' % i
456 return val
457 else:
458 raise TypeError, 'list or tuple required'
459
461 '''Just like a POINTER but accept an argument and pass it byref'''
464
467
469 '''Make the callable argument into a C callback'''
471 self.cbacktype = cbacktype
472
474 return self.cbacktype(param)
475
476
477
478 CV_TM_SQDIFF =0
479 CV_TM_SQDIFF_NORMED =1
480 CV_TM_CCORR =2
481 CV_TM_CCORR_NORMED =3
482 CV_TM_CCOEFF =4
483 CV_TM_CCOEFF_NORMED =5
484
485
486 IPL_DEPTH_SIGN = 0x80000000
487
488 IPL_DEPTH_1U = 1
489 IPL_DEPTH_8U = 8
490 IPL_DEPTH_16U = 16
491 IPL_DEPTH_32F = 32
492
493 IPL_DEPTH_8S = IPL_DEPTH_SIGN + IPL_DEPTH_8U
494 IPL_DEPTH_16S = IPL_DEPTH_SIGN + IPL_DEPTH_16U
495 IPL_DEPTH_32S = IPL_DEPTH_SIGN + 32
496
497 IPL_DATA_ORDER_PIXEL = 0
498 IPL_DATA_ORDER_PLANE = 1
499
500 IPL_ORIGIN_TL = 0
501 IPL_ORIGIN_BL = 1
502
503 IPL_ALIGN_4BYTES = 4
504 IPL_ALIGN_8BYTES = 8
505 IPL_ALIGN_16BYTES = 16
506 IPL_ALIGN_32BYTES = 32
507
508 IPL_ALIGN_DWORD = IPL_ALIGN_4BYTES
509 IPL_ALIGN_QWORD = IPL_ALIGN_8BYTES
510
511 IPL_BORDER_CONSTANT = 0
512 IPL_BORDER_REPLICATE = 1
513 IPL_BORDER_REFLECT = 2
514 IPL_BORDER_WRAP = 3
515
516 IPL_IMAGE_HEADER = 1
517 IPL_IMAGE_DATA = 2
518 IPL_IMAGE_ROI = 4
519
520 CV_TYPE_NAME_IMAGE = "opencv-image"
521
522 IPL_DEPTH_64F = 64
523
524
525 CV_CN_MAX = 4
526 CV_CN_SHIFT = 3
527 CV_DEPTH_MAX = (1 << CV_CN_SHIFT)
528
529 CV_8U = 0
530 CV_8S = 1
531 CV_16U = 2
532 CV_16S = 3
533 CV_32S = 4
534 CV_32F = 5
535 CV_64F = 6
536 CV_USRTYPE1 = 7
537
538
539
540
541
542 CV_THRESH_BINARY = 0
543 CV_THRESH_BINARY_INV = 1
544 CV_THRESH_TRUNC = 2
545 CV_THRESH_TOZERO = 3
546 CV_THRESH_TOZERO_INV = 4
547
548 CV_C = 1
549 CV_L1 = 2
550 CV_L2 = 4
551
552 CV_PI = math.pi
553
554
555
556
557
558 CV_INTER_NN = 0
559 CV_INTER_LINEAR = 1
560 CV_INTER_CUBIC = 2
561 CV_INTER_AREA = 3
562
563
564 CV_RETR_EXTERNAL = 0
565 CV_RETR_LIST = 1
566 CV_RETR_CCOMP = 2
567 CV_RETR_TREE = 3
568
569
570 CV_CHAIN_CODE = 0
571 CV_CHAIN_APPROX_NONE = 1
572 CV_CHAIN_APPROX_SIMPLE = 2
573 CV_CHAIN_APPROX_TC89_L1 = 3
574 CV_CHAIN_APPROX_TC89_KCOS = 4
575 CV_LINK_RUNS = 5
576
577
578
579 CV_WHOLE_SEQ_END_INDEX = 0x3fffffff
580
581
582
583
586 CV_MAKE_TYPE = CV_MAKETYPE
587
588 CV_8UC1 = CV_MAKETYPE(CV_8U,1)
589 CV_8UC2 = CV_MAKETYPE(CV_8U,2)
590 CV_8UC3 = CV_MAKETYPE(CV_8U,3)
591 CV_8UC4 = CV_MAKETYPE(CV_8U,4)
592
593 CV_8SC1 = CV_MAKETYPE(CV_8S,1)
594 CV_8SC2 = CV_MAKETYPE(CV_8S,2)
595 CV_8SC3 = CV_MAKETYPE(CV_8S,3)
596 CV_8SC4 = CV_MAKETYPE(CV_8S,4)
597
598 CV_16UC1 = CV_MAKETYPE(CV_16U,1)
599 CV_16UC2 = CV_MAKETYPE(CV_16U,2)
600 CV_16UC3 = CV_MAKETYPE(CV_16U,3)
601 CV_16UC4 = CV_MAKETYPE(CV_16U,4)
602
603 CV_16SC1 = CV_MAKETYPE(CV_16S,1)
604 CV_16SC2 = CV_MAKETYPE(CV_16S,2)
605 CV_16SC3 = CV_MAKETYPE(CV_16S,3)
606 CV_16SC4 = CV_MAKETYPE(CV_16S,4)
607
608 CV_32SC1 = CV_MAKETYPE(CV_32S,1)
609 CV_32SC2 = CV_MAKETYPE(CV_32S,2)
610 CV_32SC3 = CV_MAKETYPE(CV_32S,3)
611 CV_32SC4 = CV_MAKETYPE(CV_32S,4)
612
613 CV_32FC1 = CV_MAKETYPE(CV_32F,1)
614 CV_32FC2 = CV_MAKETYPE(CV_32F,2)
615 CV_32FC3 = CV_MAKETYPE(CV_32F,3)
616 CV_32FC4 = CV_MAKETYPE(CV_32F,4)
617
618 CV_64FC1 = CV_MAKETYPE(CV_64F,1)
619 CV_64FC2 = CV_MAKETYPE(CV_64F,2)
620 CV_64FC3 = CV_MAKETYPE(CV_64F,3)
621 CV_64FC4 = CV_MAKETYPE(CV_64F,4)
622
623 CV_AUTO_STEP = 0x7fffffff
624
625 CV_MAT_CN_MASK = ((CV_CN_MAX - 1) << CV_CN_SHIFT)
628 CV_MAT_DEPTH_MASK = (CV_DEPTH_MAX - 1)
631 CV_MAT_TYPE_MASK = (CV_DEPTH_MAX*CV_CN_MAX - 1)
634 CV_MAT_CONT_FLAG_SHIFT = 9
635 CV_MAT_CONT_FLAG = (1 << CV_MAT_CONT_FLAG_SHIFT)
638 CV_IS_CONT_MAT = CV_IS_MAT_CONT
639 CV_MAT_TEMP_FLAG_SHIFT = 10
640 CV_MAT_TEMP_FLAG = (1 << CV_MAT_TEMP_FLAG_SHIFT)
643
644 CV_MAGIC_MASK = 0xFFFF0000
645 CV_MAT_MAGIC_VAL = 0x42420000
646 CV_TYPE_NAME_MAT = "opencv-matrix"
647
648
649 CV_TERMCRIT_ITER = 1
650 CV_TERMCRIT_NUMBER = CV_TERMCRIT_ITER
651 CV_TERMCRIT_EPS = 2
652
653
654 CV_STORAGE_READ = 0
655 CV_STORAGE_WRITE = 1
656 CV_STORAGE_WRITE_TEXT = CV_STORAGE_WRITE
657 CV_STORAGE_WRITE_BINARY = CV_STORAGE_WRITE
658 CV_STORAGE_APPEND = 2
659
660 CV_MAX_DIM = 32
661
662 CV_FILLED = -1
663 CV_AA = 16
664
665 CV_VERSION = "1.0.0"
666 CV_MAJOR_VERSION = 1
667 CV_MINOR_VERSION = 0
668 CV_SUBMINOR_VERSION = 0
669 CV_WINDOW_AUTOSIZE = 1
670
671 CV_CAP_PROP_POS_MSEC = 0
672 CV_CAP_PROP_POS_FRAMES = 1
673 CV_CAP_PROP_POS_AVI_RATIO = 2
674 CV_CAP_PROP_FRAME_WIDTH = 3
675 CV_CAP_PROP_FRAME_HEIGHT = 4
676 CV_CAP_PROP_FPS = 5
677 CV_CAP_PROP_FOURCC = 6
678 CV_CAP_PROP_FRAME_COUNT = 7
679 CV_CAP_PROP_FORMAT = 8
680 CV_CAP_PROP_MODE = 9
681 CV_CAP_PROP_BRIGHTNESS =10
682 CV_CAP_PROP_CONTRAST =11
683 CV_CAP_PROP_SATURATION =12
684 CV_CAP_PROP_HUE =13
685 CV_CAP_PROP_GAIN =14
686 CV_CAP_PROP_CONVERT_RGB =15
687
689 return (((ord(c1))&255) + (((ord(c2))&255)<<8) + (((ord(c3))&255)<<16) + (((ord(c4))&255)<<24))
690
691
692
693
694
695
696 CV_SEQ_MAGIC_VAL = 0x42990000
697
698
699
700
701 CV_SET_MAGIC_VAL = 0x42980000
702
703
704
705 CV_SEQ_ELTYPE_BITS = 9
706 CV_SEQ_ELTYPE_MASK = ((1 << CV_SEQ_ELTYPE_BITS) - 1)
707 CV_SEQ_ELTYPE_POINT = CV_32SC2
708 CV_SEQ_ELTYPE_CODE = CV_8UC1
709 CV_SEQ_ELTYPE_GENERIC = 0
710 CV_SEQ_ELTYPE_PTR = CV_USRTYPE1
711 CV_SEQ_ELTYPE_PPOINT = CV_SEQ_ELTYPE_PTR
712 CV_SEQ_ELTYPE_INDEX = CV_32SC1
713 CV_SEQ_ELTYPE_GRAPH_EDGE = 0
714 CV_SEQ_ELTYPE_GRAPH_VERTEX = 0
715 CV_SEQ_ELTYPE_TRIAN_ATR = 0
716 CV_SEQ_ELTYPE_CONNECTED_COMP= 0
717 CV_SEQ_ELTYPE_POINT3D = CV_32FC3
718
719 CV_SEQ_KIND_BITS = 3
720 CV_SEQ_KIND_MASK = (((1 << CV_SEQ_KIND_BITS) - 1)<<CV_SEQ_ELTYPE_BITS)
721
722
723
724 CV_SEQ_KIND_GENERIC = (0 << CV_SEQ_ELTYPE_BITS)
725 CV_SEQ_KIND_CURVE = (1 << CV_SEQ_ELTYPE_BITS)
726 CV_SEQ_KIND_BIN_TREE = (2 << CV_SEQ_ELTYPE_BITS)
727
728
729
730
731
734 '''Print the fields'''
735 res = []
736 for field in self._fields_:
737 res.append('%s=%s' % (field[0], repr(getattr(self, field[0]))))
738 return self.__class__.__name__ + '(' + ','.join(res) + ')'
739 @classmethod
741 '''Magically construct from a tuple'''
742 if isinstance(obj, cls):
743 return obj
744 if isinstance(obj, tuple):
745 return cls(*obj)
746 raise TypeError
747
748
749
750
752 _fields_ = [("x", c_int),
753 ("y", c_int)]
754
755
759
760
765
766
770 CvPoint2D64d = CvPoint2D64f
771
772
777 CvPoint3D64d = CvPoint3D64f
778
779
781 _fields_ = [("width", c_int),
782 ("height", c_int)]
783
784
788
789
791 _fields_ = [("x", c_int),
792 ("y", c_int),
793 ("width", c_int),
794 ("height", c_int)]
797
798
807
808
810 _fields_ = [("type", c_int),
811 ("max_iter", c_int),
812 ("epsilon", c_double)]
813
814
816 _fields_ = [("type", c_int),
817 ("step", c_int),
818 ("refcount", c_void_p),
819 ("hdr_refcount", c_int),
820 ("data", c_void_p),
821 ("rows", c_int),
822 ("cols", c_int)]
823
824
832 _fields_ = [("size", c_int),
833 ("step", c_int)]
840
841
843 _fields_ = [("nSize", c_int),
844 ("ID", c_int),
845 ("nChannels", c_int),
846 ("alphaChannel", c_int),
847 ("depth", c_int),
848 ("colorModel", c_char * 4),
849 ("channelSeq", c_char * 4),
850 ("dataOrder", c_int),
851 ("origin", c_int),
852 ("align", c_int),
853 ("width", c_int),
854 ("height", c_int),
855 ("roi", c_void_p),
856 ("maskROI", c_void_p),
857 ("imageID", c_void_p),
858 ("tileInfo", c_void_p),
859 ("imageSize", c_int),
860 ("imageData", c_int),
861 ("widthStep", c_int),
862 ("BorderMode", c_int * 4),
863 ("BorderConst", c_int * 4),
864 ("imageDataOrigin", c_char_p)]
865
867 '''Print the fields'''
868 res = []
869 for field in self._fields_:
870 if field[0] in ['imageData', 'imageDataOrigin']: continue
871 res.append('%s=%s' % (field[0], repr(getattr(self, field[0]))))
872 return self.__class__.__name__ + '(' + ','.join(res) + ')'
873
874
878
879
880 _lpCvMemStorage = POINTER("CvMemStorage")
882 _fields_ = [("signature", c_int),
883 ("bottom", c_void_p),
884 ("top", c_void_p),
885 ("parent", _lpCvMemStorage),
886 ("block_size", c_int),
887 ("free_space", c_int)]
888 SetPointerType(_lpCvMemStorage, CvMemStorage)
889
892
893
895 _fields_ = [("flags", c_int),
896 ("header_size", c_int),
897 ("h_prev", c_void_p),
898 ("h_next", c_void_p),
899 ("v_prev", c_void_p),
900 ("v_next", c_void_p),
901 ("total", c_int),
902 ("elem_size", c_int),
903 ("block_max", c_void_p),
904 ("ptr", c_void_p),
905 ("delta_elems", c_int),
906 ("storage", POINTER(CvMemStorage)),
907 ("free_blocks", c_void_p),
908 ("first", c_void_p)]
909
911 """
912 generator function iterating along h_next
913 """
914 s = self
915 t = type(self)
916 while s:
917 yield s
918 s = ctypes.cast(s.h_next , POINTER(CvSeq))
919
922
925
928
929
932
933
936
939
943
946
948 _fields_ = [('start_index', c_int),
949 ('end_index', c_int)]
950
953
956
959
962
965
968
971
974
979
982
985
988
991
994
997
1000
1003
1006
1009
1012
1015
1018
1021
1024
1027
1030
1036
1039
1042
1045
1048
1049
1051 _fields_ = [("flags", c_int),
1052 ("header_size", c_int),
1053 ("h_prev", c_void_p),
1054 ("h_next", POINTER(CvSeq)),
1055 ("v_prev", c_void_p),
1056 ("v_next", c_void_p),
1057 ("total", c_int),
1058 ("elem_size", c_int),
1059 ("block_max", c_void_p),
1060 ("ptr", c_void_p),
1061 ("delta_elems", c_int),
1062 ("storage", POINTER(CvMemStorage)),
1063 ("free_blocks", c_void_p),
1064 ("first", c_void_p),
1065 ('rect', CvRect),
1066 ("color", c_int),
1067 ("reserved", c_int * 3)]
1068
1069
1072
1075
1078
1081
1082
1083
1084
1085
1086
1087
1088 cvCreateImage = cfunc('cvCreateImage', _cxDLL, POINTER(IplImage),
1089 ('size', CvSize, 1),
1090 ('depth', c_int, 1),
1091 ('channels', c_int, 1),
1092 )
1093
1094
1095 cvCreateImageHeader = cfunc('cvCreateImageHeader', _cxDLL, POINTER(IplImage),
1096 ('size', CvSize, 1),
1097 ('depth', c_int, 1),
1098 ('channels', c_int, 1),
1099 )
1100
1101
1102 cvReleaseImageHeader = cfunc('cvReleaseImageHeader', _cxDLL, None,
1103 ('image', ByRefArg(POINTER(IplImage)), 1),
1104 )
1105
1106
1107 cvReleaseImage = cfunc('cvReleaseImage', _cxDLL, None,
1108 ('image', ByRefArg(POINTER(IplImage)), 1),
1109 )
1110
1111
1112 cvInitImageHeader = cfunc('cvInitImageHeader', _cxDLL, POINTER(IplImage),
1113 ('image', POINTER(IplImage), 1),
1114 ('size', CvSize, 1),
1115 ('depth', c_int, 1),
1116 ('channels', c_int, 1),
1117 ('origin', c_int, 1, 0),
1118 ('align', c_int, 1, 4),
1119 )
1120
1121
1122 cvCloneImage = cfunc('cvCloneImage', _cxDLL, POINTER(IplImage),
1123 ('image', POINTER(IplImage), 1),
1124 )
1125
1126
1127 cvSetImageCOI = cfunc('cvSetImageCOI', _cxDLL, None,
1128 ('image', POINTER(IplImage), 1),
1129 ('coi', c_int, 1),
1130 )
1131
1132
1133 cvGetImageCOI = cfunc('cvGetImageCOI', _cxDLL, c_int,
1134 ('image', POINTER(IplImage), 1),
1135 )
1136
1137
1138 cvSetImageROI = cfunc('cvSetImageROI', _cxDLL, None,
1139 ('image', POINTER(IplImage), 1),
1140 ('rect', CvRect, 1),
1141 )
1142
1143
1144 cvResetImageROI = cfunc('cvResetImageROI', _cxDLL, None,
1145 ('image', POINTER(IplImage), 1),
1146 )
1147
1148
1149 cvGetImageROI = cfunc('cvGetImageROI', _cxDLL, CvRect,
1150 ('image', POINTER(IplImage), 1),
1151 )
1152
1153
1154 cvCreateMat = cfunc('cvCreateMat', _cxDLL, POINTER(CvMat),
1155 ('rows', c_int, 1),
1156 ('cols', c_int, 1),
1157 ('type', c_int, 1),
1158 )
1159
1160
1161 cvCreateMatHeader = cfunc('cvCreateMatHeader', _cxDLL, POINTER(CvMat),
1162 ('rows', c_int, 1),
1163 ('cols', c_int, 1),
1164 ('type', c_int, 1),
1165 )
1166
1167
1168 cvReleaseMat = cfunc('cvReleaseMat', _cxDLL, None,
1169 ('mat', ByRefArg(POINTER(CvMat)), 1),
1170 )
1171
1172
1173 cvInitMatHeader = cfunc('cvInitMatHeader', _cxDLL, POINTER(CvMat),
1174 ('mat', POINTER(CvMat), 1),
1175 ('rows', c_int, 1),
1176 ('cols', c_int, 1),
1177 ('type', c_int, 1),
1178 ('data', c_void_p, 1, None),
1179 ('step', c_int, 1),
1180 )
1181
1182
1183 cvCloneMat = cfunc('cvCloneMat', _cxDLL, POINTER(CvMat),
1184 ('mat', POINTER(CvMat), 1),
1185 )
1186
1187
1188 cvCreateMatND = cfunc('cvCreateMatND', _cxDLL, POINTER(CvMatND),
1189 ('dims', c_int, 1),
1190 ('sizes', POINTER(c_int), 1),
1191 ('type', c_int, 1),
1192 )
1193
1194
1195 cvCreateMatNDHeader = cfunc('cvCreateMatNDHeader', _cxDLL, POINTER(CvMatND),
1196 ('dims', c_int, 1),
1197 ('sizes', POINTER(c_int), 1),
1198 ('type', c_int, 1),
1199 )
1200
1201
1202 cvInitMatNDHeader = cfunc('cvInitMatNDHeader', _cxDLL, POINTER(CvMatND),
1203 ('mat', POINTER(CvMatND), 1),
1204 ('dims', c_int, 1),
1205 ('sizes', POINTER(c_int), 1),
1206 ('type', c_int, 1),
1207 ('data', c_void_p, 1, None),
1208 )
1209
1210
1211 cvCloneMatND = cfunc('cvCloneMatND', _cxDLL, POINTER(CvMatND),
1212 ('mat', POINTER(CvMatND), 1),
1213 )
1214
1215
1216 cvCreateData = cfunc('cvCreateData', _cxDLL, None,
1217 ('arr', c_void_p, 1),
1218 )
1219
1220
1221 cvReleaseData = cfunc('cvReleaseData', _cxDLL, None,
1222 ('arr', c_void_p, 1),
1223 )
1224
1225
1226 cvSetData = cfunc('cvSetData', _cxDLL, None,
1227 ('arr', c_void_p, 1),
1228 ('data', c_void_p, 1),
1229 ('step', c_int, 1),
1230 )
1231
1232
1233 cvGetRawData = cfunc('cvGetRawData', _cxDLL, None,
1234 ('arr', c_void_p, 1),
1235 ('data', POINTER(POINTER(c_byte)), 1),
1236 ('step', POINTER(c_int), 1, None),
1237 ('roi_size', POINTER(CvSize), 1, None),
1238 )
1239
1240
1241 cvGetMat = cfunc('cvGetMat', _cxDLL, POINTER(CvMat),
1242 ('arr', c_void_p, 1),
1243 ('header', POINTER(CvMat), 1),
1244 ('coi', POINTER(c_int), 1, None),
1245 ('allowND', c_int, 1, 0),
1246 )
1247
1248
1249 cvGetImage = cfunc('cvGetImage', _cxDLL, POINTER(IplImage),
1250 ('arr', c_void_p, 1),
1251 ('image_header', POINTER(IplImage), 1),
1252 )
1253
1254
1255 cvCreateSparseMat = cfunc('cvCreateSparseMat', _cxDLL, POINTER(CvSparseMat),
1256 ('dims', c_int, 1),
1257 ('sizes', POINTER(c_int), 1),
1258 ('type', c_int, 1),
1259 )
1260
1261
1262 cvReleaseSparseMat = cfunc('cvReleaseSparseMat', _cxDLL, None,
1263 ('mat', ByRefArg(POINTER(CvSparseMat)), 1),
1264 )
1265
1266
1267 cvCloneSparseMat = cfunc('cvCloneSparseMat', _cxDLL, POINTER(CvSparseMat),
1268 ('mat', POINTER(CvSparseMat), 1),
1269 )
1270
1271
1272
1273
1274 cvGetSubRect = cfunc('cvGetSubRect', _cxDLL, POINTER(CvMat),
1275 ('arr', c_void_p, 1),
1276 ('submat', POINTER(CvMat), 2),
1277 ('rect', CvRect, 1),
1278 )
1279
1280
1281 cvGetRows = cfunc('cvGetRows', _cxDLL, POINTER(CvMat),
1282 ('arr', c_void_p, 1),
1283 ('submat', POINTER(CvMat), 1),
1284 ('start_row', c_int, 1),
1285 ('end_row', c_int, 1),
1286 ('delta_row', c_int, 1, 1),
1287 )
1288
1289
1290 cvGetCols = cfunc('cvGetCols', _cxDLL, POINTER(CvMat),
1291 ('arr', c_void_p, 1),
1292 ('submat', POINTER(CvMat), 1),
1293 ('start_col', c_int, 1),
1294 ('end_col', c_int, 1),
1295 )
1296
1297
1298 cvGetDiag = cfunc('cvGetDiag', _cxDLL, POINTER(CvMat),
1299 ('arr', c_void_p, 1),
1300 ('submat', POINTER(CvMat), 1),
1301 ('diag', c_int, 1, 0),
1302 )
1303
1304
1305 cvGetSize = cfunc('cvGetSize', _cxDLL, CvSize,
1306 ('arr', c_void_p, 1),
1307 )
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325 cvGetElemType = cfunc('cvGetElemType', _cxDLL, c_int,
1326 ('arr', c_void_p, 1),
1327 )
1328
1329
1330 cvGetDims = cfunc('cvGetDims', _cxDLL, c_int,
1331 ('arr', c_void_p, 1),
1332 ('sizes', POINTER(c_int), 1, None),
1333 )
1334
1335 cvGetDimSize = cfunc('cvGetDimSize', _cxDLL, c_int,
1336 ('arr', c_void_p, 1),
1337 ('index', c_int, 1),
1338 )
1339
1340
1341 cvPtr1D = cfunc('cvPtr1D', _cxDLL, c_void_p,
1342 ('arr', c_void_p, 1),
1343 ('idx0', c_int, 1),
1344 ('type', POINTER(c_int), 1, None),
1345 )
1346
1347 cvPtr2D = cfunc('cvPtr2D', _cxDLL, c_void_p,
1348 ('arr', c_void_p, 1),
1349 ('idx0', c_int, 1),
1350 ('idx1', c_int, 1),
1351 ('type', POINTER(c_int), 1, None),
1352 )
1353
1354 cvPtr3D = cfunc('cvPtr3D', _cxDLL, c_void_p,
1355 ('arr', c_void_p, 1),
1356 ('idx0', c_int, 1),
1357 ('idx1', c_int, 1),
1358 ('idx2', c_int, 1),
1359 ('type', POINTER(c_int), 1, None),
1360 )
1361
1362 cvPtrND = cfunc('cvPtrND', _cxDLL, c_void_p,
1363 ('arr', c_void_p, 1),
1364 ('idx', POINTER(c_int), 1),
1365 ('type', POINTER(c_int), 1, None),
1366 ('create_node', c_int, 1, 1),
1367 ('precalc_hashval', POINTER(c_uint32), 1, None),
1368 )
1369
1370
1371 cvGet1D = cfunc('cvGet1D', _cxDLL, CvScalar,
1372 ('arr', c_void_p, 1),
1373 ('idx0', c_int, 1),
1374 )
1375
1376 cvGet2D = cfunc('cvGet2D', _cxDLL, CvScalar,
1377 ('arr', c_void_p, 1),
1378 ('idx0', c_int, 1),
1379 ('idx1', c_int, 1),
1380 )
1381
1382 cvGet3D = cfunc('cvGet3D', _cxDLL, CvScalar,
1383 ('arr', c_void_p, 1),
1384 ('idx0', c_int, 1),
1385 ('idx1', c_int, 1),
1386 ('idx2', c_int, 1),
1387 )
1388
1389 cvGetND = cfunc('cvGetND', _cxDLL, CvScalar,
1390 ('arr', c_void_p, 1),
1391 ('idx', POINTER(c_int), 1),
1392 )
1393
1394
1395 cvGetReal1D = cfunc('cvGetReal1D', _cxDLL, c_double,
1396 ('arr', c_void_p, 1),
1397 ('idx0', c_int, 1),
1398 )
1399
1400 cvGetReal2D = cfunc('cvGetReal2D', _cxDLL, c_double,
1401 ('arr', c_void_p, 1),
1402 ('idx0', c_int, 1),
1403 ('idx1', c_int, 1),
1404 )
1405
1406 cvGetReal3D = cfunc('cvGetReal3D', _cxDLL, c_double,
1407 ('arr', c_void_p, 1),
1408 ('idx0', c_int, 1),
1409 ('idx1', c_int, 1),
1410 ('idx2', c_int, 1),
1411 )
1412
1413 cvGetRealND = cfunc('cvGetRealND', _cxDLL, c_double,
1414 ('arr', c_void_p, 1),
1415 ('idx', POINTER(c_int), 1),
1416 )
1417
1418
1419 cvSet1D = cfunc('cvSet1D', _cxDLL, None,
1420 ('arr', c_void_p, 1),
1421 ('idx0', c_int, 1),
1422 ('value', CvScalar, 1),
1423 )
1424
1425 cvSet2D = cfunc('cvSet2D', _cxDLL, None,
1426 ('arr', c_void_p, 1),
1427 ('idx0', c_int, 1),
1428 ('idx1', c_int, 1),
1429 ('value', CvScalar, 1),
1430 )
1431
1432 cvSet3D = cfunc('cvSet3D', _cxDLL, None,
1433 ('arr', c_void_p, 1),
1434 ('idx0', c_int, 1),
1435 ('idx1', c_int, 1),
1436 ('idx2', c_int, 1),
1437 ('value', CvScalar, 1),
1438 )
1439
1440 cvSetND = cfunc('cvSetND', _cxDLL, None,
1441 ('arr', c_void_p, 1),
1442 ('idx', POINTER(c_int), 1),
1443 ('value', CvScalar, 1),
1444 )
1445
1446
1447 cvSetReal1D = cfunc('cvSetReal1D', _cxDLL, None,
1448 ('arr', c_void_p, 1),
1449 ('idx0', c_int, 1),
1450 ('value', c_double, 1),
1451 )
1452
1453 cvSetReal2D = cfunc('cvSetReal2D', _cxDLL, None,
1454 ('arr', c_void_p, 1),
1455 ('idx0', c_int, 1),
1456 ('idx1', c_int, 1),
1457 ('value', c_double, 1),
1458 )
1459
1460 cvSetReal3D = cfunc('cvSetReal3D', _cxDLL, None,
1461 ('arr', c_void_p, 1),
1462 ('idx0', c_int, 1),
1463 ('idx1', c_int, 1),
1464 ('idx2', c_int, 1),
1465 ('value', c_double, 1),
1466 )
1467
1468 cvSetRealND = cfunc('cvSetRealND', _cxDLL, None,
1469 ('arr', c_void_p, 1),
1470 ('idx', POINTER(c_int), 1),
1471 ('value', c_double, 1),
1472 )
1473
1474
1475 cvClearND = cfunc('cvClearND', _cxDLL, None,
1476 ('arr', c_void_p, 1),
1477 ('idx', POINTER(c_int), 1),
1478 )
1479
1480
1481
1482
1483 cvCopy = cfunc('cvCopy', _cxDLL, None,
1484 ('src', c_void_p, 1),
1485 ('dst', c_void_p, 1),
1486 ('mask', c_void_p, 1, None),
1487 )
1488
1489
1490 cvSet = cfunc('cvSet', _cxDLL, None,
1491 ('arr', c_void_p, 1),
1492 ('value', CvScalar, 1),
1493 ('mask', c_void_p, 1, None),
1494 )
1495
1496
1497 cvSetZero = cfunc('cvSetZero', _cxDLL, None,
1498 ('arr', c_void_p, 1),
1499 )
1500
1501 cvZero = cvSetZero
1502
1503
1504
1505
1506 cvReshape = cfunc('cvReshape', _cxDLL, POINTER(CvMat),
1507 ('arr', c_void_p, 1),
1508 ('header', POINTER(CvMat), 1),
1509 ('new_cn', c_int, 1),
1510 ('new_rows', c_int, 1, 0),
1511 )
1512
1513
1514 cvReshapeMatND = cfunc('cvReshapeMatND', _cxDLL, c_void_p,
1515 ('arr', c_void_p, 1),
1516 ('sizeof_header', c_int, 1),
1517 ('header', c_void_p, 1),
1518 ('new_cn', c_int, 1),
1519 ('new_dims', c_int, 1),
1520 ('new_sizes', POINTER(c_int), 1),
1521 )
1522
1523
1524 cvRepeat = cfunc('cvRepeat', _cxDLL, None,
1525 ('src', c_void_p, 1),
1526 ('dst', c_void_p, 1),
1527 )
1528
1529
1530 cvFlip = cfunc('cvFlip', _cxDLL, None,
1531 ('src', c_void_p, 1),
1532 ('dst', c_void_p, 1, None),
1533 ('flip_mode', c_int, 1, 0),
1534 )
1535
1536
1537 cvSplit = cfunc('cvSplit', _cxDLL, None,
1538 ('src', c_void_p, 1),
1539 ('dst0', c_void_p, 1, None),
1540 ('dst1', c_void_p, 1, None),
1541 ('dst2', c_void_p, 1, None),
1542 ('dst3', c_void_p, 1, None),
1543 )
1544
1545
1546 cvMerge = cfunc('cvMerge', _cxDLL, None,
1547 ('src0', c_void_p, 1),
1548 ('src1', c_void_p, 1),
1549 ('src2', c_void_p, 1),
1550 ('src3', c_void_p, 1),
1551 ('dst', c_void_p, 1),
1552 )
1553
1554
1555
1556
1557 cvLUT = cfunc('cvLUT', _cxDLL, None,
1558 ('src', c_void_p, 1),
1559 ('dst', c_void_p, 1),
1560 ('lut', c_void_p, 1),
1561 )
1562
1563
1564 cvConvertScale = cfunc('cvConvertScale', _cxDLL, None,
1565 ('src', c_void_p, 1),
1566 ('dst', c_void_p, 1),
1567 ('scale', c_double, 1, 1),
1568 ('shift', c_double, 1, 0),
1569 )
1570
1571 cvCvtScale = cvConvertScale
1572
1573 cvScale = cvConvertScale
1574
1577
1578
1579 cvConvertScaleAbs = cfunc('cvConvertScaleAbs', _cxDLL, None,
1580 ('src', c_void_p, 1),
1581 ('dst', c_void_p, 1),
1582 ('scale', c_double, 1, 1),
1583 ('shift', c_double, 1, 0),
1584 )
1585
1586 cvCvtScaleAbs = cvConvertScaleAbs
1587
1588
1589 cvAdd = cfunc('cvAdd', _cxDLL, None,
1590 ('src1', c_void_p, 1),
1591 ('src2', c_void_p, 1),
1592 ('dst', c_void_p, 1),
1593 ('mask', c_void_p, 1, None),
1594 )
1595
1596
1597 cvAddS = cfunc('cvAddS', _cxDLL, None,
1598 ('src', c_void_p, 1),
1599 ('value', CvScalar, 1),
1600 ('dst', c_void_p, 1),
1601 ('mask', c_void_p, 1, None),
1602 )
1603
1604
1605 cvAddWeighted = cfunc('cvAddWeighted', _cxDLL, None,
1606 ('src1', c_void_p, 1),
1607 ('alpha', c_double, 1),
1608 ('src2', c_void_p, 1),
1609 ('beta', c_double, 1),
1610 ('gamma', c_double, 1),
1611 ('dst', c_void_p, 1),
1612 )
1613
1614
1615 cvSub = cfunc('cvSub', _cxDLL, None,
1616 ('src1', c_void_p, 1),
1617 ('src2', c_void_p, 1),
1618 ('dst', c_void_p, 1),
1619 ('mask', c_void_p, 1, None),
1620 )
1621
1622
1623 cvSubRS = cfunc('cvSubRS', _cxDLL, None,
1624 ('src', c_void_p, 1),
1625 ('value', CvScalar, 1),
1626 ('dst', c_void_p, 1),
1627 ('mask', c_void_p, 1, None),
1628 )
1629
1630
1631 cvMul = cfunc('cvMul', _cxDLL, None,
1632 ('src1', c_void_p, 1),
1633 ('src2', c_void_p, 1),
1634 ('dst', c_void_p, 1),
1635 ('scale', c_double, 1, 1),
1636 )
1637
1638
1639 cvDiv = cfunc('cvDiv', _cxDLL, None,
1640 ('src1', c_void_p, 1),
1641 ('src2', c_void_p, 1),
1642 ('dst', c_void_p, 1),
1643 ('scale', c_double, 1, 1),
1644 )
1645
1646
1647 cvAnd = cfunc('cvAnd', _cxDLL, None,
1648 ('src1', c_void_p, 1),
1649 ('src2', c_void_p, 1),
1650 ('dst', c_void_p, 1),
1651 ('mask', c_void_p, 1, None),
1652 )
1653
1654
1655 cvAndS = cfunc('cvAndS', _cxDLL, None,
1656 ('src', c_void_p, 1),
1657 ('value', CvScalar, 1),
1658 ('dst', c_void_p, 1),
1659 ('mask', c_void_p, 1, None),
1660 )
1661
1662
1663 cvOr = cfunc('cvOr', _cxDLL, None,
1664 ('src1', c_void_p, 1),
1665 ('src2', c_void_p, 1),
1666 ('dst', c_void_p, 1),
1667 ('mask', c_void_p, 1, None),
1668 )
1669
1670
1671 cvOrS = cfunc('cvOrS', _cxDLL, None,
1672 ('src', c_void_p, 1),
1673 ('value', CvScalar, 1),
1674 ('dst', c_void_p, 1),
1675 ('mask', c_void_p, 1, None),
1676 )
1677
1678
1679 cvXor = cfunc('cvXor', _cxDLL, None,
1680 ('src1', c_void_p, 1),
1681 ('src2', c_void_p, 1),
1682 ('dst', c_void_p, 1),
1683 ('mask', c_void_p, 1, None),
1684 )
1685
1686
1687 cvXorS = cfunc('cvXorS', _cxDLL, None,
1688 ('src', c_void_p, 1),
1689 ('value', CvScalar, 1),
1690 ('dst', c_void_p, 1),
1691 ('mask', c_void_p, 1, None),
1692 )
1693
1694
1695 cvNot = cfunc('cvNot', _cxDLL, None,
1696 ('src', c_void_p, 1),
1697 ('dst', c_void_p, 1),
1698 )
1699
1700
1701 cvCmp = cfunc('cvCmp', _cxDLL, None,
1702 ('src1', c_void_p, 1),
1703 ('src2', c_void_p, 1),
1704 ('dst', c_void_p, 1),
1705 ('cmp_op', c_int, 1),
1706 )
1707
1708
1709 cvCmpS = cfunc('cvCmpS', _cxDLL, None,
1710 ('src', c_void_p, 1),
1711 ('value', c_double, 1),
1712 ('dst', c_void_p, 1),
1713 ('cmp_op', c_int, 1),
1714 )
1715
1716
1717 cvInRange = cfunc('cvInRange', _cxDLL, None,
1718 ('src', c_void_p, 1),
1719 ('lower', c_void_p, 1),
1720 ('upper', c_void_p, 1),
1721 ('dst', c_void_p, 1),
1722 )
1723
1724
1725 cvInRangeS = cfunc('cvInRangeS', _cxDLL, None,
1726 ('src', c_void_p, 1),
1727 ('lower', CvScalar, 1),
1728 ('upper', CvScalar, 1),
1729 ('dst', c_void_p, 1),
1730 )
1731
1732
1733 cvMax = cfunc('cvMax', _cxDLL, None,
1734 ('src1', c_void_p, 1),
1735 ('src2', c_void_p, 1),
1736 ('dst', c_void_p, 1),
1737 )
1738
1739
1740 cvMaxS = cfunc('cvMaxS', _cxDLL, None,
1741 ('src', c_void_p, 1),
1742 ('value', c_double, 1),
1743 ('dst', c_void_p, 1),
1744 )
1745
1746
1747 cvMin = cfunc('cvMin', _cxDLL, None,
1748 ('src1', c_void_p, 1),
1749 ('src2', c_void_p, 1),
1750 ('dst', c_void_p, 1),
1751 )
1752
1753
1754 cvMinS = cfunc('cvMinS', _cxDLL, None,
1755 ('src', c_void_p, 1),
1756 ('value', c_double, 1),
1757 ('dst', c_void_p, 1),
1758 )
1759
1760
1761 cvAbsDiff = cfunc('cvAbsDiff', _cxDLL, None,
1762 ('src1', c_void_p, 1),
1763 ('src2', c_void_p, 1),
1764 ('dst', c_void_p, 1),
1765 )
1766
1767
1768 cvAbsDiffS = cfunc('cvAbsDiffS', _cxDLL, None,
1769 ('src', c_void_p, 1),
1770 ('dst', c_void_p, 1),
1771 ('value', CvScalar, 1),
1772 )
1773
1781
1782
1783
1784
1785 cvCountNonZero = cfunc('cvCountNonZero', _cxDLL, c_int,
1786 ('arr', c_void_p, 1),
1787 )
1788
1789
1790 cvSum = cfunc('cvSum', _cxDLL, CvScalar,
1791 ('arr', c_void_p, 1),
1792 )
1793
1794
1795 cvAvg = cfunc('cvAvg', _cxDLL, CvScalar,
1796 ('arr', c_void_p, 1),
1797 ('mask', c_void_p, 1, None),
1798 )
1799
1800
1801 cvAvgSdv = cfunc('cvAvgSdv', _cxDLL, None,
1802 ('arr', c_void_p, 1),
1803 ('mean', POINTER(CvScalar), 1),
1804 ('std_dev', POINTER(CvScalar), 1),
1805 ('mask', c_void_p, 1, None),
1806 )
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820 cvMinMaxLoc = cfunc('cvMinMaxLoc', _cxDLL, None,
1821 ('image', POINTER(IplImage), 1),
1822 ('min_val', POINTER(c_double), 2),
1823 ('max_val', POINTER(c_double), 2),
1824 ('min_loc', POINTER(CvPoint), 2),
1825 ('max_loc', POINTER(CvPoint), 2),
1826 ('mask', c_void_p, 1, None))
1827
1828
1829
1830 cvNorm = cfunc('cvNorm', _cxDLL, c_double,
1831 ('arr1', c_void_p, 1),
1832 ('arr2', c_void_p, 1, None),
1833 ('norm_type', c_int, 1),
1834 ('mask', c_void_p, 1, None),
1835 )
1836
1837
1838
1839
1840 cvSetIdentity = cfunc('cvSetIdentity', _cxDLL, None,
1841 ('mat', c_void_p, 1),
1842 ('value', CvScalar, 1),
1843 )
1844
1845
1846 cvDotProduct = cfunc('cvDotProduct', _cxDLL, c_double,
1847 ('src1', c_void_p, 1),
1848 ('src2', c_void_p, 1),
1849 )
1850
1851
1852 cvCrossProduct = cfunc('cvCrossProduct', _cxDLL, None,
1853 ('src1', c_void_p, 1),
1854 ('src2', c_void_p, 1),
1855 ('dst', c_void_p, 1),
1856 )
1857
1858
1859 cvScaleAdd = cfunc('cvScaleAdd', _cxDLL, None,
1860 ('src1', c_void_p, 1),
1861 ('scale', CvScalar, 1),
1862 ('src2', c_void_p, 1),
1863 ('dst', c_void_p, 1),
1864 )
1865
1866
1867 cvGEMM = cfunc('cvGEMM', _cxDLL, None,
1868 ('src1', c_void_p, 1),
1869 ('src2', c_void_p, 1),
1870 ('alpha', c_double, 1),
1871 ('src3', c_void_p, 1),
1872 ('beta', c_double, 1),
1873 ('dst', c_void_p, 1),
1874 ('tABC', c_int, 1, 0),
1875 )
1876
1878 cvGEMM(src1, src2, 1, src3, 1, dst, 0)
1879
1882
1883
1884 cvTransform = cfunc('cvTransform', _cxDLL, None,
1885 ('src', c_void_p, 1),
1886 ('dst', c_void_p, 1),
1887 ('transmat', POINTER(CvMat), 1),
1888 ('shiftvec', POINTER(CvMat), 1, None),
1889 )
1890
1891
1892 cvPerspectiveTransform = cfunc('cvPerspectiveTransform', _cxDLL, None,
1893 ('src', c_void_p, 1),
1894 ('dst', c_void_p, 1),
1895 ('mat', POINTER(CvMat), 1),
1896 )
1897
1898
1899 cvMulTransposed = cfunc('cvMulTransposed', _cxDLL, None,
1900 ('src', c_void_p, 1),
1901 ('dst', c_void_p, 1),
1902 ('order', c_int, 1),
1903 ('delta', c_void_p, 1, None),
1904 )
1905
1906
1907 cvTrace = cfunc('cvTrace', _cxDLL, CvScalar,
1908 ('mat', c_void_p, 1),
1909 )
1910
1911
1912 cvTranspose = cfunc('cvTranspose', _cxDLL, None,
1913 ('src', c_void_p, 1),
1914 ('dst', c_void_p, 1),
1915 )
1916
1917
1918 cvDet = cfunc('cvDet', _cxDLL, c_double,
1919 ('mat', c_void_p, 1),
1920 )
1921
1922
1923 cvInvert = cfunc('cvInvert', _cxDLL, c_double,
1924 ('src', c_void_p, 1),
1925 ('dst', c_void_p, 1),
1926 ('method', c_int, 1),
1927 )
1928
1929
1930 cvSolve = cfunc('cvSolve', _cxDLL, c_int,
1931 ('src1', c_void_p, 1),
1932 ('src2', c_void_p, 1),
1933 ('dst', c_void_p, 1),
1934 ('method', c_int, 1),
1935 )
1936
1937
1938 cvSVD = cfunc('cvSVD', _cxDLL, None,
1939 ('A', c_void_p, 1),
1940 ('W', c_void_p, 1),
1941 ('U', c_void_p, 1, None),
1942 ('V', c_void_p, 1, None),
1943 ('flags', c_int, 1, 0),
1944 )
1945
1946
1947 cvSVBkSb = cfunc('cvSVBkSb', _cxDLL, None,
1948 ('W', c_void_p, 1),
1949 ('U', c_void_p, 1),
1950 ('V', c_void_p, 1),
1951 ('B', c_void_p, 1),
1952 ('X', c_void_p, 1),
1953 ('flags', c_int, 1),
1954 )
1955
1956
1957 cvEigenVV = cfunc('cvEigenVV', _cxDLL, None,
1958 ('mat', c_void_p, 1),
1959 ('evects', c_void_p, 1),
1960 ('evals', c_void_p, 1),
1961 ('eps', c_double, 1, 0),
1962 )
1963
1964
1965 cvCalcCovarMatrix = cfunc('cvCalcCovarMatrix', _cxDLL, None,
1966 ('vects', POINTER(c_void_p), 1),
1967 ('count', c_int, 1),
1968 ('cov_mat', c_void_p, 1),
1969 ('avg', c_void_p, 1),
1970 ('flags', c_int, 1),
1971 )
1972
1973
1974 cvMahalanobis = cfunc('cvMahalanobis', _cxDLL, c_double,
1975 ('vec1', c_void_p, 1),
1976 ('vec2', c_void_p, 1),
1977 ('mat', c_void_p, 1),
1978 )
1979
1980
1981
1982
1984 return int(val + 0.5)
1985
1986
1987 cvCbrt = cfunc('cvCbrt', _cxDLL, c_float,
1988 ('value', c_float, 1),
1989 )
1990
1991
1992 cvFastArctan = cfunc('cvFastArctan', _cxDLL, c_float,
1993 ('y', c_float, 1),
1994 ('x', c_float, 1),
1995 )
1996
1997
1998 cvCartToPolar = cfunc('cvCartToPolar', _cxDLL, None,
1999 ('x', c_void_p, 1),
2000 ('y', c_void_p, 1),
2001 ('magnitude', c_void_p, 1),
2002 ('angle', c_void_p, 1, None),
2003 ('angle_in_degrees', c_int, 1, 0),
2004 )
2005
2006
2007 cvPolarToCart = cfunc('cvPolarToCart', _cxDLL, None,
2008 ('magnitude', c_void_p, 1),
2009 ('angle', c_void_p, 1),
2010 ('x', c_void_p, 1),
2011 ('y', c_void_p, 1),
2012 ('angle_in_degrees', c_int, 1, 0),
2013 )
2014
2015
2016 cvPow = cfunc('cvPow', _cxDLL, None,
2017 ('src', c_void_p, 1),
2018 ('dst', c_void_p, 1),
2019 ('power', c_double, 1),
2020 )
2021
2022
2023 cvExp = cfunc('cvExp', _cxDLL, None,
2024 ('src', c_void_p, 1),
2025 ('dst', c_void_p, 1),
2026 )
2027
2028
2029 cvLog = cfunc('cvLog', _cxDLL, None,
2030 ('src', c_void_p, 1),
2031 ('dst', c_void_p, 1),
2032 )
2033
2034
2035 cvSolveCubic = cfunc('cvSolveCubic', _cxDLL, None,
2036 ('coeffs', c_void_p, 1),
2037 ('roots', c_void_p, 1),
2038 )
2039
2040
2041
2042
2043 cvRandArr = cfunc('cvRandArr', _cxDLL, None,
2044 ('rng', c_void_p, 1),
2045 ('arr', c_void_p, 1),
2046 ('dist_type', c_int, 1),
2047 ('param1', CvScalar, 1),
2048 ('param2', CvScalar, 1),
2049 )
2050
2051
2052
2053
2054 CV_DXT_FORWARD = 0
2055 CV_DXT_INVERSE = 1
2056 CV_DXT_SCALE = 2
2057 CV_DXT_ROWS = 4
2058 CV_DXT_INV_SCALE = CV_DXT_SCALE | CV_DXT_INVERSE
2059 CV_DXT_INVERSE_SCALE = CV_DXT_INV_SCALE
2060
2061 cvDFT = cfunc('cvDFT', _cxDLL, None,
2062 ('src', c_void_p, 1),
2063 ('dst', c_void_p, 1),
2064 ('flags', c_int, 1),
2065 ('nonzero_rows', c_int, 1, 0),
2066 )
2067
2068
2069 cvGetOptimalDFTSize = cfunc('cvGetOptimalDFTSize', _cxDLL, c_int,
2070 ('size0', c_int, 1),
2071 )
2072
2073
2074 cvMulSpectrums = cfunc('cvMulSpectrums', _cxDLL, None,
2075 ('src1', c_void_p, 1),
2076 ('src2', c_void_p, 1),
2077 ('dst', c_void_p, 1),
2078 ('flags', c_int, 1),
2079 )
2080
2081
2082 CV_DXT_FORWARD = 0
2083 CV_DXT_INVERSE = 1
2084 CV_DXT_ROWS = 4
2085
2086 cvDCT = cfunc('cvDCT', _cxDLL, None,
2087 ('src', c_void_p, 1),
2088 ('dst', c_void_p, 1),
2089 ('flags', c_int, 1),
2090 )
2091
2092
2093
2094
2095
2096
2097 cvCreateMemStorage = cfunc('cvCreateMemStorage', _cxDLL, POINTER(CvMemStorage),
2098 ('block_size', c_int, 1, 0),
2099 )
2100
2101
2102 cvCreateChildMemStorage = cfunc('cvCreateChildMemStorage', _cxDLL, POINTER(CvMemStorage),
2103 ('parent', POINTER(CvMemStorage), 1),
2104 )
2105
2106
2107 cvReleaseMemStorage = cfunc('cvReleaseMemStorage', _cxDLL, None,
2108 ('storage', POINTER(POINTER(CvMemStorage)), 1),
2109 )
2110
2111
2112 cvClearMemStorage = cfunc('cvClearMemStorage', _cxDLL, None,
2113 ('storage', POINTER(CvMemStorage), 1),
2114 )
2115
2116
2117 cvMemStorageAlloc = cfunc('cvMemStorageAlloc', _cxDLL, c_void_p,
2118 ('storage', POINTER(CvMemStorage), 1),
2119 ('size', c_ulong, 1),
2120 )
2121
2122
2123 cvMemStorageAllocString = cfunc('cvMemStorageAllocString', _cxDLL, CvString,
2124 ('storage', POINTER(CvMemStorage), 1),
2125 ('ptr', c_char_p, 1),
2126 ('len', c_int, 1),
2127 )
2128
2129
2130 cvSaveMemStoragePos = cfunc('cvSaveMemStoragePos', _cxDLL, None,
2131 ('storage', POINTER(CvMemStorage), 1),
2132 ('pos', POINTER(CvMemStoragePos), 1),
2133 )
2134
2135
2136 cvRestoreMemStoragePos = cfunc('cvRestoreMemStoragePos', _cxDLL, None,
2137 ('storage', POINTER(CvMemStorage), 1),
2138 ('pos', POINTER(CvMemStoragePos), 1),
2139 )
2140
2141
2142
2143
2144 cvCreateSeq = cfunc('cvCreateSeq', _cxDLL, POINTER(CvSeq),
2145 ('seq_flags', c_int, 1),
2146 ('header_size', c_int, 1),
2147 ('elem_size', c_int, 1),
2148 ('storage', POINTER(CvMemStorage), 1),
2149 )
2150
2151
2152 cvSetSeqBlockSize = cfunc('cvSetSeqBlockSize', _cxDLL, None,
2153 ('seq', POINTER(CvSeq), 1),
2154 ('delta_elems', c_int, 1),
2155 )
2156
2157
2158 cvSeqPush = cfunc('cvSeqPush', _cxDLL, c_void_p,
2159 ('seq', POINTER(CvSeq), 1),
2160 ('element', c_void_p, 1, None),
2161 )
2162
2163
2164 cvSeqPop = cfunc('cvSeqPop', _cxDLL, None,
2165 ('seq', POINTER(CvSeq), 1),
2166 ('element', c_void_p, 1, None),
2167 )
2168
2169
2170 cvSeqPushFront = cfunc('cvSeqPushFront', _cxDLL, c_void_p,
2171 ('seq', POINTER(CvSeq), 1),
2172 ('element', c_void_p, 1, None),
2173 )
2174
2175
2176 cvSeqPopFront = cfunc('cvSeqPopFront', _cxDLL, None,
2177 ('seq', POINTER(CvSeq), 1),
2178 ('element', c_void_p, 1, None),
2179 )
2180
2181
2182 cvSeqPushMulti = cfunc('cvSeqPushMulti', _cxDLL, None,
2183 ('seq', POINTER(CvSeq), 1),
2184 ('elements', c_void_p, 1),
2185 ('count', c_int, 1),
2186 ('in_front', c_int, 1, 0),
2187 )
2188
2189
2190 cvSeqPopMulti = cfunc('cvSeqPopMulti', _cxDLL, None,
2191 ('seq', POINTER(CvSeq), 1),
2192 ('elements', c_void_p, 1),
2193 ('count', c_int, 1),
2194 ('in_front', c_int, 1, 0),
2195 )
2196
2197
2198 cvSeqInsert = cfunc('cvSeqInsert', _cxDLL, c_void_p,
2199 ('seq', POINTER(CvSeq), 1),
2200 ('before_index', c_int, 1),
2201 ('element', c_void_p, 1, None),
2202 )
2203
2204
2205 cvSeqRemove = cfunc('cvSeqRemove', _cxDLL, None,
2206 ('seq', POINTER(CvSeq), 1),
2207 ('index', c_int, 1),
2208 )
2209
2210
2211 cvClearSeq = cfunc('cvClearSeq', _cxDLL, None,
2212 ('seq', POINTER(CvSeq), 1),
2213 )
2214
2215
2216 cvGetSeqElem = cfunc('cvGetSeqElem', _cxDLL, c_void_p,
2217 ('seq', POINTER(CvSeq), 1),
2218 ('index', c_int, 1),
2219 )
2220
2222 result = cvGetSeqElem(seq)
2223 return cast(result, POINTER(TYPE))
2224
2225
2226 cvSeqElemIdx = cfunc('cvSeqElemIdx', _cxDLL, c_int,
2227 ('seq', POINTER(CvSeq), 1),
2228 ('element', c_void_p, 1),
2229 ('block', POINTER(POINTER(CvSeqBlock)), 1, None),
2230 )
2231
2232
2233 cvCvtSeqToArray = cfunc('cvCvtSeqToArray', _cxDLL, c_void_p,
2234 ('seq', POINTER(CvSeq), 1),
2235 ('elements', c_void_p, 1),
2236 ('slice', CvSlice, 1),
2237 )
2238
2239
2240 cvMakeSeqHeaderForArray = cfunc('cvMakeSeqHeaderForArray', _cxDLL, POINTER(CvSeq),
2241 ('seq_type', c_int, 1),
2242 ('header_size', c_int, 1),
2243 ('elem_size', c_int, 1),
2244 ('elements', c_void_p, 1),
2245 ('total', c_int, 1),
2246 ('seq', POINTER(CvSeq), 1),
2247 ('block', POINTER(CvSeqBlock), 1),
2248 )
2249
2250
2251 cvSeqSlice = cfunc('cvSeqSlice', _cxDLL, POINTER(CvSeq),
2252 ('seq', POINTER(CvSeq), 1),
2253 ('slice', CvSlice, 1),
2254 ('storage', POINTER(CvMemStorage), 1, None),
2255 ('copy_data', c_int, 1, 0),
2256 )
2257
2258
2259 cvSeqRemoveSlice = cfunc('cvSeqRemoveSlice', _cxDLL, None,
2260 ('seq', POINTER(CvSeq), 1),
2261 ('slice', CvSlice, 1),
2262 )
2263
2264
2265 cvSeqInsertSlice = cfunc('cvSeqInsertSlice', _cxDLL, None,
2266 ('seq', POINTER(CvSeq), 1),
2267 ('before_index', c_int, 1),
2268 ('from_arr', c_void_p, 1),
2269 )
2270
2271
2272 cvSeqInvert = cfunc('cvSeqInvert', _cxDLL, None,
2273 ('seq', POINTER(CvSeq), 1),
2274 )
2275
2276
2277 CvCmpFunc = CFUNCTYPE(c_int,
2278 c_void_p,
2279 c_void_p,
2280 c_void_p)
2281
2282
2283 cvSeqSort = cfunc('cvSeqSort', _cxDLL, None,
2284 ('seq', POINTER(CvSeq), 1),
2285 ('func', CvCmpFunc, 1),
2286 ('userdata', c_void_p, 1, None),
2287 )
2288
2289
2290 cvSeqSearch = cfunc('cvSeqSearch', _cxDLL, c_void_p,
2291 ('seq', POINTER(CvSeq), 1),
2292 ('elem', c_void_p, 1),
2293 ('func', CvCmpFunc, 1),
2294 ('is_sorted', c_int, 1),
2295 ('elem_idx', POINTER(c_int), 1),
2296 ('userdata', c_void_p, 1, None),
2297 )
2298
2299
2300 cvStartAppendToSeq = cfunc('cvStartAppendToSeq', _cxDLL, None,
2301 ('seq', POINTER(CvSeq), 1),
2302 ('writer', POINTER(CvSeqWriter), 1),
2303 )
2304
2305
2306 cvStartWriteSeq = cfunc('cvStartWriteSeq', _cxDLL, None,
2307 ('seq_flags', c_int, 1),
2308 ('header_size', c_int, 1),
2309 ('elem_size', c_int, 1),
2310 ('storage', POINTER(CvMemStorage), 1),
2311 ('writer', POINTER(CvSeqWriter), 1),
2312 )
2313
2314
2315 cvEndWriteSeq = cfunc('cvEndWriteSeq', _cxDLL, POINTER(CvSeq),
2316 ('writer', POINTER(CvSeqWriter), 1),
2317 )
2318
2319
2320 cvFlushSeqWriter = cfunc('cvFlushSeqWriter', _cxDLL, None,
2321 ('writer', POINTER(CvSeqWriter), 1),
2322 )
2323
2324
2325 cvStartReadSeq = cfunc('cvStartReadSeq', _cxDLL, None,
2326 ('seq', POINTER(CvSeq), 1),
2327 ('reader', POINTER(CvSeqReader), 1),
2328 ('reverse', c_int, 1, 0),
2329 )
2330
2331
2332 cvGetSeqReaderPos = cfunc('cvGetSeqReaderPos', _cxDLL, c_int,
2333 ('reader', POINTER(CvSeqReader), 1),
2334 )
2335
2336
2337 cvSetSeqReaderPos = cfunc('cvSetSeqReaderPos', _cxDLL, None,
2338 ('reader', POINTER(CvSeqReader), 1),
2339 ('index', c_int, 1),
2340 ('is_relative', c_int, 1, 0),
2341 )
2342
2343
2344
2345
2346 cvCreateSet = cfunc('cvCreateSet', _cxDLL, POINTER(CvSET),
2347 ('set_flags', c_int, 1),
2348 ('header_size', c_int, 1),
2349 ('elem_size', c_int, 1),
2350 ('storage', POINTER(CvMemStorage), 1),
2351 )
2352
2353
2354 cvSetAdd = cfunc('cvSetAdd', _cxDLL, c_int,
2355 ('set_header', POINTER(CvSET), 1),
2356 ('elem', POINTER(CvSetElem), 1, None),
2357 ('inserted_elem', POINTER(POINTER(CvSetElem)), 1, None),
2358 )
2359
2360
2361 cvSetRemove = cfunc('cvSetRemove', _cxDLL, None,
2362 ('set_header', POINTER(CvSET), 1),
2363 ('index', c_int, 1),
2364 )
2365
2366
2367 cvClearSet = cfunc('cvClearSet', _cxDLL, None,
2368 ('set_header', POINTER(CvSET), 1),
2369 )
2370
2371
2372
2373
2374 cvCreateGraph = cfunc('cvCreateGraph', _cxDLL, POINTER(CvGraph),
2375 ('graph_flags', c_int, 1),
2376 ('header_size', c_int, 1),
2377 ('vtx_size', c_int, 1),
2378 ('edge_size', c_int, 1),
2379 ('storage', POINTER(CvMemStorage), 1),
2380 )
2381
2382
2383 cvGraphAddVtx = cfunc('cvGraphAddVtx', _cxDLL, c_int,
2384 ('graph', POINTER(CvGraph), 1),
2385 ('vtx', POINTER(CvGraphVtx), 1, None),
2386 ('inserted_vtx', POINTER(POINTER(CvGraphVtx)), 1, None),
2387 )
2388
2389
2390 cvGraphRemoveVtx = cfunc('cvGraphRemoveVtx', _cxDLL, c_int,
2391 ('graph', POINTER(CvGraph), 1),
2392 ('index', c_int, 1),
2393 )
2394
2395
2396 cvGraphRemoveVtxByPtr = cfunc('cvGraphRemoveVtxByPtr', _cxDLL, c_int,
2397 ('graph', POINTER(CvGraph), 1),
2398 ('vtx', POINTER(CvGraphVtx), 1),
2399 )
2400
2401
2402 cvGraphAddEdge = cfunc('cvGraphAddEdge', _cxDLL, c_int,
2403 ('graph', POINTER(CvGraph), 1),
2404 ('start_idx', c_int, 1),
2405 ('end_idx', c_int, 1),
2406 ('edge', POINTER(CvGraphEdge), 1, None),
2407 ('inserted_edge', POINTER(POINTER(CvGraphEdge)), 1, None),
2408 )
2409
2410
2411 cvGraphAddEdgeByPtr = cfunc('cvGraphAddEdgeByPtr', _cxDLL, c_int,
2412 ('graph', POINTER(CvGraph), 1),
2413 ('start_vtx', POINTER(CvGraphVtx), 1),
2414 ('end_vtx', POINTER(CvGraphVtx), 1),
2415 ('edge', POINTER(CvGraphEdge), 1, None),
2416 ('inserted_edge', POINTER(POINTER(CvGraphEdge)), 1, None),
2417 )
2418
2419
2420 cvGraphRemoveEdge = cfunc('cvGraphRemoveEdge', _cxDLL, None,
2421 ('graph', POINTER(CvGraph), 1),
2422 ('start_idx', c_int, 1),
2423 ('end_idx', c_int, 1),
2424 )
2425
2426
2427 cvGraphRemoveEdgeByPtr = cfunc('cvGraphRemoveEdgeByPtr', _cxDLL, None,
2428 ('graph', POINTER(CvGraph), 1),
2429 ('start_vtx', POINTER(CvGraphVtx), 1),
2430 ('end_vtx', POINTER(CvGraphVtx), 1),
2431 )
2432
2433
2434 cvFindGraphEdge = cfunc('cvFindGraphEdge', _cxDLL, POINTER(CvGraphEdge),
2435 ('graph', POINTER(CvGraph), 1),
2436 ('start_idx', c_int, 1),
2437 ('end_idx', c_int, 1),
2438 )
2439
2440
2441 cvFindGraphEdgeByPtr = cfunc('cvFindGraphEdgeByPtr', _cxDLL, POINTER(CvGraphEdge),
2442 ('graph', POINTER(CvGraph), 1),
2443 ('start_vtx', POINTER(CvGraphVtx), 1),
2444 ('end_vtx', POINTER(CvGraphVtx), 1),
2445 )
2446
2447
2448 cvGraphVtxDegree = cfunc('cvGraphVtxDegree', _cxDLL, c_int,
2449 ('graph', POINTER(CvGraph), 1),
2450 ('vtx_idx', c_int, 1),
2451 )
2452
2453
2454 cvGraphVtxDegreeByPtr = cfunc('cvGraphVtxDegreeByPtr', _cxDLL, c_int,
2455 ('graph', POINTER(CvGraph), 1),
2456 ('vtx', POINTER(CvGraphVtx), 1),
2457 )
2458
2459
2460 cvClearGraph = cfunc('cvClearGraph', _cxDLL, None,
2461 ('graph', POINTER(CvGraph), 1),
2462 )
2463
2464
2465 cvCloneGraph = cfunc('cvCloneGraph', _cxDLL, POINTER(CvGraph),
2466 ('graph', POINTER(CvGraph), 1),
2467 ('storage', POINTER(CvMemStorage), 1),
2468 )
2469
2470
2471 cvCreateGraphScanner = cfunc('cvCreateGraphScanner', _cxDLL, POINTER(CvGraphScanner),
2472 ('graph', POINTER(CvGraph), 1),
2473 ('vtx', POINTER(CvGraphVtx), 1, None),
2474 ('mask', c_int, 1),
2475 )
2476
2477
2478 cvNextGraphItem = cfunc('cvNextGraphItem', _cxDLL, c_int,
2479 ('scanner', POINTER(CvGraphScanner), 1),
2480 )
2481
2482
2483 cvReleaseGraphScanner = cfunc('cvReleaseGraphScanner', _cxDLL, None,
2484 ('scanner', POINTER(POINTER(CvGraphScanner)), 1),
2485 )
2486
2487
2488
2489
2490 cvInitTreeNodeIterator = cfunc('cvInitTreeNodeIterator', _cxDLL, None,
2491 ('tree_iterator', POINTER(CvTreeNodeIterator), 1),
2492 ('first', c_void_p, 1),
2493 ('max_level', c_int, 1),
2494 )
2495
2496
2497 cvNextTreeNode = cfunc('cvNextTreeNode', _cxDLL, c_void_p,
2498 ('tree_iterator', POINTER(CvTreeNodeIterator), 1),
2499 )
2500
2501
2502 cvPrevTreeNode = cfunc('cvPrevTreeNode', _cxDLL, c_void_p,
2503 ('tree_iterator', POINTER(CvTreeNodeIterator), 1),
2504 )
2505
2506
2507 cvTreeToNodeSeq = cfunc('cvTreeToNodeSeq', _cxDLL, POINTER(CvSeq),
2508 ('first', c_void_p, 1),
2509 ('header_size', c_int, 1),
2510 ('storage', POINTER(CvMemStorage), 1),
2511 )
2512
2513
2514 cvInsertNodeIntoTree = cfunc('cvInsertNodeIntoTree', _cxDLL, None,
2515 ('node', c_void_p, 1),
2516 ('parent', c_void_p, 1),
2517 ('frame', c_void_p, 1),
2518 )
2519
2520
2521 cvRemoveNodeFromTree = cfunc('cvRemoveNodeFromTree', _cxDLL, None,
2522 ('node', c_void_p, 1),
2523 ('frame', c_void_p, 1),
2524 )
2525
2526
2527
2528
2529
2530
2532 result = CvScalar()
2533 result.val[0] = b
2534 result.val[1] = g
2535 result.val[2] = r
2536 return result
2537
2538
2539 cvLine = cfunc('cvLine', _cxDLL, None,
2540 ('img', c_void_p, 1),
2541 ('pt1', CvPoint, 1),
2542 ('pt2', CvPoint, 1),
2543 ('color', CvScalar, 1),
2544 ('thickness', c_int, 1, 1),
2545 ('line_type', c_int, 1, 8),
2546 ('shift', c_int, 1, 0),
2547 )
2548
2549
2550 cvRectangle = cfunc('cvRectangle', _cxDLL, None,
2551 ('img', c_void_p, 1),
2552 ('pt1', CvPoint, 1),
2553 ('pt2', CvPoint, 1),
2554 ('color', CvScalar, 1),
2555 ('thickness', c_int, 1, 1),
2556 ('line_type', c_int, 1, 8),
2557 ('shift', c_int, 1, 0),
2558 )
2559
2560
2561 cvCircle = cfunc('cvCircle', _cxDLL, None,
2562 ('img', c_void_p, 1),
2563 ('center', CvPoint, 1),
2564 ('radius', c_int, 1),
2565 ('color', CvScalar, 1),
2566 ('thickness', c_int, 1, 1),
2567 ('line_type', c_int, 1, 8),
2568 ('shift', c_int, 1, 0),
2569 )
2570
2571
2572 cvEllipse = cfunc('cvEllipse', _cxDLL, None,
2573 ('img', c_void_p, 1),
2574 ('center', CvPoint, 1),
2575 ('axes', CvSize, 1),
2576 ('angle', c_double, 1),
2577 ('start_angle', c_double, 1),
2578 ('end_angle', c_double, 1),
2579 ('color', CvScalar, 1),
2580 ('thickness', c_int, 1, 1),
2581 ('line_type', c_int, 1, 8),
2582 ('shift', c_int, 1, 0),
2583 )
2584
2585 -def cvEllipseBox(img, box, color, thickness=1, line_type=8, shift=0):
2586 '''Draws simple or thick elliptic arc or fills ellipse sector'''
2587 cvEllipse(img, CvPoint(int(box.center.x), int(box.center.y)),
2588 CvSize(int(box.size.height*0.5),int(box.size.width*0.5)),
2589 box.angle, 0, 360, color, thickness, line_type, shift)
2590
2591
2592
2593 cvFillPoly = cfunc('cvFillPoly', _cxDLL, None,
2594 ('img', c_void_p, 1),
2595 ('pts', POINTER(POINTER(CvPoint)), 1),
2596 ('npts', POINTER(c_int), 1),
2597 ('contours', c_int, 1),
2598 ('color', CvScalar, 1),
2599 ('line_type', c_int, 1, 8),
2600 ('shift', c_int, 1, 0),
2601 )
2602
2603
2604 cvFillConvexPoly = cfunc('cvFillConvexPoly', _cxDLL, None,
2605 ('img', c_void_p, 1),
2606 ('pts', POINTER(CvPoint), 1),
2607 ('npts', c_int, 1),
2608 ('color', CvScalar, 1),
2609 ('line_type', c_int, 1, 8),
2610 ('shift', c_int, 1, 0),
2611 )
2612
2613
2614 cvPolyLine = cfunc('cvPolyLine', _cxDLL, None,
2615 ('img', c_void_p, 1),
2616 ('pts', POINTER(POINTER(CvPoint)), 1),
2617 ('npts', POINTER(c_int), 1),
2618 ('contours', c_int, 1),
2619 ('is_closed', c_int, 1),
2620 ('color', CvScalar, 1),
2621 ('thickness', c_int, 1, 1),
2622 ('line_type', c_int, 1, 8),
2623 ('shift', c_int, 1, 0),
2624 )
2625
2626
2627
2628
2629 cvInitFont = cfunc('cvInitFont', _cxDLL, None,
2630 ('font', POINTER(CvFont), 1),
2631 ('font_face', c_int, 1),
2632 ('hscale', c_double, 1),
2633 ('vscale', c_double, 1),
2634 ('shear', c_double, 1, 0),
2635 ('thickness', c_int, 1, 1),
2636 ('line_type', c_int, 1, 8),
2637 )
2638
2639
2640 cvPutText = cfunc('cvPutText', _cxDLL, None,
2641 ('img', c_void_p, 1),
2642 ('text', c_char_p, 1),
2643 ('org', CvPoint, 1),
2644 ('font', POINTER(CvFont), 1),
2645 ('color', CvScalar, 1),
2646 )
2647
2648
2649 cvGetTextSize = cfunc('cvGetTextSize', _cxDLL, None,
2650 ('text_string', c_char_p, 1),
2651 ('font', POINTER(CvFont), 1),
2652 ('text_size', POINTER(CvSize), 1),
2653 ('baseline', POINTER(c_int), 1),
2654 )
2655
2656
2657
2658
2659 cvDrawContours = cfunc('cvDrawContours', _cxDLL, None,
2660 ('img', c_void_p, 1),
2661 ('contour', c_void_p, 1),
2662 ('external_color', CvScalar, 1),
2663 ('hole_color', CvScalar, 1),
2664 ('max_level', c_int, 1),
2665 ('thickness', c_int, 1, 1),
2666 ('line_type', c_int, 1, 8),
2667 ('offset', CvPoint, 1),
2668 )
2669
2670
2671 cvInitLineIterator = cfunc('cvInitLineIterator', _cxDLL, c_int,
2672 ('image', c_void_p, 1),
2673 ('pt1', CvPoint, 1),
2674 ('pt2', CvPoint, 1),
2675 ('line_iterator', POINTER(CvLineIterator), 1),
2676 ('connectivity', c_int, 1, 8),
2677 ('left_to_right', c_int, 1, 0),
2678 )
2679
2680
2681 cvClipLine = cfunc('cvClipLine', _cxDLL, c_int,
2682 ('img_size', CvSize, 1),
2683 ('pt1', POINTER(CvPoint), 1),
2684 ('pt2', POINTER(CvPoint), 1),
2685 )
2686
2687
2688 cvEllipse2Poly = cfunc('cvEllipse2Poly', _cxDLL, c_int,
2689 ('center', CvPoint, 1),
2690 ('axes', CvSize, 1),
2691 ('angle', c_int, 1),
2692 ('arc_start', c_int, 1),
2693 ('arc_end', c_int, 1),
2694 ('pts', POINTER(CvPoint), 1),
2695 ('delta', c_int, 1),
2696 )
2697
2698
2699
2700
2701
2702
2703 cvOpenFileStorage = cfunc('cvOpenFileStorage', _cxDLL, POINTER(CvFileStorage),
2704 ('filename', c_char_p, 1),
2705 ('memstorage', POINTER(CvMemStorage), 1),
2706 ('flags', c_int, 1),
2707 )
2708
2709
2710 cvReleaseFileStorage = cfunc('cvReleaseFileStorage', _cxDLL, None,
2711 ('fs', POINTER(POINTER(CvFileStorage)), 1),
2712 )
2713
2714
2715
2716
2717 cvStartWriteStruct = cfunc('cvStartWriteStruct', _cxDLL, None,
2718 ('fs', POINTER(CvFileStorage), 1),
2719 ('name', c_char_p, 1),
2720 ('struct_flags', c_int, 1),
2721 ('type_name', c_char_p, 1, None),
2722 ('attributes', CvAttrList, 1),
2723 )
2724
2725
2726 cvEndWriteStruct = cfunc('cvEndWriteStruct', _cxDLL, None,
2727 ('fs', POINTER(CvFileStorage), 1),
2728 )
2729
2730
2731 cvWriteInt = cfunc('cvWriteInt', _cxDLL, None,
2732 ('fs', POINTER(CvFileStorage), 1),
2733 ('name', c_char_p, 1),
2734 ('value', c_int, 1),
2735 )
2736
2737
2738 cvWriteReal = cfunc('cvWriteReal', _cxDLL, None,
2739 ('fs', POINTER(CvFileStorage), 1),
2740 ('name', c_char_p, 1),
2741 ('value', c_double, 1),
2742 )
2743
2744
2745 cvWriteString = cfunc('cvWriteString', _cxDLL, None,
2746 ('fs', POINTER(CvFileStorage), 1),
2747 ('name', c_char_p, 1),
2748 ('str', c_char_p, 1),
2749 ('quote', c_int, 1, 0),
2750 )
2751
2752
2753 cvWriteComment = cfunc('cvWriteComment', _cxDLL, None,
2754 ('fs', POINTER(CvFileStorage), 1),
2755 ('comment', c_char_p, 1),
2756 ('eol_comment', c_int, 1),
2757 )
2758
2759
2760 cvStartNextStream = cfunc('cvStartNextStream', _cxDLL, None,
2761 ('fs', POINTER(CvFileStorage), 1),
2762 )
2763
2764
2765 cvWrite = cfunc('cvWrite', _cxDLL, None,
2766 ('fs', POINTER(CvFileStorage), 1),
2767 ('name', c_char_p, 1),
2768 ('ptr', c_void_p, 1),
2769 ('attributes', CvAttrList, 1),
2770 )
2771
2772
2773 cvWriteRawData = cfunc('cvWriteRawData', _cxDLL, None,
2774 ('fs', POINTER(CvFileStorage), 1),
2775 ('src', c_void_p, 1),
2776 ('len', c_int, 1),
2777 ('dt', c_char_p, 1),
2778 )
2779
2780
2781 cvWriteFileNode = cfunc('cvWriteFileNode', _cxDLL, None,
2782 ('fs', POINTER(CvFileStorage), 1),
2783 ('new_node_name', c_char_p, 1),
2784 ('node', POINTER(CvFileNode), 1),
2785 ('embed', c_int, 1),
2786 )
2787
2788
2789
2790
2791 cvGetRootFileNode = cfunc('cvGetRootFileNode', _cxDLL, POINTER(CvFileNode),
2792 ('fs', POINTER(CvFileStorage), 1),
2793 ('stream_index', c_int, 1, 0),
2794 )
2795
2796
2797 cvGetFileNodeByName = cfunc('cvGetFileNodeByName', _cxDLL, POINTER(CvFileNode),
2798 ('fs', POINTER(CvFileStorage), 1),
2799 ('map', POINTER(CvFileNode), 1),
2800 ('name', c_char_p, 1),
2801 )
2802
2803
2804 cvGetHashedKey = cfunc('cvGetHashedKey', _cxDLL, POINTER(CvStringHashNode),
2805 ('fs', POINTER(CvFileStorage), 1),
2806 ('name', c_char_p, 1),
2807 ('len', c_int, 1),
2808 ('create_missing', c_int, 1, 0),
2809 )
2810
2811
2812 cvGetFileNode = cfunc('cvGetFileNode', _cxDLL, POINTER(CvFileNode),
2813 ('fs', POINTER(CvFileStorage), 1),
2814 ('map', POINTER(CvFileNode), 1),
2815 ('key', POINTER(CvStringHashNode), 1),
2816 ('create_missing', c_int, 1, 0),
2817 )
2818
2819
2820 cvGetFileNodeName = cfunc('cvGetFileNodeName', _cxDLL, c_char_p,
2821 ('node', POINTER(CvFileNode), 1),
2822 )
2823
2824
2825 cvRead = cfunc('cvRead', _cxDLL, c_void_p,
2826 ('fs', POINTER(CvFileStorage), 1),
2827 ('node', POINTER(CvFileNode), 1),
2828 ('attributes', POINTER(CvAttrList), 1, None),
2829 )
2830
2831
2832 cvReadRawData = cfunc('cvReadRawData', _cxDLL, None,
2833 ('fs', POINTER(CvFileStorage), 1),
2834 ('src', POINTER(CvFileNode), 1),
2835 ('dst', c_void_p, 1),
2836 ('dt', c_char_p, 1),
2837 )
2838
2839
2840 cvStartReadRawData = cfunc('cvStartReadRawData', _cxDLL, None,
2841 ('fs', POINTER(CvFileStorage), 1),
2842 ('src', POINTER(CvFileNode), 1),
2843 ('reader', POINTER(CvSeqReader), 1),
2844 )
2845
2846
2847 cvReadRawDataSlice = cfunc('cvReadRawDataSlice', _cxDLL, None,
2848 ('fs', POINTER(CvFileStorage), 1),
2849 ('reader', POINTER(CvSeqReader), 1),
2850 ('count', c_int, 1),
2851 ('dst', c_void_p, 1),
2852 ('dt', c_char_p, 1),
2853 )
2854
2855
2856
2857
2858 cvRegisterType = cfunc('cvRegisterType', _cxDLL, None,
2859 ('info', POINTER(CvTypeInfo), 1),
2860 )
2861
2862
2863 cvUnregisterType = cfunc('cvUnregisterType', _cxDLL, None,
2864 ('type_name', c_char_p, 1),
2865 )
2866
2867
2868 cvFirstType = cfunc('cvFirstType', _cxDLL, POINTER(CvTypeInfo),
2869 )
2870
2871
2872 cvFindType = cfunc('cvFindType', _cxDLL, POINTER(CvTypeInfo),
2873 ('type_name', c_char_p, 1),
2874 )
2875
2876
2877 cvTypeOf = cfunc('cvTypeOf', _cxDLL, POINTER(CvTypeInfo),
2878 ('struct_ptr', c_void_p, 1),
2879 )
2880
2881
2882 cvRelease = cfunc('cvRelease', _cxDLL, None,
2883 ('struct_ptr', POINTER(c_void_p), 1),
2884 )
2885
2886
2887 cvClone = cfunc('cvClone', _cxDLL, c_void_p,
2888 ('struct_ptr', c_void_p, 1),
2889 )
2890
2891
2892 cvSave = cfunc('cvSave', _cxDLL, None,
2893 ('filename', c_char_p, 1),
2894 ('struct_ptr', c_void_p, 1),
2895 ('name', c_char_p, 1, None),
2896 ('comment', c_char_p, 1, None),
2897 ('attributes', CvAttrList, 1),
2898 )
2899
2900
2901 cvLoad = cfunc('cvLoad', _cxDLL, c_void_p,
2902 ('filename', c_char_p, 1),
2903 ('memstorage', POINTER(CvMemStorage), 1, None),
2904 ('name', c_char_p, 1, None),
2905 ('real_name', POINTER(c_char_p), 1, None),
2906 )
2907
2909 '''Use cvLoad and then cast the result to ctype'''
2910 return ctypes.cast(cvLoad(filename), ctypes.POINTER(ctype))
2911
2912
2913
2914
2915
2916 cvCheckArr = cfunc('cvCheckArr', _cxDLL, c_int,
2917 ('arr', c_void_p, 1),
2918 ('flags', c_int, 1, 0),
2919 ('min_val', c_double, 1, 0),
2920 ('max_val', c_double, 1, 0),
2921 )
2922
2923 cvCheckArray = cvCheckArr
2924
2925
2926 cvKMeans2 = cfunc('cvKMeans2', _cxDLL, None,
2927 ('samples', c_void_p, 1),
2928 ('cluster_count', c_int, 1),
2929 ('labels', c_void_p, 1),
2930 ('termcrit', CvTermCriteria, 1),
2931 )
2932
2933
2934 cvSeqPartition = cfunc('cvSeqPartition', _cxDLL, c_int,
2935 ('seq', POINTER(CvSeq), 1),
2936 ('storage', POINTER(CvMemStorage), 1),
2937 ('labels', POINTER(POINTER(CvSeq)), 1),
2938 ('is_equal', CvCmpFunc, 1),
2939 ('userdata', c_void_p, 1),
2940 )
2941
2942
2943
2944
2945
2946
2947 cvGetErrStatus = cfunc('cvGetErrStatus', _cxDLL, c_int,
2948 )
2949
2950
2951 cvSetErrStatus = cfunc('cvSetErrStatus', _cxDLL, None,
2952 ('status', c_int, 1),
2953 )
2954
2955
2956 cvGetErrMode = cfunc('cvGetErrMode', _cxDLL, c_int,
2957 )
2958
2959
2960 CV_ErrModeLeaf = 0
2961 CV_ErrModeParent = 1
2962 CV_ErrModeSilent = 2
2963
2964 cvSetErrMode = cfunc('cvSetErrMode', _cxDLL, c_int,
2965 ('mode', c_int, 1),
2966 )
2967
2968
2969 cvError = cfunc('cvError', _cxDLL, c_int,
2970 ('status', c_int, 1),
2971 ('func_name', c_char_p, 1),
2972 ('err_msg', c_char_p, 1),
2973 ('file_name', c_char_p, 1),
2974 ('line', c_int, 1),
2975 )
2976
2977
2978 cvErrorStr = cfunc('cvErrorStr', _cxDLL, c_char_p,
2979 ('status', c_int, 1),
2980 )
2981
2982
2983 CvErrorCallback = CFUNCTYPE(c_int,
2984 c_int,
2985 c_char_p,
2986 c_char_p,
2987 c_char_p,
2988 c_int)
2989
2990 cvRedirectError = cfunc('cvRedirectError', _cxDLL, CvErrorCallback,
2991 ('error_handler', CvErrorCallback, 1),
2992 ('userdata', c_void_p, 1, None),
2993 ('prev_userdata', POINTER(c_void_p), 1, None),
2994 )
2995
2996
2997 cvNulDevReport = cfunc('cvNulDevReport', _cxDLL, c_int,
2998 ('status', c_int, 1),
2999 ('func_name', c_char_p, 1),
3000 ('err_msg', c_char_p, 1),
3001 ('file_name', c_char_p, 1),
3002 ('line', c_int, 1),
3003 ('userdata', c_void_p, 1),
3004 )
3005
3006 cvStdErrReport = cfunc('cvStdErrReport', _cxDLL, c_int,
3007 ('status', c_int, 1),
3008 ('func_name', c_char_p, 1),
3009 ('err_msg', c_char_p, 1),
3010 ('file_name', c_char_p, 1),
3011 ('line', c_int, 1),
3012 ('userdata', c_void_p, 1),
3013 )
3014
3015 cvGuiBoxReport = cfunc('cvGuiBoxReport', _cxDLL, c_int,
3016 ('status', c_int, 1),
3017 ('func_name', c_char_p, 1),
3018 ('err_msg', c_char_p, 1),
3019 ('file_name', c_char_p, 1),
3020 ('line', c_int, 1),
3021 ('userdata', c_void_p, 1),
3022 )
3023
3024
3025
3026
3027 cvAlloc = cfunc('cvAlloc', _cxDLL, c_void_p,
3028 ('size', c_ulong, 1),
3029 )
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039 cvGetTickCount = cfunc('cvGetTickCount', _cxDLL, c_longlong,
3040 )
3041
3042
3043 cvGetTickFrequency = cfunc('cvGetTickFrequency', _cxDLL, c_double,
3044 )
3045
3046
3047 cvRegisterModule = cfunc('cvRegisterModule', _cxDLL, c_int,
3048 ('module_info', POINTER(CvModuleInfo), 1),
3049 )
3050
3051
3052 cvGetModuleInfo = cfunc('cvGetModuleInfo', _cxDLL, None,
3053 ('module_name', c_char_p, 1),
3054 ('version', POINTER(c_char_p), 1),
3055 ('loaded_addon_plugins', POINTER(c_char_p), 1),
3056 )
3057
3058
3059 cvUseOptimized = cfunc('cvUseOptimized', _cxDLL, c_int,
3060 ('on_off', c_int, 1),
3061 )
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085 cvSobel = cfunc('cvSobel', _cvDLL, None,
3086 ('src', c_void_p, 1),
3087 ('dst', c_void_p, 1),
3088 ('xorder', c_int, 1),
3089 ('yorder', c_int, 1),
3090 ('aperture_size', c_int, 1, 3),
3091 )
3092
3093
3094 cvLaplace = cfunc('cvLaplace', _cvDLL, None,
3095 ('src', c_void_p, 1),
3096 ('dst', c_void_p, 1),
3097 ('aperture_size', c_int, 1, 3),
3098 )
3099
3100
3101 cvCanny = cfunc('cvCanny', _cvDLL, None,
3102 ('image', c_void_p, 1),
3103 ('edges', c_void_p, 1),
3104 ('threshold1', c_double, 1),
3105 ('threshold2', c_double, 1),
3106 ('aperture_size', c_int, 1, 3),
3107 )
3108
3109
3110 cvPreCornerDetect = cfunc('cvPreCornerDetect', _cvDLL, None,
3111 ('image', c_void_p, 1),
3112 ('corners', c_void_p, 1),
3113 ('aperture_size', c_int, 1, 3),
3114 )
3115
3116
3117 cvCornerEigenValsAndVecs = cfunc('cvCornerEigenValsAndVecs', _cvDLL, None,
3118 ('image', c_void_p, 1),
3119 ('eigenvv', c_void_p, 1),
3120 ('block_size', c_int, 1),
3121 ('aperture_size', c_int, 1, 3),
3122 )
3123
3124
3125 cvCornerMinEigenVal = cfunc('cvCornerMinEigenVal', _cvDLL, None,
3126 ('image', c_void_p, 1),
3127 ('eigenval', c_void_p, 1),
3128 ('block_size', c_int, 1),
3129 ('aperture_size', c_int, 1, 3),
3130 )
3131
3132
3133 cvCornerHarris = cfunc('cvCornerHarris', _cvDLL, None,
3134 ('image', c_void_p, 1),
3135 ('harris_responce', c_void_p, 1),
3136 ('block_size', c_int, 1),
3137 ('aperture_size', c_int, 1, 3),
3138 ('k', c_double, 1, 0),
3139 )
3140
3141
3142 cvFindCornerSubPix = cfunc('cvFindCornerSubPix', _cvDLL, None,
3143 ('image', c_void_p, 1),
3144 ('corners', POINTER(CvPoint2D32f), 1),
3145 ('count', c_int, 1),
3146 ('win', CvSize, 1),
3147 ('zero_zone', CvSize, 1),
3148 ('criteria', CvTermCriteria, 1),
3149 )
3150
3151
3152 cvGoodFeaturesToTrack = cfunc('cvGoodFeaturesToTrack', _cvDLL, None,
3153 ('image', c_void_p, 1),
3154 ('eig_image', c_void_p, 1),
3155 ('temp_image', c_void_p, 1),
3156 ('corners', POINTER(CvPoint2D32f), 1),
3157 ('corner_count', POINTER(c_int), 1),
3158 ('quality_level', c_double, 1),
3159 ('min_distance', c_double, 1),
3160 ('mask', c_void_p, 1, None),
3161 ('block_size', c_int, 1, 3),
3162 ('use_harris', c_int, 1, 0),
3163 ('k', c_double, 1, 0),
3164 )
3165
3166
3167
3168
3169 cvSampleLine = cfunc('cvSampleLine', _cvDLL, c_int,
3170 ('image', c_void_p, 1),
3171 ('pt1', CvPoint, 1),
3172 ('pt2', CvPoint, 1),
3173 ('buffer', c_void_p, 1),
3174 ('connectivity', c_int, 1, 8),
3175 )
3176
3177
3178 cvGetRectSubPix = cfunc('cvGetRectSubPix', _cvDLL, None,
3179 ('src', c_void_p, 1),
3180 ('dst', c_void_p, 1),
3181 ('center', CvPoint2D32f, 1),
3182 )
3183
3184
3185 cvGetQuadrangleSubPix = cfunc('cvGetQuadrangleSubPix', _cvDLL, None,
3186 ('src', c_void_p, 1),
3187 ('dst', c_void_p, 1),
3188 ('map_matrix', POINTER(CvMat), 1),
3189 )
3190
3191
3192 cvResize = cfunc('cvResize', _cvDLL, None,
3193 ('src', c_void_p, 1),
3194 ('dst', c_void_p, 1),
3195 ('interpolation', c_int, 1),
3196 )
3197
3198
3199 cvWarpAffine = cfunc('cvWarpAffine', _cvDLL, None,
3200 ('src', c_void_p, 1),
3201 ('dst', c_void_p, 1),
3202 ('map_matrix', POINTER(CvMat), 1),
3203 ('flags', c_int, 1),
3204 ('fillval', CvScalar, 1),
3205 )
3206
3207
3208
3209 cvGetAffineTransform = cfunc('cvGetAffineTransform', _cvDLL, POINTER(CvMat),
3210 ('src', POINTER(CvPoint2D32f), 1),
3211 ('dst', POINTER(CvPoint2D32f), 1),
3212 ('map_matrix', POINTER(CvMat), 1),
3213 )
3214
3215
3216 cv2DRotationMatrix = cfunc('cv2DRotationMatrix', _cvDLL, POINTER(CvMat),
3217 ('center', CvPoint2D32f, 1),
3218 ('angle', c_double, 1),
3219 ('scale', c_double, 1),
3220 ('map_matrix', POINTER(CvMat), 1),
3221 )
3222
3223
3224 cvWarpPerspective = cfunc('cvWarpPerspective', _cvDLL, None,
3225 ('src', c_void_p, 1),
3226 ('dst', c_void_p, 1),
3227 ('map_matrix', POINTER(CvMat), 1),
3228 ('flags', c_int, 1),
3229 ('fillval', CvScalar, 1),
3230 )
3231
3232
3233 cvGetPerspectiveTransform = cfunc('cvGetPerspectiveTransform', _cvDLL, POINTER(CvMat),
3234 ('src', POINTER(CvPoint2D32f), 1),
3235 ('dst', POINTER(CvPoint2D32f), 1),
3236 ('map_matrix', POINTER(CvMat), 1),
3237 )
3238
3239
3240 cvRemap = cfunc('cvRemap', _cvDLL, None,
3241 ('src', c_void_p, 1),
3242 ('dst', c_void_p, 1),
3243 ('mapx', c_void_p, 1),
3244 ('mapy', c_void_p, 1),
3245 ('flags', c_int, 1),
3246 ('fillval', CvScalar, 1),
3247 )
3248
3249
3250 cvLogPolar = cfunc('cvLogPolar', _cvDLL, None,
3251 ('src', c_void_p, 1),
3252 ('dst', c_void_p, 1),
3253 ('center', CvPoint2D32f, 1),
3254 ('M', c_double, 1),
3255 ('flags', c_int, 1),
3256 )
3257
3258
3259
3260
3261 cvCreateStructuringElementEx = cfunc('cvCreateStructuringElementEx', _cvDLL, c_void_p,
3262 ('cols', c_int, 1),
3263 ('rows', c_int, 1),
3264 ('anchor_x', c_int, 1),
3265 ('anchor_y', c_int, 1),
3266 ('shape', c_int, 1),
3267 ('values', POINTER(c_int), 1, None),
3268 )
3269
3270
3271 cvReleaseStructuringElement = cfunc('cvReleaseStructuringElement', _cvDLL, None,
3272 ('element', POINTER(POINTER(IplConvKernel)), 1),
3273 )
3274
3275
3276 cvErode = cfunc('cvErode', _cvDLL, None,
3277 ('src', c_void_p, 1),
3278 ('dst', c_void_p, 1),
3279 ('element', POINTER(IplConvKernel), 1, None),
3280 ('iterations', c_int, 1, 1),
3281 )
3282
3283
3284 cvDilate = cfunc('cvDilate', _cvDLL, None,
3285 ('src', c_void_p, 1),
3286 ('dst', c_void_p, 1),
3287 ('element', POINTER(IplConvKernel), 1, None),
3288 ('iterations', c_int, 1, 1),
3289 )
3290
3291
3292 cvMorphologyEx = cfunc('cvMorphologyEx', _cvDLL, None,
3293 ('src', c_void_p, 1),
3294 ('dst', c_void_p, 1),
3295 ('temp', c_void_p, 1),
3296 ('element', POINTER(IplConvKernel), 1),
3297 ('operation', c_int, 1),
3298 ('iterations', c_int, 1, 1),
3299 )
3300
3301
3302
3303
3304 cvSmooth = cfunc('cvSmooth', _cvDLL, None,
3305 ('src', c_void_p, 1),
3306 ('dst', c_void_p, 1),
3307 ('smoothtype', c_int, 1),
3308 ('param1', c_int, 1, 3),
3309 ('param2', c_int, 1, 0),
3310 ('param3', c_double, 1, 0),
3311 )
3312
3313
3314 cvFilter2D = cfunc('cvFilter2D', _cvDLL, None,
3315 ('src', c_void_p, 1),
3316 ('dst', c_void_p, 1),
3317 ('kernel', POINTER(CvMat), 1),
3318 ('anchor', CvPoint, 1),
3319 )
3320
3321
3322 cvCopyMakeBorder = cfunc('cvCopyMakeBorder', _cvDLL, None,
3323 ('src', c_void_p, 1),
3324 ('dst', c_void_p, 1),
3325 ('offset', CvPoint, 1),
3326 ('bordertype', c_int, 1),
3327 ('value', CvScalar, 1),
3328 )
3329
3330
3331 cvIntegral = cfunc('cvIntegral', _cvDLL, None,
3332 ('image', c_void_p, 1),
3333 ('sum', c_void_p, 1),
3334 ('sqsum', c_void_p, 1, None),
3335 ('tilted_sum', c_void_p, 1, None),
3336 )
3337
3338
3339 CV_BGR2BGRA = 0
3340 CV_RGB2RGBA = CV_BGR2BGRA
3341
3342 CV_BGRA2BGR = 1
3343 CV_RGBA2RGB = CV_BGRA2BGR
3344
3345 CV_BGR2RGBA = 2
3346 CV_RGB2BGRA = CV_BGR2RGBA
3347
3348 CV_RGBA2BGR = 3
3349 CV_BGRA2RGB = CV_RGBA2BGR
3350
3351 CV_BGR2RGB = 4
3352 CV_RGB2BGR = CV_BGR2RGB
3353
3354 CV_BGRA2RGBA = 5
3355 CV_RGBA2BGRA = CV_BGRA2RGBA
3356
3357 CV_BGR2GRAY = 6
3358 CV_RGB2GRAY = 7
3359 CV_GRAY2BGR = 8
3360 CV_GRAY2RGB = CV_GRAY2BGR
3361 CV_GRAY2BGRA = 9
3362 CV_GRAY2RGBA = CV_GRAY2BGRA
3363 CV_BGRA2GRAY = 10
3364 CV_RGBA2GRAY = 11
3365
3366 CV_BGR2BGR565 = 12
3367 CV_RGB2BGR565 = 13
3368 CV_BGR5652BGR = 14
3369 CV_BGR5652RGB = 15
3370 CV_BGRA2BGR565 = 16
3371 CV_RGBA2BGR565 = 17
3372 CV_BGR5652BGRA = 18
3373 CV_BGR5652RGBA = 19
3374
3375 CV_GRAY2BGR565 = 20
3376 CV_BGR5652GRAY = 21
3377
3378 CV_BGR2BGR555 = 22
3379 CV_RGB2BGR555 = 23
3380 CV_BGR5552BGR = 24
3381 CV_BGR5552RGB = 25
3382 CV_BGRA2BGR555 = 26
3383 CV_RGBA2BGR555 = 27
3384 CV_BGR5552BGRA = 28
3385 CV_BGR5552RGBA = 29
3386
3387 CV_GRAY2BGR555 = 30
3388 CV_BGR5552GRAY = 31
3389
3390 CV_BGR2XYZ = 32
3391 CV_RGB2XYZ = 33
3392 CV_XYZ2BGR = 34
3393 CV_XYZ2RGB = 35
3394
3395 CV_BGR2YCrCb = 36
3396 CV_RGB2YCrCb = 37
3397 CV_YCrCb2BGR = 38
3398 CV_YCrCb2RGB = 39
3399
3400 CV_BGR2HSV = 40
3401 CV_RGB2HSV = 41
3402
3403 CV_BGR2Lab = 44
3404 CV_RGB2Lab = 45
3405
3406 CV_BayerBG2BGR = 46
3407 CV_BayerGB2BGR = 47
3408 CV_BayerRG2BGR = 48
3409 CV_BayerGR2BGR = 49
3410
3411 CV_BayerBG2RGB = CV_BayerRG2BGR
3412 CV_BayerGB2RGB = CV_BayerGR2BGR
3413 CV_BayerRG2RGB = CV_BayerBG2BGR
3414 CV_BayerGR2RGB = CV_BayerGB2BGR
3415
3416 CV_BGR2Luv = 50
3417 CV_RGB2Luv = 51
3418 CV_BGR2HLS = 52
3419 CV_RGB2HLS = 53
3420
3421 CV_HSV2BGR = 54
3422 CV_HSV2RGB = 55
3423
3424 CV_Lab2BGR = 56
3425 CV_Lab2RGB = 57
3426 CV_Luv2BGR = 58
3427 CV_Luv2RGB = 59
3428 CV_HLS2BGR = 60
3429 CV_HLS2RGB = 61
3430
3431
3432
3433 cvCvtColor = cfunc('cvCvtColor', _cvDLL, None,
3434 ('src', c_void_p, 1),
3435 ('dst', c_void_p, 1),
3436 ('code', c_int, 1),
3437 )
3438
3439
3440 cvThreshold = cfunc('cvThreshold', _cvDLL, None,
3441 ('src', c_void_p, 1),
3442 ('dst', c_void_p, 1),
3443 ('threshold', c_double, 1),
3444 ('max_value', c_double, 1),
3445 ('threshold_type', c_int, 1),
3446 )
3447
3448
3449 cvAdaptiveThreshold = cfunc('cvAdaptiveThreshold', _cvDLL, None,
3450 ('src', c_void_p, 1),
3451 ('dst', c_void_p, 1),
3452 ('max_value', c_double, 1),
3453 ('adaptive_method', c_int, 1),
3454 ('threshold_type', c_int, 1),
3455 ('block_size', c_int, 1, 3),
3456 ('param1', c_double, 1, 5),
3457 )
3458
3459
3460
3461
3462 cvPyrDown = cfunc('cvPyrDown', _cvDLL, None,
3463 ('src', c_void_p, 1),
3464 ('dst', c_void_p, 1),
3465 ('filter', c_int, 1),
3466 )
3467
3468
3469 cvPyrUp = cfunc('cvPyrUp', _cvDLL, None,
3470 ('src', c_void_p, 1),
3471 ('dst', c_void_p, 1),
3472 ('filter', c_int, 1),
3473 )
3474
3475
3476 cvPyrSegmentation = cfunc('cvPyrSegmentation', _cvDLL, None,
3477 ('src', POINTER(IplImage), 1),
3478 ('dst', POINTER(IplImage), 1),
3479 ('storage', POINTER(CvMemStorage), 1),
3480 ('comp', POINTER(POINTER(CvSeq)), 1),
3481 ('level', c_int, 1),
3482 ('threshold1', c_double, 1),
3483 ('threshold2', c_double, 1),
3484 )
3485
3486
3487
3488
3489
3490 cvFloodFill = cfunc('cvFloodFill', _cvDLL, None,
3491 ('image', c_void_p, 1),
3492 ('seed_point', CvPoint, 1),
3493 ('new_val', CvScalar, 1),
3494 ('lo_diff', CvScalar, 1),
3495 ('up_diff', CvScalar, 1),
3496 ('comp', POINTER(CvConnectedComp), 1, None),
3497 ('flags', c_int, 1, 4),
3498 ('mask', c_void_p, 1, None),
3499 )
3500
3501 CV_FLOODFILL_FIXED_RANGE = 1 << 16
3502 CV_FLOODFILL_MASK_ONLY = 1 << 17
3503
3504
3505 cvFindContours = cfunc('cvFindContours', _cvDLL, c_int,
3506 ('image', c_void_p, 1),
3507 ('storage', POINTER(CvMemStorage), 1),
3508 ('first_contour', POINTER(POINTER(CvSeq)), 1),
3509 ('header_size', c_int, 1),
3510 ('mode', c_int, 1),
3511 ('method', c_int, 1),
3512 ('offset', CvPoint, 1),
3513 )
3514
3515
3516 cvStartFindContours = cfunc('cvStartFindContours', _cvDLL, CvContourScanner,
3517 ('image', c_void_p, 1),
3518 ('storage', POINTER(CvMemStorage), 1),
3519 ('header_size', c_int, 1),
3520 ('mode', c_int, 1),
3521 ('method', c_int, 1),
3522 ('offset', CvPoint, 1),
3523 )
3524
3525
3526 cvFindNextContour = cfunc('cvFindNextContour', _cvDLL, POINTER(CvSeq),
3527 ('scanner', CvContourScanner, 1),
3528 )
3529
3530
3531 cvSubstituteContour = cfunc('cvSubstituteContour', _cvDLL, None,
3532 ('scanner', CvContourScanner, 1),
3533 ('new_contour', POINTER(CvSeq), 1),
3534 )
3535
3536
3537 cvEndFindContours = cfunc('cvEndFindContours', _cvDLL, POINTER(CvSeq),
3538 ('scanner', POINTER(CvContourScanner), 1),
3539 )
3540
3541
3542
3543
3544 cvMoments = cfunc('cvMoments', _cvDLL, None,
3545 ('arr', c_void_p, 1),
3546 ('moments', POINTER(CvMOMENTS), 1),
3547 ('binary', c_int, 1, 0),
3548 )
3549
3550
3551 cvGetSpatialMoment = cfunc('cvGetSpatialMoment', _cvDLL, c_double,
3552 ('moments', POINTER(CvMOMENTS), 1),
3553 ('x_order', c_int, 1),
3554 ('y_order', c_int, 1),
3555 )
3556
3557
3558 cvGetCentralMoment = cfunc('cvGetCentralMoment', _cvDLL, c_double,
3559 ('moments', POINTER(CvMOMENTS), 1),
3560 ('x_order', c_int, 1),
3561 ('y_order', c_int, 1),
3562 )
3563
3564
3565 cvGetNormalizedCentralMoment = cfunc('cvGetNormalizedCentralMoment', _cvDLL, c_double,
3566 ('moments', POINTER(CvMOMENTS), 1),
3567 ('x_order', c_int, 1),
3568 ('y_order', c_int, 1),
3569 )
3570
3571
3572 cvGetHuMoments = cfunc('cvGetHuMoments', _cvDLL, None,
3573 ('moments', POINTER(CvMOMENTS), 1),
3574 ('hu_moments', POINTER(CvHuMoments), 1),
3575 )
3576
3577
3578
3579
3580 cvHoughLines2 = cfunc('cvHoughLines2', _cvDLL, POINTER(CvSeq),
3581 ('image', c_void_p, 1),
3582 ('line_storage', c_void_p, 1),
3583 ('method', c_int, 1),
3584 ('rho', c_double, 1),
3585 ('theta', c_double, 1),
3586 ('threshold', c_int, 1),
3587 ('param1', c_double, 1, 0),
3588 ('param2', c_double, 1, 0),
3589 )
3590
3591
3592 cvHoughCircles = cfunc('cvHoughCircles', _cvDLL, POINTER(CvSeq),
3593 ('image', c_void_p, 1),
3594 ('circle_storage', c_void_p, 1),
3595 ('method', c_int, 1),
3596 ('dp', c_double, 1),
3597 ('min_dist', c_double, 1),
3598 ('param1', c_double, 1, 100),
3599 ('param2', c_double, 1, 100),
3600 )
3601
3602
3603 cvDistTransform = cfunc('cvDistTransform', _cvDLL, None,
3604 ('src', c_void_p, 1),
3605 ('dst', c_void_p, 1),
3606 ('distance_type', c_int, 1),
3607 ('mask_size', c_int, 1, 3),
3608 ('mask', POINTER(c_float), 1, None),
3609 ('labels', c_void_p, 1, None),
3610 )
3611
3612
3613 CV_HIST_ARRAY = 0
3614 CV_HIST_SPARSE = 1
3615
3616
3617 cvCreateHist = cfunc('cvCreateHist', _cvDLL, POINTER(CvHistogram),
3618 ('dims', c_int, 1),
3619 ('sizes', ListPOINTER(c_int), 1),
3620 ('type', c_int, 1),
3621 ('ranges', ListPOINTER2(c_float), 1, None),
3622 ('uniform', c_int, 1, 1),
3623 )
3624
3625
3626 cvSetHistBinRanges = cfunc('cvSetHistBinRanges', _cvDLL, None,
3627 ('hist', POINTER(CvHistogram), 1),
3628 ('ranges', ListPOINTER2(c_float), 1),
3629 ('uniform', c_int, 1, 1),
3630 )
3631
3632
3633 cvReleaseHist = cfunc('cvReleaseHist', _cvDLL, None,
3634 ('hist', ByRefArg(POINTER(CvHistogram)), 1),
3635 )
3636
3637
3638 cvClearHist = cfunc('cvClearHist', _cvDLL, None,
3639 ('hist', POINTER(CvHistogram), 1),
3640 )
3641
3642
3643 cvMakeHistHeaderForArray = cfunc('cvMakeHistHeaderForArray', _cvDLL, POINTER(CvHistogram),
3644 ('dims', c_int, 1),
3645 ('sizes', POINTER(c_int), 1),
3646 ('hist', POINTER(CvHistogram), 1),
3647 ('data', POINTER(c_float), 1),
3648 ('ranges', ListPOINTER2(c_float), 1, None),
3649 ('uniform', c_int, 1, 1),
3650 )
3651
3652
3653 cvGetMinMaxHistValue = cfunc('cvGetMinMaxHistValue', _cvDLL, None,
3654 ('hist', POINTER(CvHistogram), 1),
3655 ('min_value', POINTER(c_float), 2),
3656 ('max_value', POINTER(c_float), 2),
3657 ('min_idx', POINTER(c_int), 2),
3658 ('max_idx', POINTER(c_int), 2),
3659 )
3660
3661
3662 cvNormalizeHist = cfunc('cvNormalizeHist', _cvDLL, None,
3663 ('hist', POINTER(CvHistogram), 1),
3664 ('factor', c_double, 1),
3665 )
3666
3667
3668 cvThreshHist = cfunc('cvThreshHist', _cvDLL, None,
3669 ('hist', POINTER(CvHistogram), 1),
3670 ('threshold', c_double, 1),
3671 )
3672
3673 CV_COMP_CORREL = 0
3674 CV_COMP_CHISQR = 1
3675 CV_COMP_INTERSECT = 2
3676 CV_COMP_BHATTACHARYYA= 3
3677
3678
3679 cvCompareHist = cfunc('cvCompareHist', _cvDLL, c_double,
3680 ('hist1', POINTER(CvHistogram), 1),
3681 ('hist2', POINTER(CvHistogram), 1),
3682 ('method', c_int, 1),
3683 )
3684
3685
3686 cvCopyHist = cfunc('cvCopyHist', _cvDLL, None,
3687 ('src', POINTER(CvHistogram), 1),
3688 ('dst', POINTER(POINTER(CvHistogram)), 1),
3689 )
3690
3691
3692 cvCalcHist = cfunc('cvCalcArrHist', _cvDLL, None,
3693 ('image', ListPOINTER(POINTER(IplImage)), 1),
3694 ('hist', POINTER(CvHistogram), 1),
3695 ('accumulate', c_int, 1, 0),
3696 ('mask', c_void_p, 1, None),
3697 )
3698
3699
3700 cvCalcBackProject = cfunc('cvCalcArrBackProject', _cvDLL, None,
3701 ('image', ListPOINTER(POINTER(IplImage)), 1),
3702 ('back_project', POINTER(IplImage), 1),
3703 ('hist', POINTER(CvHistogram), 1),
3704 )
3705
3706
3707 cvCalcProbDensity = cfunc('cvCalcProbDensity', _cvDLL, None,
3708 ('hist1', POINTER(CvHistogram), 1),
3709 ('hist2', POINTER(CvHistogram), 1),
3710 ('dst_hist', POINTER(CvHistogram), 1),
3711 ('scale', c_double, 1, 255),
3712 )
3713
3716
3719
3722
3723
3724 cvEqualizeHist = cfunc('cvEqualizeHist', _cvDLL, None,
3725 ('src', c_void_p, 1),
3726 ('dst', c_void_p, 1),
3727 )
3728
3729
3730
3731
3732 cvMatchTemplate = cfunc('cvMatchTemplate', _cvDLL, None,
3733 ('image', c_void_p, 1),
3734 ('templ', c_void_p, 1),
3735 ('result', c_void_p, 1),
3736 ('method', c_int, 1),
3737 )
3738
3739
3740 cvMatchShapes = cfunc('cvMatchShapes', _cvDLL, c_double,
3741 ('object1', c_void_p, 1),
3742 ('object2', c_void_p, 1),
3743 ('method', c_int, 1),
3744 ('parameter', c_double, 1, 0),
3745 )
3746
3747
3748 CvDistanceFunction = CFUNCTYPE(c_float,
3749 c_void_p,
3750 c_void_p,
3751 c_void_p)
3752
3753 cvCalcEMD2 = cfunc('cvCalcEMD2', _cvDLL, c_float,
3754 ('signature1', c_void_p, 1),
3755 ('signature2', c_void_p, 1),
3756 ('distance_type', c_int, 1),
3757 ('distance_func', CvDistanceFunction, 1, None),
3758 ('cost_matrix', c_void_p, 1, None),
3759 ('flow', c_void_p, 1, None),
3760 ('lower_bound', POINTER(c_float), 1, None),
3761 ('userdata', c_void_p, 1, None),
3762 )
3763
3764
3765
3766
3767
3768
3769 cvApproxChains = cfunc('cvApproxChains', _cvDLL, POINTER(CvSeq),
3770 ('src_seq', POINTER(CvSeq), 1),
3771 ('storage', POINTER(CvMemStorage), 1),
3772 ('method', c_int, 1),
3773 ('parameter', c_double, 1, 0),
3774 ('minimal_perimeter', c_int, 1, 0),
3775 ('recursive', c_int, 1, 0),
3776 )
3777
3778
3779 cvStartReadChainPoints = cfunc('cvStartReadChainPoints', _cvDLL, None,
3780 ('chain', POINTER(CvChain), 1),
3781 ('reader', POINTER(CvChainPtReader), 1),
3782 )
3783
3784
3785 cvReadChainPoint = cfunc('cvReadChainPoint', _cvDLL, CvPoint,
3786 ('reader', POINTER(CvChainPtReader), 1),
3787 )
3788
3789
3790 cvApproxPoly = cfunc('cvApproxPoly', _cvDLL, POINTER(CvSeq),
3791 ('src_seq', c_void_p, 1),
3792 ('header_size', c_int, 1),
3793 ('storage', POINTER(CvMemStorage), 1),
3794 ('method', c_int, 1),
3795 ('parameter', c_double, 1),
3796 ('parameter2', c_int, 1, 0),
3797 )
3798
3799
3800 cvBoundingRect = cfunc('cvBoundingRect', _cvDLL, CvRect,
3801 ('points', c_void_p, 1),
3802 ('update', c_int, 1, 0),
3803 )
3804
3805
3806 cvContourArea = cfunc('cvContourArea', _cvDLL, c_double,
3807 ('contour', c_void_p, 1),
3808 ('slice', CvSlice, 1),
3809 )
3810
3811
3812 cvArcLength = cfunc('cvArcLength', _cvDLL, c_double,
3813 ('curve', c_void_p, 1),
3814 ('slice', CvSlice, 1),
3815 ('is_closed', c_int, 1),
3816 )
3817
3818
3819 cvCreateContourTree = cfunc('cvCreateContourTree', _cvDLL, POINTER(CvContourTree),
3820 ('contour', POINTER(CvSeq), 1),
3821 ('storage', POINTER(CvMemStorage), 1),
3822 ('threshold', c_double, 1),
3823 )
3824
3825
3826 cvContourFromContourTree = cfunc('cvContourFromContourTree', _cvDLL, POINTER(CvSeq),
3827 ('tree', POINTER(CvContourTree), 1),
3828 ('storage', POINTER(CvMemStorage), 1),
3829 ('criteria', CvTermCriteria, 1),
3830 )
3831
3832
3833 cvMatchContourTrees = cfunc('cvMatchContourTrees', _cvDLL, c_double,
3834 ('tree1', POINTER(CvContourTree), 1),
3835 ('tree2', POINTER(CvContourTree), 1),
3836 ('method', c_int, 1),
3837 ('threshold', c_double, 1),
3838 )
3839
3840
3841
3842
3843 cvMaxRect = cfunc('cvMaxRect', _cvDLL, CvRect,
3844 ('rect1', POINTER(CvRect), 1),
3845 ('rect2', POINTER(CvRect), 1),
3846 )
3847
3848
3849 cvPointSeqFromMat = cfunc('cvPointSeqFromMat', _cvDLL, POINTER(CvSeq),
3850 ('seq_kind', c_int, 1),
3851 ('mat', c_void_p, 1),
3852 ('contour_header', POINTER(CvContour), 1),
3853 ('block', POINTER(CvSeqBlock), 1),
3854 )
3855
3856
3857 cvBoxPoints = cfunc('cvBoxPoints', _cvDLL, None,
3858 ('box', CvBox2D, 1),
3859 ('pt', CvPoint2D32f, 1),
3860 )
3861
3862
3863 cvFitEllipse2 = cfunc('cvFitEllipse2', _cvDLL, CvBox2D,
3864 ('points', c_void_p, 1),
3865 )
3866
3867
3868 cvFitLine = cfunc('cvFitLine', _cvDLL, None,
3869 ('points', c_void_p, 1),
3870 ('dist_type', c_int, 1),
3871 ('param', c_double, 1),
3872 ('reps', c_double, 1),
3873 ('aeps', c_double, 1),
3874 ('line', POINTER(c_float), 1),
3875 )
3876
3877
3878 cvConvexHull2 = cfunc('cvConvexHull2', _cvDLL, POINTER(CvSeq),
3879 ('input', c_void_p, 1),
3880 ('hull_storage', c_void_p, 1, None),
3881 ('orientation', c_int, 1),
3882 ('return_points', c_int, 1, 0),
3883 )
3884
3885
3886 cvCheckContourConvexity = cfunc('cvCheckContourConvexity', _cvDLL, c_int,
3887 ('contour', c_void_p, 1),
3888 )
3889
3890
3891 cvConvexityDefects = cfunc('cvConvexityDefects', _cvDLL, POINTER(CvSeq),
3892 ('contour', c_void_p, 1),
3893 ('convexhull', c_void_p, 1),
3894 ('storage', POINTER(CvMemStorage), 1, None),
3895 )
3896
3897
3898 cvPointPolygonTest = cfunc('cvPointPolygonTest', _cvDLL, c_double,
3899 ('contour', c_void_p, 1),
3900 ('pt', CvPoint2D32f, 1),
3901 ('measure_dist', c_int, 1),
3902 )
3903
3904
3905 cvMinAreaRect2 = cfunc('cvMinAreaRect2', _cvDLL, CvBox2D,
3906 ('points', c_void_p, 1),
3907 ('storage', POINTER(CvMemStorage), 1, None),
3908 )
3909
3910
3911 cvMinEnclosingCircle = cfunc('cvMinEnclosingCircle', _cvDLL, c_int,
3912 ('points', c_void_p, 1),
3913 ('center', POINTER(CvPoint2D32f), 1),
3914 ('radius', POINTER(c_float), 1),
3915 )
3916
3917
3918 cvCalcPGH = cfunc('cvCalcPGH', _cvDLL, None,
3919 ('contour', POINTER(CvSeq), 1),
3920 ('hist', POINTER(CvHistogram), 1),
3921 )
3922
3923
3924
3925
3926 cvSubdivDelaunay2DInsert = cfunc('cvSubdivDelaunay2DInsert', _cvDLL, POINTER(CvSubdiv2DPoint),
3927 ('subdiv', POINTER(CvSubdiv2D), 1),
3928 ('pt', CvPoint2D32f, 1),
3929 )
3930
3931
3932 cvSubdiv2DLocate = cfunc('cvSubdiv2DLocate', _cvDLL, CvSubdiv2DPointLocation,
3933 ('subdiv', POINTER(CvSubdiv2D), 1),
3934 ('pt', CvPoint2D32f, 1),
3935 ('edge', POINTER(CvSubdiv2DEdge), 1),
3936 ('vertex', POINTER(POINTER(CvSubdiv2DPoint)), 1, None),
3937 )
3938
3939
3940 cvFindNearestPoint2D = cfunc('cvFindNearestPoint2D', _cvDLL, POINTER(CvSubdiv2DPoint),
3941 ('subdiv', POINTER(CvSubdiv2D), 1),
3942 ('pt', CvPoint2D32f, 1),
3943 )
3944
3945
3946 cvCalcSubdivVoronoi2D = cfunc('cvCalcSubdivVoronoi2D', _cvDLL, None,
3947 ('subdiv', POINTER(CvSubdiv2D), 1),
3948 )
3949
3950
3951 cvClearSubdivVoronoi2D = cfunc('cvClearSubdivVoronoi2D', _cvDLL, None,
3952 ('subdiv', POINTER(CvSubdiv2D), 1),
3953 )
3954
3955
3956
3957
3958
3959
3960 cvAcc = cfunc('cvAcc', _cvDLL, None,
3961 ('image', c_void_p, 1),
3962 ('sum', c_void_p, 1),
3963 ('mask', c_void_p, 1, None),
3964 )
3965
3966
3967 cvSquareAcc = cfunc('cvSquareAcc', _cvDLL, None,
3968 ('image', c_void_p, 1),
3969 ('sqsum', c_void_p, 1),
3970 ('mask', c_void_p, 1, None),
3971 )
3972
3973
3974 cvMultiplyAcc = cfunc('cvMultiplyAcc', _cvDLL, None,
3975 ('image1', c_void_p, 1),
3976 ('image2', c_void_p, 1),
3977 ('acc', c_void_p, 1),
3978 ('mask', c_void_p, 1, None),
3979 )
3980
3981
3982 cvRunningAvg = cfunc('cvRunningAvg', _cvDLL, None,
3983 ('image', c_void_p, 1),
3984 ('acc', c_void_p, 1),
3985 ('alpha', c_double, 1),
3986 ('mask', c_void_p, 1, None),
3987 )
3988
3989
3990
3991
3992 cvUpdateMotionHistory = cfunc('cvUpdateMotionHistory', _cvDLL, None,
3993 ('silhouette', c_void_p, 1),
3994 ('mhi', c_void_p, 1),
3995 ('timestamp', c_double, 1),
3996 ('duration', c_double, 1),
3997 )
3998
3999
4000 cvCalcMotionGradient = cfunc('cvCalcMotionGradient', _cvDLL, None,
4001 ('mhi', c_void_p, 1),
4002 ('mask', c_void_p, 1),
4003 ('orientation', c_void_p, 1),
4004 ('delta1', c_double, 1),
4005 ('delta2', c_double, 1),
4006 ('aperture_size', c_int, 1, 3),
4007 )
4008
4009
4010 cvCalcGlobalOrientation = cfunc('cvCalcGlobalOrientation', _cvDLL, c_double,
4011 ('orientation', c_void_p, 1),
4012 ('mask', c_void_p, 1),
4013 ('mhi', c_void_p, 1),
4014 ('timestamp', c_double, 1),
4015 ('duration', c_double, 1),
4016 )
4017
4018
4019 cvSegmentMotion = cfunc('cvSegmentMotion', _cvDLL, POINTER(CvSeq),
4020 ('mhi', c_void_p, 1),
4021 ('seg_mask', c_void_p, 1),
4022 ('storage', POINTER(CvMemStorage), 1),
4023 ('timestamp', c_double, 1),
4024 ('seg_thresh', c_double, 1),
4025 )
4026
4027
4028
4029
4030 cvMeanShift = cfunc('cvMeanShift', _cvDLL, c_int,
4031 ('prob_image', c_void_p, 1),
4032 ('window', CvRect, 1),
4033 ('criteria', CvTermCriteria, 1),
4034 ('comp', POINTER(CvConnectedComp), 1),
4035 )
4036
4037
4038 cvCamShift = cfunc('cvCamShift', _cvDLL, c_int,
4039 ('prob_image', c_void_p, 1),
4040 ('window', CvRect, 1),
4041 ('criteria', CvTermCriteria, 1),
4042 ('comp', POINTER(CvConnectedComp), 2),
4043 ('box', POINTER(CvBox2D), 2),
4044 )
4045
4046
4047 cvSnakeImage = cfunc('cvSnakeImage', _cvDLL, None,
4048 ('image', POINTER(IplImage), 1),
4049 ('points', POINTER(CvPoint), 1),
4050 ('length', c_int, 1),
4051 ('alpha', POINTER(c_float), 1),
4052 ('beta', POINTER(c_float), 1),
4053 ('gamma', POINTER(c_float), 1),
4054 ('coeff_usage', c_int, 1),
4055 ('win', CvSize, 1),
4056 ('criteria', CvTermCriteria, 1),
4057 ('calc_gradient', c_int, 1, 1),
4058 )
4059
4060
4061
4062
4063 cvCalcOpticalFlowHS = cfunc('cvCalcOpticalFlowHS', _cvDLL, None,
4064 ('prev', c_void_p, 1),
4065 ('curr', c_void_p, 1),
4066 ('use_previous', c_int, 1),
4067 ('velx', c_void_p, 1),
4068 ('vely', c_void_p, 1),
4069 ('lambda', c_double, 1),
4070 ('criteria', CvTermCriteria, 1),
4071 )
4072
4073
4074 cvCalcOpticalFlowLK = cfunc('cvCalcOpticalFlowLK', _cvDLL, None,
4075 ('prev', c_void_p, 1),
4076 ('curr', c_void_p, 1),
4077 ('win_size', CvSize, 1),
4078 ('velx', c_void_p, 1),
4079 ('vely', c_void_p, 1),
4080 )
4081
4082
4083 cvCalcOpticalFlowBM = cfunc('cvCalcOpticalFlowBM', _cvDLL, None,
4084 ('prev', c_void_p, 1),
4085 ('curr', c_void_p, 1),
4086 ('block_size', CvSize, 1),
4087 ('shift_size', CvSize, 1),
4088 ('max_range', CvSize, 1),
4089 ('use_previous', c_int, 1),
4090 ('velx', c_void_p, 1),
4091 ('vely', c_void_p, 1),
4092 )
4093
4094
4095 cvCalcOpticalFlowPyrLK = cfunc('cvCalcOpticalFlowPyrLK', _cvDLL, None,
4096 ('prev', c_void_p, 1),
4097 ('curr', c_void_p, 1),
4098 ('prev_pyr', c_void_p, 1),
4099 ('curr_pyr', c_void_p, 1),
4100 ('prev_features', POINTER(CvPoint2D32f), 1),
4101 ('curr_features', POINTER(CvPoint2D32f), 1),
4102 ('count', c_int, 1),
4103 ('win_size', CvSize, 1),
4104 ('level', c_int, 1),
4105 ('status', c_char_p, 1),
4106 ('track_error', POINTER(c_float), 1),
4107 ('criteria', CvTermCriteria, 1),
4108 ('flags', c_int, 1),
4109 )
4110
4111
4112
4113
4114 cvCreateKalman = cfunc('cvCreateKalman', _cvDLL, POINTER(CvKalman),
4115 ('dynam_params', c_int, 1),
4116 ('measure_params', c_int, 1),
4117 ('control_params', c_int, 1, 0),
4118 )
4119
4120
4121 cvReleaseKalman = cfunc('cvReleaseKalman', _cvDLL, None,
4122 ('kalman', POINTER(POINTER(CvKalman)), 1),
4123 )
4124
4125
4126 cvKalmanPredict = cfunc('cvKalmanPredict', _cvDLL, POINTER(CvMat),
4127 ('kalman', POINTER(CvKalman), 1),
4128 ('control', POINTER(CvMat), 1, None),
4129 )
4130
4131 cvKalmanUpdateByTime = cvKalmanPredict
4132
4133
4134 cvKalmanCorrect = cfunc('cvKalmanCorrect', _cvDLL, POINTER(CvMat),
4135 ('kalman', POINTER(CvKalman), 1),
4136 ('measurement', POINTER(CvMat), 1),
4137 )
4138
4139 cvKalmanUpdateByMeasurement = cvKalmanCorrect
4140
4141
4142 cvCreateConDensation = cfunc('cvCreateConDensation', _cvDLL, POINTER(CvConDensation),
4143 ('dynam_params', c_int, 1),
4144 ('measure_params', c_int, 1),
4145 ('sample_count', c_int, 1),
4146 )
4147
4148
4149 cvReleaseConDensation = cfunc('cvReleaseConDensation', _cvDLL, None,
4150 ('condens', POINTER(POINTER(CvConDensation)), 1),
4151 )
4152
4153
4154 cvConDensInitSampleSet = cfunc('cvConDensInitSampleSet', _cvDLL, None,
4155 ('condens', POINTER(CvConDensation), 1),
4156 ('lower_bound', POINTER(CvMat), 1),
4157 ('upper_bound', POINTER(CvMat), 1),
4158 )
4159
4160
4161 cvConDensUpdateByTime = cfunc('cvConDensUpdateByTime', _cvDLL, None,
4162 ('condens', POINTER(CvConDensation), 1),
4163 )
4164
4165
4166
4167
4168
4169
4170 cvLoadHaarClassifierCascade = cfunc('cvLoadHaarClassifierCascade', _cvDLL, POINTER(CvHaarClassifierCascade),
4171 ('directory', c_char_p, 1),
4172 ('orig_window_size', CvSize, 1),
4173 )
4174
4175
4176 cvReleaseHaarClassifierCascade = cfunc('cvReleaseHaarClassifierCascade', _cvDLL, None,
4177 ('cascade', POINTER(POINTER(CvHaarClassifierCascade)), 1),
4178 )
4179
4180
4181 cvHaarDetectObjects = cfunc('cvHaarDetectObjects', _cvDLL, POINTER(CvSeq),
4182 ('image', c_void_p, 1),
4183 ('cascade', POINTER(CvHaarClassifierCascade), 1),
4184 ('storage', POINTER(CvMemStorage), 1),
4185 ('scale_factor', c_double, 1, 1),
4186 ('min_neighbors', c_int, 1, 3),
4187 ('flags', c_int, 1, 0),
4188 ('min_size', CvSize, 1),
4189 )
4191 '''Handle the casting to extract a list of Rects from the Seq returned'''
4192 res = []
4193 for i in xrange(result[0].total):
4194 f = cvGetSeqElem(result, i)
4195 r = ctypes.cast(f, ctypes.POINTER(CvRect))[0]
4196 res.append(r)
4197 return res
4198 cvHaarDetectObjects.errcheck = ChangeCvSeqToCvRect
4199
4200
4201
4202 cvSetImagesForHaarClassifierCascade = cfunc('cvSetImagesForHaarClassifierCascade', _cvDLL, None,
4203 ('cascade', POINTER(CvHaarClassifierCascade), 1),
4204 ('sum', c_void_p, 1),
4205 ('sqsum', c_void_p, 1),
4206 ('tilted_sum', c_void_p, 1),
4207 ('scale', c_double, 1),
4208 )
4209
4210
4211 cvRunHaarClassifierCascade = cfunc('cvRunHaarClassifierCascade', _cvDLL, c_int,
4212 ('cascade', POINTER(CvHaarClassifierCascade), 1),
4213 ('pt', CvPoint, 1),
4214 ('start_stage', c_int, 1, 0),
4215 )
4216
4217
4218
4219
4220
4221
4222 cvProjectPoints2 = cfunc('cvProjectPoints2', _cvDLL, None,
4223 ('object_points', POINTER(CvMat), 1),
4224 ('rotation_vector', POINTER(CvMat), 1),
4225 ('translation_vector', POINTER(CvMat), 1),
4226 ('intrinsic_matrix', POINTER(CvMat), 1),
4227 ('distortion_coeffs', POINTER(CvMat), 1),
4228 ('image_points', POINTER(CvMat), 1),
4229 ('dpdrot', POINTER(CvMat), 1, None),
4230 ('dpdt', POINTER(CvMat), 1, None),
4231 ('dpdf', POINTER(CvMat), 1, None),
4232 ('dpdc', POINTER(CvMat), 1, None),
4233 ('dpddist', POINTER(CvMat), 1, None),
4234 )
4235
4236
4237 cvFindHomography = cfunc('cvFindHomography', _cvDLL, None,
4238 ('src_points', POINTER(CvMat), 1),
4239 ('dst_points', POINTER(CvMat), 1),
4240 ('homography', POINTER(CvMat), 1),
4241 )
4242
4243
4244 cvCalibrateCamera2 = cfunc('cvCalibrateCamera2', _cvDLL, None,
4245 ('object_points', POINTER(CvMat), 1),
4246 ('image_points', POINTER(CvMat), 1),
4247 ('point_counts', POINTER(CvMat), 1),
4248 ('image_size', CvSize, 1),
4249 ('intrinsic_matrix', POINTER(CvMat), 1),
4250 ('distortion_coeffs', POINTER(CvMat), 1),
4251 ('rotation_vectors', POINTER(CvMat), 1, None),
4252 ('translation_vectors', POINTER(CvMat), 1, None),
4253 ('flags', c_int, 1, 0),
4254 )
4255
4256
4257 cvFindExtrinsicCameraParams2 = cfunc('cvFindExtrinsicCameraParams2', _cvDLL, None,
4258 ('object_points', POINTER(CvMat), 1),
4259 ('image_points', POINTER(CvMat), 1),
4260 ('intrinsic_matrix', POINTER(CvMat), 1),
4261 ('distortion_coeffs', POINTER(CvMat), 1),
4262 ('rotation_vector', POINTER(CvMat), 1),
4263 ('translation_vector', POINTER(CvMat), 1),
4264 )
4265
4266
4267 cvRodrigues2 = cfunc('cvRodrigues2', _cvDLL, c_int,
4268 ('src', POINTER(CvMat), 1),
4269 ('dst', POINTER(CvMat), 1),
4270 ('jacobian', POINTER(CvMat), 1, 0),
4271 )
4272
4273
4274 cvUndistort2 = cfunc('cvUndistort2', _cvDLL, None,
4275 ('src', c_void_p, 1),
4276 ('dst', c_void_p, 1),
4277 ('intrinsic_matrix', POINTER(CvMat), 1),
4278 ('distortion_coeffs', POINTER(CvMat), 1),
4279 )
4280
4281
4282 cvInitUndistortMap = cfunc('cvInitUndistortMap', _cvDLL, None,
4283 ('intrinsic_matrix', POINTER(CvMat), 1),
4284 ('distortion_coeffs', POINTER(CvMat), 1),
4285 ('mapx', c_void_p, 1),
4286 ('mapy', c_void_p, 1),
4287 )
4288
4289
4290 cvFindChessboardCorners = cfunc('cvFindChessboardCorners', _cvDLL, c_int,
4291 ('image', c_void_p, 1),
4292 ('pattern_size', CvSize, 1),
4293 ('corners', POINTER(CvPoint2D32f), 1),
4294 ('corner_count', POINTER(c_int), 1, None),
4295 ('flags', c_int, 1),
4296 )
4297
4298
4299 cvDrawChessboardCorners = cfunc('cvDrawChessboardCorners', _cvDLL, None,
4300 ('image', c_void_p, 1),
4301 ('pattern_size', CvSize, 1),
4302 ('corners', POINTER(CvPoint2D32f), 1),
4303 ('count', c_int, 1),
4304 ('pattern_was_found', c_int, 1),
4305 )
4306
4307
4308
4309
4310 cvCreatePOSITObject = cfunc('cvCreatePOSITObject', _cvDLL, POINTER(CvPOSITObject),
4311 ('points', POINTER(CvPoint3D32f), 1),
4312 ('point_count', c_int, 1),
4313 )
4314
4315
4316 cvPOSIT = cfunc('cvPOSIT', _cvDLL, None,
4317 ('posit_object', POINTER(CvPOSITObject), 1),
4318 ('image_points', POINTER(CvPoint2D32f), 1),
4319 ('focal_length', c_double, 1),
4320 ('criteria', CvTermCriteria, 1),
4321 ('rotation_matrix', CvMatr32f, 1),
4322 ('translation_vector', CvVect32f, 1),
4323 )
4324
4325
4326 cvReleasePOSITObject = cfunc('cvReleasePOSITObject',