📄 cv.h
字号:
* Utilities *
\****************************************************************************************/
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvInitLineIterator
// Purpose:
// Initializes iterator that gets all the pixels, lying on the raster line between
// two given points
// Context:
// Parameters:
// img - image.
// pt1 - starting point
// pt2 - ending point. Both points must be inside the image
// lineIterator - pointer to initialized iterator state
// Returns:
// number of pixels between pt1 and pt2.
// It is equal to max( abs(pt1.x - pt2.x), abs(pt1.y - pt2.y))
//F*/
OPENCVAPI int cvInitLineIterator( IplImage* img, CvPoint pt1, CvPoint pt2,
CvLineIterator* lineIterator );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvSampleLine
// Purpose:
// Fetch all the pixel, lying on the raster line between two given points and
// writes them to the buffer
// Context:
// Parameters:
// img - image.
// pt1 - starting point
// pt2 - ending point. Both points must be inside the image
// buffer - pointer to destination buffer.
// Returns:
// number of pixels stored.
// It is equal to max( abs(pt1.x - pt2.x), abs(pt1.y - pt2.y))
//F*/
OPENCVAPI int cvSampleLine( IplImage* img, CvPoint pt1, CvPoint pt2, void* buffer );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvGetRectSubPix
// Purpose:
// Retrieves rectangle from the image with sub-pixel accuracy
// Context:
// Parameters:
// src - source image.
// dst - destination image. ROI must have odd width and height
// center - center point of the extracted rectangle.
// Size of extracted rectangle is equal to
// desination image ROI size.
// Returns:
//F*/
OPENCVAPI void cvGetRectSubPix( IplImage* src, IplImage* dst, CvPoint2D32f center );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvCvtPixToPlane
// Purpose:
// Splits source image into several separate planes
// Context:
// Parameters:
// src - source image. Must have 3 or 4 channels.
// dst0, dst1, dst2, dst3 - destination images. Must have single channel.
// if src has 3 channels, dst3 must be NULL.
// if one of the destination images is not NULL,
// the corresponding channel is extracted from source image.
// Else, all 3 or 4 images must be non NULL and all the source image
// channels are written to destination images.
// Returns:
//F*/
OPENCVAPI void cvCvtPixToPlane( IplImage *src, IplImage *dst0,
IplImage *dst1, IplImage *dst2,
IplImage *dst3 );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvCvtPixToPlane
// Purpose:
// Composes destination image from separate single-channel images
// Context:
// Parameters:
// src0, src1, src2, src3 - source images. Must have single channel.
// if destination image has 3 channels, src3 must be NULL, else must be
// non NULL. Other images must always be non NULL.
// dst - destination image. Must have 3 or 4 channels.
// Returns:
//F*/
OPENCVAPI void cvCvtPlaneToPix( IplImage *src0, IplImage *src1,
IplImage *src2, IplImage *src3,
IplImage *dst );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvConvertScale
// Purpose:
// Converts image from one depth to another with linear transform
// Context:
// Parameters:
// src - source image.
// dst - destination image.
// scale - multiplier
// shift - delta. That is, dst(x,y) = src(x,y)*scale + shift.
// Returns:
// Notes:
// only float->uchar and uchar->float are supported by now.
//F*/
OPENCVAPI void cvConvertScale( IplImage *src, IplImage *dst, double scale CV_DEFAULT(1),
double shift CV_DEFAULT(0) );
#define cvCvtScale cvConvertScale
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvAbsDiff
// Purpose:
// Finds per-pixel absolute difference between two images
// Context:
// Parameters:
// srcA - first source image.
// srcB - second source image
// dst - destination image, May be equal to srcA or srcB
// Returns:
//F*/
OPENCVAPI void cvAbsDiff( IplImage* srcA, IplImage* srcB, IplImage* dst );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvAbsDiffS
// Purpose:
// Finds per-pixel absolute difference between image and scalar value
// Context:
// Parameters:
// src - source image.
// dst - destination image, May be equal to srcA or srcB
// value - scalar value to compare with
// Returns:
//F*/
OPENCVAPI void cvAbsDiffS( IplImage* src, IplImage* dst, double value );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvMatchTemplate
// Purpose:
// measures similarity between template and overlapped windows in the source image
// and fills the resultant image with the measurements.
// Context:
// Parameters:
// img - source image
// templ - template to find
// result - resultant image. its ROI must have size:
// (img_width - templ_width + 1, img_height - templ_height + 1)
// method - comparison method:
//---------------------------------------------------------------------------------------
// CV_TM_SQDIFF: res0(i,j)=sum(y=0,TH-1) sum(x=0,TW-1)[I(i+x,j+y)-T(x,y)]^2
// (where TW - template width, TH - template height
// res0(i,j) - pixel value of result at location(i,j)
// (zero-th method)
// Iij(x,y) - pixel value of source image at location(i+x,j+y)
// Iij alone means window of source image
// with top-left corner(i,j) and template size.
// T(x,y) - pixel value of template at location(x,y)
// T alone means template.
//---------------------------------------------------------------------------------------
// CV_TM_SQDIFF_NORMED: res1(i,j) = res0(i,j)/
// (l2_norm(Iij)*l2_norm(templ);
// where l2_norm(A) = sqrt(
// sum(y=0,A_height-1) sum(x=0,A_width-1) A(x,y)^2);
//---------------------------------------------------------------------------------------
// CV_TM_CCORR: res2(i,j)=sum(y=0,TH-1) sum(x=0,TW-1)[Iij(x,y)*T(x,y)]
//---------------------------------------------------------------------------------------
// CV_TM_CCORR_NORMED: res3(i,j) = res2(i,j)/[l2_norm(Iij)*l2_norm(templ)];
//---------------------------------------------------------------------------------------
// CV_TM_CCOEFF: res4(i,j)=sum(y=0,TH-1) sum(x=0,TW-1) [I'ij(x,y)*T'(x,y)]
// where A'(x,y) = A(x,y)-1/(A_width*A_height)*
// sum(l=0,A_height-1) sum(k=0,A_width-1)A(k,l)
//---------------------------------------------------------------------------------------
// CV_TM_CCOEFF_NORMED:
// res5(i,j)=res4(i,j)/[l2_norm(I'ij)*l2_norm(T')]
//---------------------------------------------------------------------------------------
// Returns:
//F*/
OPENCVAPI void cvMatchTemplate( IplImage* img, IplImage* templ, IplImage* result,
CvTemplMatchMethod method );
OPENCVAPI void cvFillImage( IplImage* image, double val );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbFastArctan
// Purpose:
// Calculates arctangent for arrays of abscissas and ordinates
// Context:
// Parameters:
// y - array of abscissas
// x - array of ordinates
// angle - array of results: array[i] = arctan(y[i]/x[i])
// len - number of elements in arrays
// Returns:
// Notes:
// The function takes into account signs of both argument, so it is similar
// to atan2, but it returns angle in degrees(from 0 to 359.999 degrees)
// Maximal error is ~0.1 degreee.
//F*/
OPENCVAPI void cvbFastArctan( const float* y, const float* x, float* angle, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbCartToPolar
// Purpose:
// Converts input arrays of abscissas and ordinates to polar form
// Context:
// Parameters:
// y - array of abscissas
// x - array of ordinates
// magnitude - array of magnitudes: mag[i] = sqrt(y[i]*y[i] + x[i]*x[i])
// angle - array of angles: array[i] = arctan(y[i]/x[i])
// len - number of elements in arrays
// Returns:
// Notes:
// The function calculates angle(similar to cvbFastArctan) and magnitude for
// every 2D vector(x[i],y[i]). Both output arguments are optional. If some
// output parameter is absent, corresponding part is not calculated
//F*/
OPENCVAPI void cvbCartToPolar( const float* y, const float* x,
float* magnitude, float* angle, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbSqrt
// Purpose:
// Calculates square root for array of floats
// Context:
// Parameters:
// x - array of arguments
// sqrt_x - array of results
// len - number of elements in arrays
// Returns:
// Notes:
// Elements of input array must be non-negative, else the result is not defined.
// Maximal relative error is ~3e-7
//F*/
OPENCVAPI void cvbSqrt( const float* x, float* sqrt_x, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbInvSqrt
// Purpose:
// Calculates inverse square root for array of floats
// Context:
// Parameters:
// x - array of arguments
// sqrt_x - array of results
// len - number of elements in arrays
// Returns:
// Notes:
// Elements of input array must be positive, else the result is not defined.
// Maximal relative error is ~2e-7
//F*/
OPENCVAPI void cvbInvSqrt( const float* x, float* inv_sqrt_x, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbReciprocal
// Purpose:
// Calculates inverse value(1/x) for array of floats
// Context:
// Parameters:
// x - array of arguments
// inv_x - array of results
// len - number of elements in arrays
// Returns:
// Notes:
// For zero elements result is 0.
// Maximal relative error is <2e-7
//F*/
OPENCVAPI void cvbReciprocal( const float* x, float* inv_x, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbFastExp
// Purpose:
// Calculates fast exponent approximation for array of floats
// Context:
// Parameters:
// x - array of arguments
// exp_x - array of results
// len - number of elements in arrays
// Returns:
// Notes:
// Overflow is not handled yet. Underflow is handled.
// Maximal relative error is ~7e-6
//F*/
OPENCVAPI void cvbFastExp( const float* x, double* exp_x, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbFastLog
// Purpose:
// Calculates fast logarithm approximation for array of doubles
// Context:
// Parameters:
// x - array of arguments
// log_x - array of logarithms of absolute values of arguments
// len - number of elements in arrays
// Returns:
// Notes:
// Negative values are negated before logarithm is taken.
// Logarithm of 0 gives large negative number(~700)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -