📄 cvcompat.h
字号:
my.data.fl = (float*)y;
ma.data.fl = (float*)angle;
cvCartToPolar( &mx, &my, NULL, &ma, 1 );
}
CV_INLINE void cvbSqrt( const float* x, float* y, int len );
CV_INLINE void cvbSqrt( const float* x, float* y, int len )
{
CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
CvMat my = mx;
my.data.fl = (float*)y;
cvPow( &mx, &my, 0.5 );
}
CV_INLINE void cvbInvSqrt( const float* x, float* y, int len );
CV_INLINE void cvbInvSqrt( const float* x, float* y, int len )
{
CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
CvMat my = mx;
my.data.fl = (float*)y;
cvPow( &mx, &my, -0.5 );
}
CV_INLINE void cvbReciprocal( const float* x, float* y, int len );
CV_INLINE void cvbReciprocal( const float* x, float* y, int len )
{
CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
CvMat my = mx;
my.data.fl = (float*)y;
cvPow( &mx, &my, -1 );
}
CV_INLINE void cvbFastExp( const float* x, double* y, int len );
CV_INLINE void cvbFastExp( const float* x, double* y, int len )
{
CvMat mx = cvMat( 1, len, CV_32F, (void*)x );
CvMat my = cvMat( 1, len, CV_64F, y );
cvExp( &mx, &my );
}
CV_INLINE void cvbFastLog( const double* x, float* y, int len );
CV_INLINE void cvbFastLog( const double* x, float* y, int len )
{
CvMat mx = cvMat( 1, len, CV_64F, (void*)x );
CvMat my = cvMat( 1, len, CV_32F, y );
cvLog( &mx, &my );
}
CV_INLINE CvRect cvContourBoundingRect( void* point_set, int update CV_DEFAULT(0));
CV_INLINE CvRect cvContourBoundingRect( void* point_set, int update )
{
return cvBoundingRect( point_set, update );
}
CV_INLINE double cvPseudoInverse( const CvArr* src, CvArr* dst,
int flags CV_DEFAULT(0));
CV_INLINE double cvPseudoInverse( const CvArr* src, CvArr* dst, int CV_UNREFERENCED(flags) )
{
return cvInvert( src, dst, CV_SVD );
}
#define cvPseudoInv cvPseudoInverse
#define cvContourMoments( contour, moments ) \
cvMoments( contour, moments, 0 )
#define cvGetPtrAt cvPtr2D
#define cvGetAt cvGet2D
#define cvSetAt(arr,val,y,x) cvSet2D((arr),(y),(x),(val))
#define cvMeanMask cvMean
#define cvMean_StdDevMask(img,mask,mean,sdv) cvMean_StdDev(img,mean,sdv,mask)
#define cvNormMask(imgA,imgB,mask,normType) cvNorm(imgA,imgB,normType,mask)
#define cvMinMaxLocMask(img, mask, min_val, max_val, min_loc, max_loc) \
cvMinMaxLoc(img, min_val, max_val, min_loc, max_loc, mask)
#define cvRemoveMemoryManager cvSetMemoryManager
#define cvmSetZero( mat ) cvSetZero( mat )
#define cvmSetIdentity( mat ) cvSetIdentity( mat )
#define cvmAdd( src1, src2, dst ) cvAdd( src1, src2, dst, 0 )
#define cvmSub( src1, src2, dst ) cvSub( src1, src2, dst, 0 )
#define cvmCopy( src, dst ) cvCopy( src, dst, 0 )
#define cvmMul( src1, src2, dst ) cvMatMulAdd( src1, src2, 0, dst )
#define cvmTranspose( src, dst ) cvT( src, dst )
#define cvmInvert( src, dst ) cvInv( src, dst )
#define cvmMahalanobis(vec1, vec2, mat) cvMahalanobis( vec1, vec2, mat )
#define cvmDotProduct( vec1, vec2 ) cvDotProduct( vec1, vec2 )
#define cvmCrossProduct(vec1, vec2,dst) cvCrossProduct( vec1, vec2, dst )
#define cvmTrace( mat ) (cvTrace( mat )).val[0]
#define cvmMulTransposed( src, dst, order ) cvMulTransposed( src, dst, order )
#define cvmEigenVV( mat, evec, eval, eps) cvEigenVV( mat, evec, eval, eps )
#define cvmDet( mat ) cvDet( mat )
#define cvmScale( src, dst, scale ) cvScale( src, dst, scale )
#define cvCopyImage( src, dst ) cvCopy( src, dst, 0 )
#define cvReleaseMatHeader cvReleaseMat
/* Calculates exact convex hull of 2d point set */
CV_INLINE void cvConvexHull( CvPoint* points, int num_points, CvRect* bound_rect,
int orientation, int* hull, int* hullsize );
CV_INLINE void cvConvexHull( CvPoint* points, int num_points, CvRect* CV_UNREFERENCED(bound_rect),
int orientation, int* hull, int* hullsize )
{
CvMat points1 = cvMat( 1, num_points, CV_32SC2, points );
CvMat hull1 = cvMat( 1, num_points, CV_32SC1, hull );
cvConvexHull2( &points1, &hull1, orientation, 0 );
*hullsize = hull1.cols;
}
/* Calculates exact convex hull of 2d point set stored in a sequence */
#define cvContourConvexHull( contour, orientation, storage ) \
cvConvexHull2( contour, storage, orientation )
/* Calculates approximate convex hull of 2d point set */
#define cvConvexHullApprox( points, num_points, bound_rect, bandwidth, \
orientation, hull, hullsize ) \
cvConvexHull( points, num_points, bound_rect, orientation, hull, hullsize )
/* Calculates approximate convex hull of 2d point set stored in a sequence */
#define cvContourConvexHullApprox( contour, bandwidth, orientation, storage ) \
cvConvexHull2( contour, storage, orientation )
CV_INLINE void cvMinAreaRect( CvPoint* points, int n,
int left, int bottom, int right, int top,
CvPoint2D32f* anchor,
CvPoint2D32f* vect1,
CvPoint2D32f* vect2 );
CV_INLINE void cvMinAreaRect( CvPoint* points, int n,
int CV_UNREFERENCED(left), int CV_UNREFERENCED(bottom),
int CV_UNREFERENCED(right), int CV_UNREFERENCED(top),
CvPoint2D32f* anchor,
CvPoint2D32f* vect1,
CvPoint2D32f* vect2 )
{
CvMat mat = cvMat( 1, n, CV_32SC2, points );
CvBox2D box = cvMinAreaRect2( &mat, 0 );
CvPoint2D32f pt[4];
cvBoxPoints( box, pt );
*anchor = pt[0];
vect1->x = pt[1].x - pt[0].x;
vect1->y = pt[1].y - pt[0].y;
vect2->x = pt[3].x - pt[0].x;
vect2->y = pt[3].y - pt[0].y;
CV_UNREFERENCED( (left, bottom, right, top) );
}
typedef int CvDisType;
typedef int CvChainApproxMethod;
typedef int CvContourRetrievalMode;
CV_INLINE void cvFitLine3D( CvPoint3D32f* points, int count, int dist,
void *param, float reps, float aeps, float* line );
CV_INLINE void cvFitLine3D( CvPoint3D32f* points, int count, int dist,
void *param, float reps, float aeps, float* line )
{
CvMat mat = cvMat( 1, count, CV_32FC3, points );
float _param = param != NULL ? *(float*)param : 0.f;
assert( dist != CV_DIST_USER );
cvFitLine( &mat, dist, _param, reps, aeps, line );
}
/* Fits a line into set of 2d points in a robust way (M-estimator technique) */
CV_INLINE void cvFitLine2D( CvPoint2D32f* points, int count, int dist,
void *param, float reps, float aeps, float* line );
CV_INLINE void cvFitLine2D( CvPoint2D32f* points, int count, int dist,
void *param, float reps, float aeps, float* line )
{
CvMat mat = cvMat( 1, count, CV_32FC2, points );
float _param = param != NULL ? *(float*)param : 0.f;
assert( dist != CV_DIST_USER );
cvFitLine( &mat, dist, _param, reps, aeps, line );
}
CV_INLINE void cvFitEllipse( const CvPoint2D32f* points, int count, CvBox2D* box );
CV_INLINE void cvFitEllipse( const CvPoint2D32f* points, int count, CvBox2D* box )
{
CvMat mat = cvMat( 1, count, CV_32FC2, (void*)points );
*box = cvFitEllipse2( &mat );
}
/* Projects 2d points to one of standard coordinate planes
(i.e. removes one of coordinates) */
CV_INLINE void cvProject3D( CvPoint3D32f* points3D, int count,
CvPoint2D32f* points2D,
int xIndx CV_DEFAULT(0),
int yIndx CV_DEFAULT(1));
CV_INLINE void cvProject3D( CvPoint3D32f* points3D, int count,
CvPoint2D32f* points2D, int xIndx, int yIndx )
{
CvMat src = cvMat( 1, count, CV_32FC3, points3D );
CvMat dst = cvMat( 1, count, CV_32FC2, points2D );
float m[6] = {0,0,0,0,0,0};
CvMat M = cvMat( 2, 3, CV_32F, m );
assert( (unsigned)xIndx < 3 && (unsigned)yIndx < 3 );
m[xIndx] = m[yIndx+3] = 1.f;
cvTransform( &src, &dst, &M, NULL );
}
/* Retrieves value of the particular bin
of x-dimensional (x=1,2,3,...) histogram */
#define cvQueryHistValue_1D( hist, idx0 ) \
((float)cvGetReal1D( (hist)->bins, (idx0)))
#define cvQueryHistValue_2D( hist, idx0, idx1 ) \
((float)cvGetReal2D( (hist)->bins, (idx0), (idx1)))
#define cvQueryHistValue_3D( hist, idx0, idx1, idx2 ) \
((float)cvGetReal3D( (hist)->bins, (idx0), (idx1), (idx2)))
#define cvQueryHistValue_nD( hist, idx ) \
((float)cvGetRealND( (hist)->bins, (idx)))
/* Returns pointer to the particular bin of x-dimesional histogram.
For sparse histogram the bin is created if it didn't exist before */
#define cvGetHistValue_1D( hist, idx0 ) \
((float*)cvPtr1D( (hist)->bins, (idx0), 0))
#define cvGetHistValue_2D( hist, idx0, idx1 ) \
((float*)cvPtr2D( (hist)->bins, (idx0), (idx1), 0))
#define cvGetHistValue_3D( hist, idx0, idx1, idx2 ) \
((float*)cvPtr3D( (hist)->bins, (idx0), (idx1), (idx2), 0))
#define cvGetHistValue_nD( hist, idx ) \
((float*)cvPtrND( (hist)->bins, (idx), 0))
#define CV_IS_SET_ELEM_EXISTS CV_IS_SET_ELEM
CV_INLINE int cvHoughLines( CvArr* image, double rho,
double theta, int threshold,
float* lines, int linesNumber );
CV_INLINE int cvHoughLines( CvArr* image, double rho,
double theta, int threshold,
float* lines, int linesNumber )
{
CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines );
cvHoughLines2( image, &linesMat, CV_HOUGH_STANDARD,
rho, theta, threshold, 0, 0 );
return linesMat.cols;
}
CV_INLINE int cvHoughLinesP( CvArr* image, double rho,
double theta, int threshold,
int lineLength, int lineGap,
int* lines, int linesNumber );
CV_INLINE int cvHoughLinesP( CvArr* image, double rho,
double theta, int threshold,
int lineLength, int lineGap,
int* lines, int linesNumber )
{
CvMat linesMat = cvMat( 1, linesNumber, CV_32SC4, lines );
cvHoughLines2( image, &linesMat, CV_HOUGH_PROBABILISTIC,
rho, theta, threshold, lineLength, lineGap );
return linesMat.cols;
}
CV_INLINE int cvHoughLinesSDiv( CvArr* image, double rho, int srn,
double theta, int stn, int threshold,
float* lines, int linesNumber );
CV_INLINE int cvHoughLinesSDiv( CvArr* image, double rho, int srn,
double theta, int stn, int threshold,
float* lines, int linesNumber )
{
CvMat linesMat = cvMat( 1, linesNumber, CV_32FC2, lines );
cvHoughLines2( image, &linesMat, CV_HOUGH_MULTI_SCALE,
rho, theta, threshold, srn, stn );
return linesMat.cols;
}
/* Find fundamental matrix */
CV_INLINE void cvFindFundamentalMatrix( int* points1, int* points2,
int numpoints, int method, float* matrix );
CV_INLINE void cvFindFundamentalMatrix( int* points1, int* points2,
int numpoints, int CV_UNREFERENCED(method), float* matrix )
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -