extern "C" int cvGetThreadNum( void );
-
-
-typedef IplImage* ( * CvLoadImageFunc)( const char* filename, int colorness );
-typedef CvMat* ( * CvLoadImageMFunc)( const char* filename, int colorness );
-typedef int ( * CvSaveImageFunc)( const char* filename, const CvArr* image,
- const int* params );
-typedef void ( * CvShowImageFunc)( const char* windowname, const CvArr* image );
-
-extern "C" int cvSetImageIOFunctions( CvLoadImageFunc _load_image, CvLoadImageMFunc _load_image_m,
- CvSaveImageFunc _save_image, CvShowImageFunc _show_image );
-
-
-
-
-
}
-class CvImage
-{
-public:
- CvImage() : image(0), refcount(0) {}
- CvImage( CvSize size, int depth, int channels )
- {
- image = cvCreateImage( size, depth, channels );
- refcount = image ? new int(1) : 0;
- }
-
- CvImage( IplImage* img ) : image(img)
- {
- refcount = image ? new int(1) : 0;
- }
-
- CvImage( const CvImage& img ) : image(img.image), refcount(img.refcount)
- {
- if( refcount ) ++(*refcount);
- }
-
- CvImage( const char* filename, const char* imgname=0, int color=-1 ) : image(0), refcount(0)
- { load( filename, imgname, color ); }
-
- CvImage( CvFileStorage* fs, const char* mapname, const char* imgname ) : image(0), refcount(0)
- { read( fs, mapname, imgname ); }
-
- CvImage( CvFileStorage* fs, const char* seqname, int idx ) : image(0), refcount(0)
- { read( fs, seqname, idx ); }
-
- ~CvImage()
- {
- if( refcount && !(--*refcount) )
- {
- cvReleaseImage( &image );
- delete refcount;
- }
- }
-
- CvImage clone() { return CvImage(image ? cvCloneImage(image) : 0); }
-
- void create( CvSize size, int depth, int channels )
- {
- if( !image || !refcount ||
- image->width != size.width || image->height != size.height ||
- image->depth != depth || image->nChannels != channels )
- attach( cvCreateImage( size, depth, channels ));
- }
-
- void release() { detach(); }
- void clear() { detach(); }
-
- void attach( IplImage* img, bool use_refcount=true )
- {
- if( refcount && --*refcount == 0 )
- {
- cvReleaseImage( &image );
- delete refcount;
- }
- image = img;
- refcount = use_refcount && image ? new int(1) : 0;
- }
-
- void detach()
- {
- if( refcount && --*refcount == 0 )
- {
- cvReleaseImage( &image );
- delete refcount;
- }
- image = 0;
- refcount = 0;
- }
-
- bool load( const char* filename, const char* imgname=0, int color=-1 );
- bool read( CvFileStorage* fs, const char* mapname, const char* imgname );
- bool read( CvFileStorage* fs, const char* seqname, int idx );
- void save( const char* filename, const char* imgname, const int* params=0 );
- void write( CvFileStorage* fs, const char* imgname );
-
- void show( const char* window_name );
- bool is_valid() { return image != 0; }
-
- int width() const { return image ? image->width : 0; }
- int height() const { return image ? image->height : 0; }
-
- CvSize size() const { return image ? cvSize(image->width, image->height) : cvSize(0,0); }
-
- CvSize roi_size() const
- {
- return !image ? cvSize(0,0) :
- !image->roi ? cvSize(image->width,image->height) :
- cvSize(image->roi->width, image->roi->height);
- }
-
- CvRect roi() const
- {
- return !image ? cvRect(0,0,0,0) :
- !image->roi ? cvRect(0,0,image->width,image->height) :
- cvRect(image->roi->xOffset,image->roi->yOffset,
- image->roi->width,image->roi->height);
- }
-
- int coi() const { return !image || !image->roi ? 0 : image->roi->coi; }
-
- void set_roi(CvRect roi) { cvSetImageROI(image,roi); }
- void reset_roi() { cvResetImageROI(image); }
- void set_coi(int coi) { cvSetImageCOI(image,coi); }
- int depth() const { return image ? image->depth : 0; }
- int channels() const { return image ? image->nChannels : 0; }
- int pix_size() const { return image ? ((image->depth & 255)>>3)*image->nChannels : 0; }
-
- uchar* data() { return image ? (uchar*)image->imageData : 0; }
- const uchar* data() const { return image ? (const uchar*)image->imageData : 0; }
- int step() const { return image ? image->widthStep : 0; }
- int origin() const { return image ? image->origin : 0; }
-
- uchar* roi_row(int y)
- {
- assert(0<=y);
- assert(!image ?
- 1 : image->roi ?
- y<image->roi->height : y<image->height);
-
- return !image ? 0 :
- !image->roi ?
- (uchar*)(image->imageData + y*image->widthStep) :
- (uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
- image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
- }
-
- const uchar* roi_row(int y) const
- {
- assert(0<=y);
- assert(!image ?
- 1 : image->roi ?
- y<image->roi->height : y<image->height);
-
- return !image ? 0 :
- !image->roi ?
- (const uchar*)(image->imageData + y*image->widthStep) :
- (const uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
- image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
- }
-
- operator const IplImage* () const { return image; }
- operator IplImage* () { return image; }
-
- CvImage& operator = (const CvImage& img)
- {
- if( img.refcount )
- ++*img.refcount;
- if( refcount && !(--*refcount) )
- cvReleaseImage( &image );
- image=img.image;
- refcount=img.refcount;
- return *this;
- }
-
-protected:
- IplImage* image;
- int* refcount;
-};
-
-
-class CvMatrix
-{
-public:
- CvMatrix() : matrix(0) {}
- CvMatrix( int rows, int cols, int type )
- { matrix = cvCreateMat( rows, cols, type ); }
-
- CvMatrix( int rows, int cols, int type, CvMat* hdr,
- void* data=0, int step=0x7fffffff )
- { matrix = cvInitMatHeader( hdr, rows, cols, type, data, step ); }
-
- CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data=true );
-
- CvMatrix( int rows, int cols, int type, void* data, int step=0x7fffffff )
- { matrix = cvCreateMatHeader( rows, cols, type );
- cvSetData( matrix, data, step ); }
-
- CvMatrix( CvMat* m )
- { matrix = m; }
-
- CvMatrix( const CvMatrix& m )
- {
- matrix = m.matrix;
- addref();
- }
-
- CvMatrix( const char* filename, const char* matname=0, int color=-1 ) : matrix(0)
- { load( filename, matname, color ); }
-
- CvMatrix( CvFileStorage* fs, const char* mapname, const char* matname ) : matrix(0)
- { read( fs, mapname, matname ); }
-
- CvMatrix( CvFileStorage* fs, const char* seqname, int idx ) : matrix(0)
- { read( fs, seqname, idx ); }
-
- ~CvMatrix()
- {
- release();
- }
-
- CvMatrix clone() { return CvMatrix(matrix ? cvCloneMat(matrix) : 0); }
-
- void set( CvMat* m, bool add_ref )
- {
- release();
- matrix = m;
- if( add_ref )
- addref();
- }
-
- void create( int rows, int cols, int type )
- {
- if( !matrix || !matrix->refcount ||
- matrix->rows != rows || matrix->cols != cols ||
- ((matrix->type) & ((1 << 3)*64 - 1)) != type )
- set( cvCreateMat( rows, cols, type ), false );
- }
-
- void addref() const
- {
- if( matrix )
- {
- if( matrix->hdr_refcount )
- ++matrix->hdr_refcount;
- else if( matrix->refcount )
- ++*matrix->refcount;
- }
- }
-
- void release()
- {
- if( matrix )
- {
- if( matrix->hdr_refcount )
- {
- if( --matrix->hdr_refcount == 0 )
- cvReleaseMat( &matrix );
- }
- else if( matrix->refcount )
- {
- if( --*matrix->refcount == 0 )
- (cvFree_(*(&matrix->refcount)), *(&matrix->refcount)=0);
- }
- matrix = 0;
- }
- }
-
- void clear()
- {
- release();
- }
-
- bool load( const char* filename, const char* matname=0, int color=-1 );
- bool read( CvFileStorage* fs, const char* mapname, const char* matname );
- bool read( CvFileStorage* fs, const char* seqname, int idx );
- void save( const char* filename, const char* matname, const int* params=0 );
- void write( CvFileStorage* fs, const char* matname );
-
- void show( const char* window_name );
-
- bool is_valid() { return matrix != 0; }
-
- int rows() const { return matrix ? matrix->rows : 0; }
- int cols() const { return matrix ? matrix->cols : 0; }
-
- CvSize size() const
- {
- return !matrix ? cvSize(0,0) : cvSize(matrix->rows,matrix->cols);
- }
-
- int type() const { return matrix ? ((matrix->type) & ((1 << 3)*64 - 1)) : 0; }
- int depth() const { return matrix ? ((matrix->type) & ((1 << 3) - 1)) : 0; }
- int channels() const { return matrix ? ((((matrix->type) & ((64 - 1) << 3)) >> 3) + 1) : 0; }
- int pix_size() const { return matrix ? (((((matrix->type) & ((64 - 1) << 3)) >> 3) + 1) << ((((sizeof(size_t)/4+1)*16384|0x3a50) >> ((matrix->type) & ((1 << 3) - 1))*2) & 3)) : 0; }
-
- uchar* data() { return matrix ? matrix->data.ptr : 0; }
- const uchar* data() const { return matrix ? matrix->data.ptr : 0; }
- int step() const { return matrix ? matrix->step : 0; }
-
- void set_data( void* data, int step=0x7fffffff )
- { cvSetData( matrix, data, step ); }
-
- uchar* row(int i) { return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
- const uchar* row(int i) const
- { return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
-
- operator const CvMat* () const { return matrix; }
- operator CvMat* () { return matrix; }
-
- CvMatrix& operator = (const CvMatrix& _m)
- {
- _m.addref();
- release();
- matrix = _m.matrix;
- return *this;
- }
-
-protected:
- CvMat* matrix;
-};
-
-
-
struct CvModule
{
CvModule( CvModuleInfo* _info );
}
-typedef struct CvConDensation
-{
- int MP;
- int DP;
- float* DynamMatr;
- float* State;
- int SamplesNum;
- float** flSamples;
- float** flNewSamples;
- float* flConfidence;
- float* flCumulative;
- float* Temp;
- float* RandomSample;
- struct CvRandState* RandS;
-}
-CvConDensation;
-
-
-
-
-
-
-
typedef struct CvKalman
{
int MP;
extern "C" int cvMeanShift( const CvArr* prob_image, CvRect window,
CvTermCriteria criteria, CvConnectedComp* comp );
-
-extern "C" CvConDensation* cvCreateConDensation( int dynam_params,
- int measure_params,
- int sample_count );
-
-
-extern "C" void cvReleaseConDensation( CvConDensation** condens );
-
-
-extern "C" void cvConDensUpdateByTime( CvConDensation* condens);
-
-
-extern "C" void cvConDensInitSampleSet( CvConDensation* condens, CvMat* lower_bound, CvMat* upper_bound );
-
-
extern "C" CvKalman* cvCreateKalman( int dynam_params, int measure_params,
int control_params = 0);
-
-extern "C" CvSeq* cvFindDominantPoints( CvSeq* contour, CvMemStorage* storage,
- int method = 1,
- double parameter1 = 0,
- double parameter2 = 0,
- double parameter3 = 0,
- double parameter4 = 0);
-
-
extern "C" double cvArcLength( const void* curve,
CvSlice slice = cvSlice(0, 0x3fffffff),
int is_closed = -1);
-
-
extern "C" CvRect cvBoundingRect( CvArr* points, int update = 0 );
int method, double threshold );
-extern "C" void cvCalcPGH( const CvSeq* contour, CvHistogram* hist );
-
-
-
-
-
extern "C" CvSeq* cvConvexHull2( const CvArr* input,
void* hull_storage = NULL,
int orientation = 1,
CvTermCriteria criteria, int calc_gradient = 1);
-extern "C" void cvCalcImageHomography( float* line, CvPoint3D32f* center,
- float* intrinsic, float* homography );
-
-
-
-
-
-
extern "C" void cvDistTransform( const CvArr* src, CvArr* dst,
int distance_type = 2,
int mask_size = 3,