📄 cv.h
字号:
// Maximal relative error is ~3e-7
//F*/
OPENCVAPI void cvbFastLog( const double* x, float* log_x, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvRandInit
// Purpose:
// Initializes random number generator(RNG)
// Context:
// Parameters:
// state - pointer to initialized RNG state
// lower - lower bound of random values
// upper - upper bound of random values.
// Generated random numbers belong to range [lower,upper)
// seed - initializing 32-bit integer for RNG
// Returns:
//F*/
OPENCVAPI void cvRandInit( CvRandState* state, double lower, double upper, int seed );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvRandSetRange
// Purpose: sets range of generated random numbers without reinitializing RNG
// Context:
// Parameters:
// state - pointer to state structure
// lower - lower bound
// upper - upper bound
// Returns:
// CV_OK or error code if:
// state pointer is zero or
// lower bound greater than upper bound.
// Notes:
//F*/
OPENCVAPI void cvRandSetRange( CvRandState* state, double lower, double upper );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvbRand
// Purpose:
// Fills array of floats with random numbers and updates RNG state
// Context:
// Parameters:
// state - RNG state
// dst - destination floating-point array
// len - number of elements in the array.
// Returns:
//F*/
OPENCVAPI void cvbRand( CvRandState* state, float* dst, int len );
/*F///////////////////////////////////////////////////////////////////////////////////////
//
// Name: cvRandNext
// Purpose:
// Updates RNG state and returns 32-bit random number
// Context:
// Parameters:
// state - RNG state
// Returns:
// random number
//F*/
OPENCVAPI unsigned cvRandNext( CvRandState* state );
/****************************************************************************************\
* Motion templates *
\****************************************************************************************/
/****************************************************************************************\
* All the motion template functions work only with single channel images. *
* Silhouette image must have depth IPL_DEPTH_8U or IPL_DEPTH_8S *
* Motion history image must have depth IPL_DEPTH_32F, *
* Gradient mask - IPL_DEPTH_8U or IPL_DEPTH_8S, *
* Motion orientation image - IPL_DEPTH_32F *
* Segmentation mask - IPL_DEPTH_32F *
* All the angles are in degrees, all the times are in milliseconds *
\****************************************************************************************/
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvUpdateMotionHistory
// Purpose: updates motion history image.
// Context:
// Parameters:
// silhouette - silhouette image
// mhi - motion history image
// timestamp - current system time
// mhiDuration - maximal duration of motion track before it will be removed
// Returns:
// Notes:
// Motion history image is changed by the following algorithm:
// for every point(x,y) in the mhi do
// if( silhouette(x,y) != 0 )
// {
// mhi(x,y) = timestamp;
// }
// else if( mhi(x,y) < timestamp - mhi_duration )
// {
// mhi(x,y) = 0;
// }
// // else mhi(x,y) remains unchanged
//F*/
OPENCVAPI void cvUpdateMotionHistory( IplImage* silhouette, IplImage* mhi,
double timestamp, double mhiDuration );
#define cvUpdateMHIByTime cvUpdateMotionHistory
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCalcMotionGradient
// Purpose: calculates motion gradient and mask where it is valid
// Context:
// Parameters:
// mhi - motion history image
// mask -(output image) indicates where <orientation> data is valid
// orientation -(output image) contains gradient orientation in degrees
// aperture_size - size of the filters for x & y derivatives
//
// maxTDelta - gradient bounds.
// minTDelta _/
// Returns:
// Notes:
// Function handles both top-left and bottom-left origins of orientation image
//F*/
OPENCVAPI void cvCalcMotionGradient( IplImage* mhi, IplImage* mask,
IplImage* orientation, int aperture_size,
double maxTDelta, double minTDelta );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCalcGlobalOrientation
// Purpose: calculates general motion direction in the selected region.
// Context:
// Parameters:
// orient - orientation image
// mask - region mask
// mhi - motion history image
// timestamp - the last timestamp when mhi was updated
// mhi_duration - maximal motion track duration.
// Returns:
// direction of selected region in degrees
//F*/
OPENCVAPI double cvCalcGlobalOrientation( IplImage* orientation, IplImage* mask,
IplImage* mhi, double curr_mhi_timestamp,
double mhi_duration );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvSegmentMotion
// Purpose: splits motion history image into several regions that
// move in different directions.
// Context:
// Parameters:
// mhi - motion history image
// seg_mask - segmentation mask image. It is marked with different values
// (1,2,3...) for every motion component
// storage - where to store motion components
// components - sequence of connected component of motion.
// timestamp - the last timestamp when mhi was updated
// seg_thresh - threshold, which is used to split motion components(regions)
// the bigger threshold, the coarse segmentation is.
// Returns:
// Notes:
//F*/
OPENCVAPI void cvSegmentMotion( IplImage* mhi, IplImage* seg_mask,
CvMemStorage* storage, CvSeq** components,
double timestamp, double seg_thresh );
/****************************************************************************************\
* Background Differencing *
\****************************************************************************************/
OPENCVAPI void cvAcc( IplImage* image, IplImage* sum, IplImage* mask CV_DEFAULT(0) );
OPENCVAPI void cvSquareAcc( IplImage* image, IplImage* sqSum,
IplImage* mask CV_DEFAULT(0) );
OPENCVAPI void cvMultiplyAcc( IplImage* imgA, IplImage* imgB, IplImage* acc,
IplImage* mask CV_DEFAULT(0) );
OPENCVAPI void cvRunningAvg( IplImage* imgY, IplImage* imgU,
double alpha, IplImage* mask CV_DEFAULT(0) );
#define cvAccMask cvAcc
#define cvSquareAccMask cvSquareAcc
#define cvMultiplyAccMask cvMultiplyAcc
#define cvRunningAvgMask(imgY, imgU, mask, alpha) cvRunningAvg(imgY, imgU, alpha, mask)
/****************************************************************************************\
* Dynamic data structures *
\****************************************************************************************/
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCreateMemStorage
// Purpose: creates memory storage
// Context:
// Parameters:
// block_size - size of memory storage blocks.
// If 0, default size( Currently 64K) is set
// Returns:
// memory storage
//F*/
OPENCVAPI CvMemStorage* cvCreateMemStorage( int block_size CV_DEFAULT(0));
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCreateChildMemStorage
// Purpose: creates child memory storage
// (storage that borrows memory blocks from parent)
// Context:
// Parameters:
// parent - parent memory storage
// Returns:
// memory storage
//F*/
OPENCVAPI CvMemStorage* cvCreateChildMemStorage( CvMemStorage* parent );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvReleaseMemStorage
// Purpose: releases memory storage.
// Context:
// Parameters:
// storage - double pointer to memory storage
// Returns:
// Notes:
// if memory storage is simple, all its blocks are released,
// else(memory storage is child) all its blocks are returned to parent
//F*/
OPENCVAPI void cvReleaseMemStorage( CvMemStorage** storage );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvClearMemStorage
// Purpose: clears memory storage.
// Context:
// Parameters:
// storage - memory storage
// Returns:
// Notes:
// if memory storage is is child, all its blocks are returned to parent,
// else the top of the storage is reset
//F*/
OPENCVAPI void cvClearMemStorage( CvMemStorage* storage );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvSaveMemStoragePos
// Purpose: saves current top of the storage.
// Context:
// Parameters:
// storage - memory storage
// pos - position structure
// Returns:
// Notes:
//F*/
OPENCVAPI void cvSaveMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvRestoreMemStoragePos
// Purpose: restores top of the storage.
// Context:
// Parameters:
// storage - memory storage
// pos - position structure that was filled with cvSaveMemStoragePos
// Returns:
// Notes:
//F*/
OPENCVAPI void cvRestoreMemStoragePos( CvMemStorage* storage, CvMemStoragePos* pos );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCreateSeq
// Purpose: creates sequence, located on the storage
// Context:
// Parameters:
// seq_flags - flags of created sequence
// header_size - size of sequence header. Must be non-less than sizeof(CvSeq)
// elem_size - size of sequence elements
// storage - memory storage
// Returns:
// created sequence
// Notes:
//F*/
OPENCVAPI CvSeq* cvCreateSeq( int seq_flags, int header_size,
int elem_size, CvMemStorage* storage );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvSetSeqBlockSize
// Purpose: adjusts granularity of memory allocation for sequence
// Context:
// Parameters:
// seq - sequence pointer
// delta_elements - how many elements to allocate when there is no free space
// in the sequence.
// Returns:
// Notes:
// If this function is not called after sequence is created,
// delta_elements is set to ~1K/elem_size
//F*/
OPENCVAPI void cvSetSeqBlockSize( CvSeq* seq, int delta_elements );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvSeqPush
// Purpose: adds element in the end of sequence
// Context:
// Parameters:
// seq - sequence pointer
// element - added element
// Returns:
//F*/
OPENCVAPI void cvSeqPush( CvSeq* seq, void* element );
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvSeqPushFront
// Purpose: adds element in the beginning of sequence
// Context:
// Parameters:
// seq - sequence pointer
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -