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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
/* Common Macro */
CV_PI 3.1415926535897931
//return value in double
CV_LOG2 0.69314718055994529
//return value in double
CV_SWAP(a,b,type);
//input: a,b are variable; type is the type of a and b (int,uchar,float,double,...)
//output: the tmp variable (the old a)
//desc: a->b and b->a
CV_IMIN(a,b);
//input: a,b are integer
//output: the minimum value
CV_IMAX(a,b);
//input: a,b are integer
//output: the maximum value
CV_IABS(a);
//input: a is an integer
//output: the absolute value of a
CV_CMP(a,b);
//input: a,b are integers
//output: a < b => -1, a > b => 1; a == b => 0
CV_SIGN(a);
//input: a is a (signed) integer
//output: return the sign of a
CV_RGB(r,g,b);
//input: r,g,b integer value
//output: return CvScalar(b, g, r, 0)
/* Matrix Manipulation */
CV_ARE_CNS_EQ(CvMat mat1, CvMat mat2);
//input: CvMat mat1 and mat2
//output: ???
CV_ARE_SIZES_EQ(CvMat mat1, CvMat mat2);
//input: CvMat mat1 and mat2
//output: return true if sizes (width and height) are equal
CV_ARE_TYPES_EQ(CvMat mat1, CvMat mat2);
//input: CvMat mat1 and mat2
//output: return true if type code is equal
CV_ARE_DEPTHS_EQ(CvMat mat1, CvMat mat2);
//input: CvMat mat1 and mat2
//output: return true if depth are equal (number of byte)
CV_MAT_ELEM( mat, elemtype, row, col );
//input: the matrix, the type of element (int, float, double,...), the position row and col.
//return: the pixel value.
CV_MAT_ELEM_PTR( mat, row, col );
//input: the matrix, the position row and col.
//return: CV_MAT_ELEM_PTR_FAST( mat, row, col, CV_ELEM_SIZE((mat).type) )
CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size );
//input: the matrix, the position row and col, the size in byte of a pixel
//return: a pointer on a pixel
CV_IS_MAT(mat);
//input: the matrix
//output: true if the matrix has been correctly initialized
/* Image manipulation */
CV_IMAGE_ELEM(image,elemtype,row,col);
//input: the IPL image, the type of element (int, float, double,...), the position row and col.
//return: the pixel value (if it is in BGRA you should use int as element).
CV_IS_IMAGE(image);
//input: the IPL image
//output: true if the image has been correctly initialized
CV_INIT_PIXEL_POS( pos, origin, step, roi, x, y,orientation )
//Pos - initialized structure
//Origin - pointer to the left-top corner of the ROI
//Step - width of the whole image in bytes
//Roi - width & height of the ROI
//x, y - initial position
//orientation - image orientation, may be one of:
//CV_ORIGIN_TL top/left orientation
//CV_ORIGIN_BL bottom/left orientation
/* Misc */
CV_INIT_3X3_DELTAS(deltas, step, nch );
//input: deltas is a a 3*3 array, step is the step position, nch is the position
//desc :initializes 8-element array for fast access to 3x3 neighborhood of a pixel
//return:
// ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
// (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
// (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \
// (deltas)[6] = (step), (deltas)[7] = (step) + (nch))
CV_MOVE_LEFT CV_MOVE_RIGHT
CV_MOVE_UP CV_MOVE_DOWN
CV_MOVE_LU CV_MOVE_RU
CV_MOVE_LD CV_MOVE_RD
//Move by one pixel relatively to current position
CV_MOVE_LEFT_WRAP
CV_MOVE_RIGHT_WRAP
CV_MOVE_UP_WRAP
CV_MOVE_DOWN_WRAP
CV_MOVE_LU_WRAP
CV_MOVE_RU_WRAP
CV_MOVE_LD_WRAP
CV_MOVE_RD_WRAP
//Move by one pixel relatively to current position with wrapping when the position achieves image boundary
CV_MOVE_PARAM //Move by one pixel in specified direction
CV_MOVE_PARAM_WRAP //Move by one pixel in specified direction with wrapping when the |
Partager