42 #ifndef __OPENCV_LEGACY_HPP__
43 #define __OPENCV_LEGACY_HPP__
55 double canny_threshold,
56 double ffill_threshold,
71 #define CV_EIGOBJ_NO_CALLBACK 0
72 #define CV_EIGOBJ_INPUT_CALLBACK 1
73 #define CV_EIGOBJ_OUTPUT_CALLBACK 2
74 #define CV_EIGOBJ_BOTH_CALLBACK 3
78 int ioBufSize,
uchar* buffer,
void* userData,
84 int ioFlags,
int ioBufSize,
void* userData,
93 int ioFlags,
void* userData,
IplImage* avg,
98 void* userData,
float* coeffs,
IplImage* avg,
174 #define CV_COUNT_OBS(roi, win, delta, numObs ) \
176 (numObs)->width =((roi)->width -(win)->width +(delta)->width)/(delta)->width; \
177 (numObs)->height =((roi)->height -(win)->height +(delta)->height)/(delta)->height;\
199 int num_img,
CvEHMM* hmm );
204 int num_img,
CvEHMM* hmm );
209 int num_img,
CvEHMM* hmm );
225 int num_img,
CvEHMM* hmm );
251 float* intrinsic,
float* homography );
267 double dx = pt1.x - pt2.x;
268 double dy = pt1.y - pt2.y;
270 return dx*dx + dy*
dy;
280 #define CV_CURRENT_INT( reader ) (*((int *)(reader).ptr))
281 #define CV_PREV_INT( reader ) (*((int *)(reader).prev_elem))
283 #define CV_GRAPH_WEIGHTED_VERTEX_FIELDS() CV_GRAPH_VERTEX_FIELDS()\
286 #define CV_GRAPH_WEIGHTED_EDGE_FIELDS() CV_GRAPH_EDGE_FIELDS()
310 #define CV_DOMINANT_IPAN 1
316 double parameter2 CV_DEFAULT(0),
317 double parameter3 CV_DEFAULT(0),
318 double parameter4 CV_DEFAULT(0));
353 #define CLIQUE_TIME_OFF 2
354 #define CLIQUE_FOUND 1
459 #define CV_UNDEF_SC_PARAM 12345 //default value of parameters
461 #define CV_IDP_BIRCHFIELD_PARAM1 25
462 #define CV_IDP_BIRCHFIELD_PARAM2 5
463 #define CV_IDP_BIRCHFIELD_PARAM3 12
464 #define CV_IDP_BIRCHFIELD_PARAM4 15
465 #define CV_IDP_BIRCHFIELD_PARAM5 25
468 #define CV_DISPARITY_BIRCHFIELD 0
490 const
CvArr* leftImage, const
CvArr* rightImage,
498 double param5
CV_DEFAULT(CV_UNDEF_SC_PARAM) );
563 #define CV_CAMERA_TO_WARP 1
564 #define CV_WARP_TO_CAMERA 2
587 double* convTransVect);
625 int* needSwapCameras);
654 double *a,
double *b,
double *c,
680 double a,
double b,
double c,
691 double a,
double b,
double c,
696 double* camMatr,
double* rotMatr,
double* transVect,
718 CVAPI(
void)
icvGetCutPiece(
double* areaLineCoef1,
double* areaLineCoef2,
739 int desired_depth,
int desired_num_channels );
800 const
CvSeq* contour2,
806 CvSeq* corr,
double alpha,
819 int length,
float* alpha,
820 float* beta,
float* gamma,
821 int coeff_usage,
CvSize win,
828 #define CV_GLCM_OPTIMIZATION_NONE -2
829 #define CV_GLCM_OPTIMIZATION_LUT -1
830 #define CV_GLCM_OPTIMIZATION_HISTOGRAM 0
832 #define CV_GLCMDESC_OPTIMIZATION_ALLOWDOUBLENEST 10
833 #define CV_GLCMDESC_OPTIMIZATION_ALLOWTRIPLENEST 11
834 #define CV_GLCMDESC_OPTIMIZATION_HISTOGRAM 4
836 #define CV_GLCMDESC_ENTROPY 0
837 #define CV_GLCMDESC_ENERGY 1
838 #define CV_GLCMDESC_HOMOGENITY 2
839 #define CV_GLCMDESC_CONTRAST 3
840 #define CV_GLCMDESC_CLUSTERTENDENCY 4
841 #define CV_GLCMDESC_CLUSTERSHADE 5
842 #define CV_GLCMDESC_CORRELATION 6
843 #define CV_GLCMDESC_CORRELATIONINFO1 7
844 #define CV_GLCMDESC_CORRELATIONINFO2 8
845 #define CV_GLCMDESC_MAXIMUMPROBABILITY 9
847 #define CV_GLCM_ALL 0
848 #define CV_GLCM_GLCM 1
849 #define CV_GLCM_DESC 2
855 const
int* stepDirections CV_DEFAULT(0),
856 int numStepDirections CV_DEFAULT(0),
862 int descriptorOptimizationType
868 double* average,
double* standardDeviation );
879 #define CV_NUM_FACE_ELEMENTS 3
888 CvRect* pRects,
int nRects);
890 CvRect* pRects,
int nRects,
891 CvPoint* ptRotate,
double* dbAngleRotate);
951 float focal_length[2];
990 #define CV_NEXT_VORONOISITE2D( SITE ) ((SITE)->edge[0]->site[((SITE)->edge[0]->site[0] == (SITE))])
991 #define CV_PREV_VORONOISITE2D( SITE ) ((SITE)->edge[1]->site[((SITE)->edge[1]->site[0] == (SITE))])
992 #define CV_FIRST_VORONOIEDGE2D( SITE ) ((SITE)->edge[0])
993 #define CV_LAST_VORONOIEDGE2D( SITE ) ((SITE)->edge[1])
994 #define CV_NEXT_VORONOIEDGE2D( EDGE, SITE ) ((EDGE)->next[(EDGE)->site[0] != (SITE)])
995 #define CV_PREV_VORONOIEDGE2D( EDGE, SITE ) ((EDGE)->next[2 + ((EDGE)->site[0] != (SITE))])
996 #define CV_VORONOIEDGE2D_BEGINNODE( EDGE, SITE ) ((EDGE)->node[((EDGE)->site[0] != (SITE))])
997 #define CV_VORONOIEDGE2D_ENDNODE( EDGE, SITE ) ((EDGE)->node[((EDGE)->site[0] == (SITE))])
998 #define CV_TWIN_VORONOISITE2D( SITE, EDGE ) ( (EDGE)->site[((EDGE)->site[0] == (SITE))])
1000 #define CV_VORONOISITE2D_FIELDS() \
1001 struct CvVoronoiNode2D *node[2]; \
1002 struct CvVoronoiEdge2D *edge[2];
1010 #define CV_VORONOIEDGE2D_FIELDS() \
1011 struct CvVoronoiNode2D *node[2]; \
1012 struct CvVoronoiSite2D *site[2]; \
1013 struct CvVoronoiEdge2D *next[4];
1020 #define CV_VORONOINODE2D_FIELDS() \
1021 CV_SET_ELEM_FIELDS(CvVoronoiNode2D) \
1030 #define CV_VORONOIDIAGRAM2D_FIELDS() \
1044 int contour_orientation CV_DEFAULT(-1),
1045 int attempt_number CV_DEFAULT(10));
1064 typedef struct CvLCMEdge
1073 typedef struct CvLCMNode
1109 int* scanlines1,
int* scanlines2,
1110 int* lengths1,
int* lengths2,
1211 return !img ? 0 : !img->roi ? img->width : img->roi->width;
1259 GetEtalon(
int* paramCount = 0,
const double** etalonParams = 0,
1260 int* pointCount = 0,
const CvPoint2D32f** etalonPoints = 0 )
const;
1263 virtual void SetCameraCount(
int cameraCount );
1269 virtual bool SetFrames(
int totalFrames );
1272 virtual void Stop(
bool calibrate =
false );
1280 virtual bool FindEtalon(
IplImage** imgs );
1283 virtual bool FindEtalon(
CvMat** imgs );
1291 virtual int GetFrameCount(
int* framesTotal = 0 )
const;
1295 virtual const CvCamera* GetCameraParams(
int idx = 0 )
const;
1300 virtual bool SetCameraParams(
CvCamera* params );
1303 virtual bool SaveCameraParams(
const char* filename );
1306 virtual bool LoadCameraParams(
const char* filename );
1316 virtual bool GetLatestPoints(
int idx,
CvPoint2D32f** pts,
1317 int* count,
bool* found );
1323 virtual void DrawPoints(
CvMat**
dst );
1326 virtual bool Rectify(
CvMat** srcarr,
CvMat** dstarr );
1330 enum { MAX_CAMERAS = 3 };
1350 int latestCounts[MAX_CAMERAS];
1373 refcount = image ?
new int(1) : 0;
1378 refcount = image ?
new int(1) : 0;
1383 if( refcount ) ++(*refcount);
1386 CvImage(
const char* filename,
const char* imgname=0,
int color=-1 ) : image(0), refcount(0)
1387 { load( filename, imgname, color ); }
1390 { read( fs, mapname, imgname ); }
1393 { read( fs, seqname, idx ); }
1397 if( refcount && !(--*refcount) )
1406 void create(
CvSize size,
int depth,
int channels )
1408 if( !image || !refcount ||
1409 image->width != size.
width || image->height != size.
height ||
1410 image->depth != depth || image->nChannels != channels )
1419 if( refcount && --*refcount == 0 )
1425 refcount = use_refcount && image ?
new int(1) : 0;
1430 if( refcount && --*refcount == 0 )
1439 bool load(
const char* filename,
const char* imgname=0,
int color=-1 );
1440 bool read(
CvFileStorage* fs,
const char* mapname,
const char* imgname );
1441 bool read(
CvFileStorage* fs,
const char* seqname,
int idx );
1442 void save(
const char* filename,
const char* imgname,
const int* params=0 );
1445 void show(
const char* window_name );
1448 int width()
const {
return image ? image->width : 0; }
1449 int height()
const {
return image ? image->height : 0; }
1455 return !image ?
cvSize(0,0) :
1456 !image->roi ?
cvSize(image->width,image->height) :
1457 cvSize(image->roi->width, image->roi->height);
1462 return !image ?
cvRect(0,0,0,0) :
1463 !image->roi ?
cvRect(0,0,image->width,image->height) :
1464 cvRect(image->roi->xOffset,image->roi->yOffset,
1465 image->roi->width,image->roi->height);
1468 int coi()
const {
return !image || !image->roi ? 0 : image->roi->coi; }
1473 int depth()
const {
return image ? image->depth : 0; }
1474 int channels()
const {
return image ? image->nChannels : 0; }
1475 int pix_size()
const {
return image ? ((image->depth & 255)>>3)*image->nChannels : 0; }
1479 int step()
const {
return image ? image->widthStep : 0; }
1480 int origin()
const {
return image ? image->origin : 0; }
1491 (
uchar*)(image->imageData + y*image->widthStep) :
1492 (
uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
1493 image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
1505 (
const uchar*)(image->imageData + y*image->widthStep) :
1506 (
const uchar*)(image->imageData + (y+image->roi->yOffset)*image->widthStep +
1507 image->roi->xOffset*((image->depth & 255)>>3)*image->nChannels);
1517 if( refcount && !(--*refcount) )
1556 CvMatrix(
const char* filename,
const char* matname=0,
int color=-1 ) : matrix(0)
1557 { load( filename, matname, color ); }
1560 { read( fs, mapname, matname ); }
1563 { read( fs, seqname, idx ); }
1580 void create(
int rows,
int cols,
int type )
1582 if( !matrix || !matrix->refcount ||
1583 matrix->rows != rows || matrix->cols != cols ||
1592 if( matrix->hdr_refcount )
1593 ++matrix->hdr_refcount;
1594 else if( matrix->refcount )
1595 ++*matrix->refcount;
1603 if( matrix->hdr_refcount )
1605 if( --matrix->hdr_refcount == 0 )
1608 else if( matrix->refcount )
1610 if( --*matrix->refcount == 0 )
1611 cvFree( &matrix->refcount );
1622 bool load(
const char* filename,
const char* matname=0,
int color=-1 );
1623 bool read(
CvFileStorage* fs,
const char* mapname,
const char* matname );
1624 bool read(
CvFileStorage* fs,
const char* seqname,
int idx );
1625 void save(
const char* filename,
const char* matname,
const int* params=0 );
1628 void show(
const char* window_name );
1632 int rows()
const {
return matrix ? matrix->rows : 0; }
1633 int cols()
const {
return matrix ? matrix->cols : 0; }
1637 return !matrix ?
cvSize(0,0) :
cvSize(matrix->rows,matrix->cols);
1646 const uchar*
data()
const {
return matrix ? matrix->data.ptr : 0; }
1647 int step()
const {
return matrix ? matrix->step : 0; }
1652 uchar*
row(
int i) {
return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
1654 {
return !matrix ? 0 : matrix->data.ptr + i*matrix->step; }
1656 operator const CvMat* ()
const {
return matrix; }
1683 float get_orientation() const
1684 {
return m_box.angle; }
1685 float get_length() const
1686 {
return m_box.size.height; }
1687 float get_width() const
1688 {
return m_box.size.width; }
1690 {
return m_box.center; }
1692 {
return m_comp.rect; }
1695 int get_threshold() const
1696 {
return m_threshold; }
1698 int get_hist_dims(
int* dims = 0 ) const
1699 {
return m_hist ?
cvGetDims( m_hist->bins, dims ) : 0; }
1701 int get_min_ch_val(
int channel )
const
1702 {
return m_min_ch_val[channel]; }
1704 int get_max_ch_val(
int channel )
const
1705 {
return m_max_ch_val[channel]; }
1709 { m_comp.rect = window;
return true; }
1711 bool set_threshold(
int threshold )
1712 { m_threshold =
threshold;
return true; }
1714 bool set_hist_bin_range(
int dim,
int min_val,
int max_val );
1716 bool set_hist_dims(
int c_dims,
int* dims );
1718 bool set_min_ch_val(
int channel,
int val )
1719 { m_min_ch_val[channel] = val;
return true; }
1720 bool set_max_ch_val(
int channel,
int val )
1721 { m_max_ch_val[channel] = val;
return true; }
1725 virtual bool track_object(
const IplImage* cur_frame );
1728 virtual bool update_histogram(
const IplImage* cur_frame );
1731 virtual void reset_histogram();
1736 {
return m_back_project; }
1738 float query(
int* bin )
const
1739 {
return m_hist ? (float)
cvGetRealND(m_hist->bins, bin) : 0.f; }
1744 virtual void color_transform(
const IplImage* img );