Normalize line endings and whitespace

This commit is contained in:
OpenCV Buildbot
2012-10-17 03:18:30 +04:00
committed by Andrey Kamaev
parent 69020da607
commit 04384a71e4
1516 changed files with 258846 additions and 258162 deletions

View File

@@ -58,7 +58,7 @@ public:
inline bool isFaceFeature();
inline void * GetContour();
inline double GetWeight();
inline void SetContour(void * lpContour);
inline void SetContour(void * lpContour);
inline void SetWeight(double dWeight);
inline void SetFeature(bool bIsFeature);
private:
@@ -79,7 +79,7 @@ inline bool FaceFeature::isFaceFeature()
inline void * FaceFeature::GetContour()
{
return m_lpContour;
return m_lpContour;
}//inline void * FaceFeature::GetContour()
inline double FaceFeature::GetWeight()
@@ -104,12 +104,12 @@ class FaceTemplate
public:
FaceTemplate(long lFeatureCount) {m_lFeaturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];};
virtual ~FaceTemplate();
inline long GetCount();
inline FaceFeature * GetFeatures();
protected:
FaceFeature * m_lpFeaturesList;
FaceFeature * m_lpFeaturesList;
private:
long m_lFeaturesCount;
};//class FaceTemplate
@@ -141,10 +141,10 @@ public:
inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,
double dDistanceBetweenEye,double dDistanceEyeAboveMouth):FaceTemplate(lNumber)
{
CvRect MouthRect = rect;
CvRect LeftEyeRect = cvRect(cvRound(rect.x - (dEyeWidth + dDistanceBetweenEye/(double)2 - (double)rect.width/(double)2)),
cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
cvRound(dEyeWidth),
@@ -159,11 +159,11 @@ inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEye
// cvRound(rect.y - (double)rect.width/(double)2 - (double)rect.height/(double)4),
// cvRound((double)rect.width/(double)2),
// cvRound((double)rect.width/(double)2) );
/*
/*
CvRect CheenRect = cvRect(rect.x,rect.y + 3*rect.height/2,rect.width,rect.height);
*/
*/
CvRect * lpMouthRect = new CvRect();
*lpMouthRect = MouthRect;
m_lpFeaturesList[0].SetContour(lpMouthRect);
@@ -183,7 +183,7 @@ inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEye
m_lpFeaturesList[2].SetWeight(1);
m_lpFeaturesList[2].SetFeature(true);
// CvRect * lpNoseRect = new CvRect();
// *lpNoseRect = NoseRect;
// m_lpFeaturesList[3].SetContour(lpNoseRect);
@@ -218,18 +218,18 @@ class Face
public:
Face(FaceTemplate * lpFaceTemplate);
virtual ~Face();
inline bool isFeature(void * lpElem);
virtual void Show(IplImage * /*Image*/){};
virtual void ShowIdeal(IplImage* /*Image*/){};
virtual void CreateFace(void * lpData) = 0;
virtual bool CheckElem(void * lpCandidat,void * lpIdeal) = 0;
virtual double GetWeight() = 0;
protected:
FaceFeature * m_lpIdealFace;//ideal face definition
long m_lFaceFeaturesNumber; //total number of diferent face features
long m_lFaceFeaturesNumber; //total number of diferent face features
long * m_lplFaceFeaturesCount;//number of each features fouded for this face
FaceFeature ** m_lppFoundedFaceFeatures;//founded features of curen face
double m_dWeight;
@@ -240,15 +240,15 @@ inline bool Face::isFeature(void * lpElem)
for (int i = 0;i < m_lFaceFeaturesNumber;i ++)
{
void * lpIdeal = m_lpIdealFace[i].GetContour();
if ( CheckElem( lpElem,lpIdeal) )
{
if (m_lplFaceFeaturesCount[i] < 3*MAX_LAYERS)
{
double dWeight = m_lpIdealFace[i].GetWeight();
bool bIsFeature = m_lpIdealFace[i].isFaceFeature();
if (bIsFeature)
{
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetWeight(dWeight);
@@ -256,14 +256,14 @@ inline bool Face::isFeature(void * lpElem)
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetFeature(bIsFeature);
m_lplFaceFeaturesCount[i] ++;
}
m_dWeight += dWeight;
if (bIsFeature)
return true;
}
}
}
return false;
@@ -293,7 +293,7 @@ private:
bool m_bIsGenerated;
void ResizeRect(CvRect Rect,CvRect * lpRect,long lDir,long lD);
void CalculateError(FaceData * lpFaceData);
};
};
class FaceDetectionListElem
@@ -321,7 +321,7 @@ private:
};//class FaceDetectionList
class FaceDetection
class FaceDetection
{
public:
void FindFace(IplImage* img);
@@ -339,7 +339,7 @@ protected:
CvSeq* m_seqContours[MAX_LAYERS];
CvMemStorage* m_mstgRects;
CvSeq* m_seqRects;
bool m_bBoosting;
FaceDetectionList * m_pFaceList;
@@ -355,7 +355,7 @@ protected:
inline void ReallocImage(IplImage** ppImage, CvSize sz, long lChNum)
{
IplImage* pImage;
if( ppImage == NULL )
if( ppImage == NULL )
return;
pImage = *ppImage;
if( pImage != NULL )
@@ -384,7 +384,7 @@ inline BoostingFaceTemplate::BoostingFaceTemplate(long lNumber,CvRect rect):Face
{
long EyeWidth = rect.width/5;
long EyeHeight = EyeWidth;
CvRect LeftEyeRect = cvRect(rect.x + EyeWidth,rect.y + rect.height/2 - EyeHeight,EyeWidth,EyeHeight);
CvRect RightEyeRect = cvRect(rect.x + 3*EyeWidth,rect.y + rect.height/2 - EyeHeight,EyeWidth,EyeHeight);
CvRect MouthRect = cvRect(rect.x + 3*EyeWidth/2,rect.y + 3*rect.height/4 - EyeHeight/2,2*EyeWidth,EyeHeight);

View File

@@ -251,7 +251,7 @@ CV_INLINE void icvTransposeMatrix_32f( const float* src, int w, int h, float* ds
for( i = 0; i < w; i++ )
for( j = 0; j < h; j++ )
*dst++ = src[j*w + i];
icvCheckVector_32f( dst, w*h );
}
@@ -269,7 +269,7 @@ CV_INLINE void icvTransposeMatrix_64d( const double* src, int w, int h, double*
CV_INLINE void icvDetMatrix3x3_64d( const double* mat, double* det )
{
#define m(y,x) mat[(y)*3 + (x)]
*det = m(0,0)*(m(1,1)*m(2,2) - m(1,2)*m(2,1)) -
m(0,1)*(m(1,0)*m(2,2) - m(1,2)*m(2,0)) +
m(0,2)*(m(1,0)*m(2,1) - m(1,1)*m(2,0));

View File

@@ -70,21 +70,21 @@ inline int operator != (const CvRect& r1, const CvRect& r2)
return !(r1 == r2);
}
inline
inline
int CmpPoints(const CvPoint& p1, const CvPoint& p2, int err)
{
/* Simakov: modify __max to max */
return (max(abs(p1.x - p2.x), abs(p1.y - p2.y)) < err);
}
inline
inline
int PointInRect(const CvPoint& p, const CvRect& r)
{
return ((p.x > r.x) && (p.x < (r.x + r.width)) &&
(p.y > r.y) && (p.y < (r.y + r.height)));
}
inline
inline
int RectInRect(const CvRect& r1, const CvRect& r2)
{
CvPoint plt = {r1.x, r1.y};
@@ -92,7 +92,7 @@ int RectInRect(const CvRect& r1, const CvRect& r2)
return (PointInRect(plt, r2) && PointInRect(prb, r2));
}
inline
inline
CvRect Increase(const CvRect& r, int decr)
{
CvRect rect;
@@ -103,7 +103,7 @@ CvRect Increase(const CvRect& r, int decr)
return rect;
}
inline
inline
CvPoint Increase(const CvPoint& p, int decr)
{
CvPoint point;
@@ -112,21 +112,21 @@ CvPoint Increase(const CvPoint& p, int decr)
return point;
}
inline
inline
void Move(CvRect& r, int dx, int dy)
{
r.x += dx;
r.y += dy;
}
inline
inline
void Move(CvPoint& p, int dx, int dy)
{
p.x += dx;
p.y += dy;
}
inline
inline
void Extend(CvRect& r, int d)
{
r.x -= d;
@@ -135,7 +135,7 @@ void Extend(CvRect& r, int d)
r.height += 2*d;
}
inline
inline
CvPoint Center(const CvRect& r)
{
CvPoint p;
@@ -147,7 +147,7 @@ CvPoint Center(const CvRect& r)
inline void ReallocImage(IplImage** ppImage, CvSize sz, long lChNum)
{
IplImage* pImage;
if( ppImage == NULL )
if( ppImage == NULL )
return;
pImage = *ppImage;
if( pImage != NULL )

View File

@@ -176,7 +176,7 @@ CvStatus icvGetCrossEpilineFrame( CvSize imgSize,
int* y2
);
CvStatus icvBuildScanlineLeftStereo(
CvStatus icvBuildScanlineLeftStereo(
CvSize imgSize,
CvMatrix3* matrix,
float* l_epipole,
@@ -261,16 +261,16 @@ CvStatus icvFindFundamentalMatrix(
CvMatrix3* matrix);
*/
void icvChoose7( int* ml, int* mr,
int num, int* ml7,
int* mr7 );
int num, int* ml7,
int* mr7 );
double icvMedian( int* ml, int* mr,
int num, double* F );
int num, double* F );
int icvBoltingPoints( int* ml, int* mr,
int num, double* F,
double Mj, int* *new_ml,
int* *new_mr, int* new_num);
int num, double* F,
double Mj, int* *new_ml,
int* *new_mr, int* new_num);
CvStatus icvPoints8( int* ml, int* mr,
int num, double* F );
@@ -280,17 +280,17 @@ CvStatus icvRank2Constraint( double* F );
CvStatus icvSort( double* array, int length );
double icvAnalyticPoints8( double* A,
int num, double* F );
int num, double* F );
int icvSingularValueDecomposition( int M,
int N,
double* A,
double* W,
int get_U,
double* U,
int get_V,
double* V
);
int N,
double* A,
double* W,
int get_U,
double* U,
int get_V,
double* V
);
/*======================================================================================*/

View File

@@ -44,7 +44,7 @@
//
// Foreground Object Detection from Videos Containing Complex Background
// Li, Huan, Gu, Tian 2003 9p
// http://muq.org/~cynbe/bib/foreground-object-detection-from-videos-containing-complex-background.pdf
// http://muq.org/~cynbe/bib/foreground-object-detection-from-videos-containing-complex-background.pdf
#include "precomp.hpp"
@@ -61,7 +61,7 @@ static double* _cv_max_element( double* start, double* end )
for( ; start != end; ++start) {
if (*p < *start) p = start;
}
}
return p;
}
@@ -80,11 +80,11 @@ CV_IMPL CvBGStatModel*
cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters )
{
CvFGDStatModel* p_model = 0;
CV_FUNCNAME( "cvCreateFGDStatModel" );
__BEGIN__;
int i, j, k, pixel_count, buf_size;
CvFGDStatModelParams params;
@@ -131,11 +131,11 @@ cvCreateFGDStatModel( IplImage* first_frame, CvFGDStatModelParams* parameters )
// Initialize storage pools:
pixel_count = first_frame->width * first_frame->height;
buf_size = pixel_count*sizeof(p_model->pixel_stat[0]);
CV_CALL( p_model->pixel_stat = (CvBGPixelStat*)cvAlloc(buf_size) );
memset( p_model->pixel_stat, 0, buf_size );
buf_size = pixel_count*params.N2c*sizeof(p_model->pixel_stat[0].ctable[0]);
CV_CALL( p_model->pixel_stat[0].ctable = (CvBGPixelCStatTable*)cvAlloc(buf_size) );
memset( p_model->pixel_stat[0].ctable, 0, buf_size );
@@ -184,7 +184,7 @@ icvReleaseFGDStatModel( CvFGDStatModel** _model )
CV_FUNCNAME( "icvReleaseFGDStatModel" );
__BEGIN__;
if( !_model )
CV_ERROR( CV_StsNullPtr, "" );
@@ -248,9 +248,9 @@ cvChangeDetection( IplImage* prev_frame,
// Create histogram:
long HISTOGRAM[PIXELRANGE];
long HISTOGRAM[PIXELRANGE];
for (i=0 ; i<PIXELRANGE; i++) HISTOGRAM[i]=0;
for (y=0 ; y<curr_frame->height ; y++)
{
uchar* rowStart1 = (uchar*)curr_frame->imageData + y * curr_frame->widthStep + b;
@@ -358,7 +358,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
{
if( ((uchar*)model->Fbd->imageData)[i*mask_step+j] || ((uchar*)model->Ftd->imageData)[i*mask_step+j] )
{
float Pb = 0;
float Pb = 0;
float Pv = 0;
float Pvb = 0;
@@ -366,7 +366,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
CvBGPixelCStatTable* ctable = stat->ctable;
CvBGPixelCCStatTable* cctable = stat->cctable;
uchar* curr_data = (uchar*)(curr_frame->imageData) + i*curr_frame->widthStep + j*3;
uchar* prev_data = (uchar*)(prev_frame->imageData) + i*prev_frame->widthStep + j*3;
@@ -375,11 +375,11 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
// Is it a motion pixel?
if( ((uchar*)model->Ftd->imageData)[i*mask_step+j] )
{
if( !stat->is_trained_dyn_model ) {
if( !stat->is_trained_dyn_model ) {
val = 1;
} else {
} else {
// Compare with stored CCt vectors:
for( k = 0; PV_CC(k) > model->params.alpha2 && k < model->params.N1cc; k++ )
@@ -431,17 +431,17 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_OPEN, model->params.perform_morphing );
cvMorphologyEx( model->foreground, model->foreground, 0, 0, CV_MOP_CLOSE, model->params.perform_morphing );
}
if( model->params.minArea > 0 || model->params.is_obj_without_holes ){
// Discard under-size foreground regions:
//
//
cvFindContours( model->foreground, model->storage, &first_seq, sizeof(CvContour), CV_RETR_LIST );
for( seq = first_seq; seq; seq = seq->h_next )
{
CvContour* cnt = (CvContour*)seq;
if( cnt->rect.width * cnt->rect.height < model->params.minArea ||
if( cnt->rect.width * cnt->rect.height < model->params.minArea ||
(model->params.is_obj_without_holes && CV_IS_SEQ_HOLE(seq)) )
{
// Delete under-size contour:
@@ -461,7 +461,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
{
region_count++;
}
}
}
model->foreground_regions = first_seq;
cvZero(model->foreground);
cvDrawContours(model->foreground, first_seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1);
@@ -586,7 +586,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
sum2 += PVB_CC(k);
}
if( sum1 > model->params.T ) stat->is_trained_dyn_model = 1;
diff = sum1 - stat->Pbcc * sum2;
// Update stat table:
if( diff > model->params.T )
@@ -628,7 +628,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
PVB_C(k) = 0;
continue;
}
dist = 0;
for( l = 0; l < 3; l++ )
{
@@ -706,7 +706,7 @@ icvUpdateFGDStatModel( IplImage* curr_frame, CvFGDStatModel* model, double )
if( !((uchar*)model->foreground->imageData)[i*mask_step+j])
{
uchar* ptr = ((uchar*)model->background->imageData) + i*model->background->widthStep+j*3;
if( !((uchar*)model->Ftd->imageData)[i*mask_step+j] &&
!((uchar*)model->Fbd->imageData)[i*mask_step+j] )
{

View File

@@ -61,23 +61,23 @@ int cvUpdateBGStatModel( IplImage* current_frame,
// bg_model - pointer to CvBGStatModel structure
CV_IMPL void cvRefineForegroundMaskBySegm( CvSeq* segments, CvBGStatModel* bg_model )
{
IplImage* tmp_image = cvCreateImage(cvSize(bg_model->foreground->width,bg_model->foreground->height),
IPL_DEPTH_8U, 1);
for( ; segments; segments = ((CvSeq*)segments)->h_next )
{
CvSeq seq = *segments;
seq.v_next = seq.h_next = NULL;
cvZero(tmp_image);
cvDrawContours( tmp_image, &seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1);
int num1 = cvCountNonZero(tmp_image);
IplImage* tmp_image = cvCreateImage(cvSize(bg_model->foreground->width,bg_model->foreground->height),
IPL_DEPTH_8U, 1);
for( ; segments; segments = ((CvSeq*)segments)->h_next )
{
CvSeq seq = *segments;
seq.v_next = seq.h_next = NULL;
cvZero(tmp_image);
cvDrawContours( tmp_image, &seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1);
int num1 = cvCountNonZero(tmp_image);
cvAnd(tmp_image, bg_model->foreground, tmp_image);
int num2 = cvCountNonZero(tmp_image);
if( num2 > num1*0.5 )
cvDrawContours( bg_model->foreground, &seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1);
else
cvDrawContours( bg_model->foreground, &seq, CV_RGB(0, 0, 0), CV_RGB(0, 0, 0), 10, -1);
}
cvReleaseImage(&tmp_image);
int num2 = cvCountNonZero(tmp_image);
if( num2 > num1*0.5 )
cvDrawContours( bg_model->foreground, &seq, CV_RGB(0, 0, 255), CV_RGB(0, 0, 255), 10, -1);
else
cvDrawContours( bg_model->foreground, &seq, CV_RGB(0, 0, 0), CV_RGB(0, 0, 0), 10, -1);
}
cvReleaseImage(&tmp_image);
}
@@ -91,7 +91,7 @@ cvSegmentFGMask( CvArr* _mask, int poly1Hull0, float perimScale,
CvSeq *contours, *c;
int nContours = 0;
CvContourScanner scanner;
// clean up raw mask
cvMorphologyEx( mask, mask, 0, 0, CV_MOP_OPEN, 1 );
cvMorphologyEx( mask, mask, 0, 0, CV_MOP_CLOSE, 1 );
@@ -99,8 +99,8 @@ cvSegmentFGMask( CvArr* _mask, int poly1Hull0, float perimScale,
// find contours around only bigger regions
scanner = cvStartFindContours( mask, tempStorage,
sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, offset );
while( (c = cvFindNextContour( scanner )) != 0 )
while( (c = cvFindNextContour( scanner )) != 0 )
{
double len = cvContourPerimeter( c );
double q = (mask->rows + mask->cols)/perimScale; // calculate perimeter len threshold
@@ -109,8 +109,8 @@ cvSegmentFGMask( CvArr* _mask, int poly1Hull0, float perimScale,
else //Smooth it's edges if it's large enough
{
CvSeq* newC;
if( poly1Hull0 ) //Polygonal approximation of the segmentation
newC = cvApproxPoly( c, sizeof(CvContour), tempStorage, CV_POLY_APPROX_DP, 2, 0 );
if( poly1Hull0 ) //Polygonal approximation of the segmentation
newC = cvApproxPoly( c, sizeof(CvContour), tempStorage, CV_POLY_APPROX_DP, 2, 0 );
else //Convex Hull of the segmentation
newC = cvConvexHull2( c, tempStorage, CV_CLOCKWISE, 1 );
cvSubstituteContour( scanner, newC );
@@ -121,7 +121,7 @@ cvSegmentFGMask( CvArr* _mask, int poly1Hull0, float perimScale,
// paint the found regions back into the image
cvZero( mask );
for( c=contours; c != 0; c = c->h_next )
for( c=contours; c != 0; c = c->h_next )
cvDrawContours( mask, c, cvScalarAll(255), cvScalarAll(0), -1, CV_FILLED, 8,
cvPoint(-offset.x,-offset.y));

View File

@@ -47,12 +47,12 @@
static CvBGStatModel* cvCreateBGStatModel( IplImage* first_frame, int model_type, void* params )
{
CvBGStatModel* bg_model = NULL;
if( model_type == CV_BG_MODEL_FGD || model_type == CV_BG_MODEL_FGD_SIMPLE )
bg_model = cvCreateFGDStatModel( first_frame, (CvFGDStatModelParams*)params );
else if( model_type == CV_BG_MODEL_MOG )
bg_model = cvCreateGaussianBGModel( first_frame, (CvGaussBGStatModelParams*)params );
return bg_model;
}

File diff suppressed because it is too large Load Diff

View File

@@ -562,7 +562,7 @@ double CvBlobTracker::GetConfidenceList(CvBlobSeq* pBlobList, IplImage* pImg, Ip
}
void CvBlobTracker::UpdateBlob(int /*BlobIndex*/, CvBlob* /*pBlob*/, IplImage* /*pImg*/, IplImage* /*pImgFG*/)
{
{
}
/* Update all blob models: */

View File

@@ -223,10 +223,10 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
#ifndef WINCE
time_t ltime;
time( &ltime );
char* stime = ctime( &ltime );
char* stime = ctime( &ltime );
#else
/* WINCE does not have above POSIX functions (time,ctime) */
const char* stime = " wince ";
/* WINCE does not have above POSIX functions (time,ctime) */
const char* stime = " wince ";
#endif
FILE* out = fopen(m_TimesFile,"at");
double Time;

View File

@@ -43,8 +43,8 @@
/****************************************************************************************\
calculate image homography
calculate image homography
\****************************************************************************************/
CV_IMPL void
@@ -100,7 +100,7 @@ cvCalcImageHomography( float* line, CvPoint3D32f* _center,
/* calculate (I - r_trans)*center */
cvSetIdentity( &sub );
cvSub( &sub, &r_trans, &sub );
cvMatMul( &sub, &center, &t_trans );
cvMatMul( &sub, &center, &t_trans );
cvMatMul( &t_trans, &rz, &sub );
cvScaleAdd( &sub, cvRealScalar(1./plane_dist), &r_trans, &sub ); /* ? */

View File

@@ -43,7 +43,7 @@
CvCamShiftTracker::CvCamShiftTracker()
{
int i;
memset( &m_box, 0, sizeof(m_box));
memset( &m_comp, 0, sizeof(m_comp));
memset( m_color_planes, 0, sizeof(m_color_planes));
@@ -68,7 +68,7 @@ CvCamShiftTracker::CvCamShiftTracker()
CvCamShiftTracker::~CvCamShiftTracker()
{
int i;
cvReleaseHist( &m_hist );
for( i = 0; i < CV_MAX_DIM; i++ )
cvReleaseImage( &m_color_planes[i] );
@@ -89,7 +89,7 @@ CvCamShiftTracker::color_transform( const IplImage* image )
int i, n = get_hist_dims(dims);
assert( image->nChannels == 3 && m_hist != 0 );
if( !m_temp || !m_mask || !m_color_planes[0] || !m_color_planes[n-1] || !m_back_project ||
m_temp->width != size.width || m_temp->height != size.height ||
m_temp->nChannels != 3 )
@@ -111,7 +111,7 @@ CvCamShiftTracker::color_transform( const IplImage* image )
cvCvtColor( image, m_temp, CV_BGR2HSV );
cvGetRawData( m_temp, &color_data, &color_step, &size );
cvGetRawData( m_mask, &mask, &mask_step, &size );
for( i = 0; i < n; i++ )
cvGetRawData( m_color_planes[i], &planes[i], &plane_step, &size );
@@ -203,19 +203,19 @@ CvCamShiftTracker::track_object( const IplImage* cur_frame )
{
CvRect rect;
CvSize bp_size;
union
{
void** arr;
IplImage** img;
} u;
if( m_comp.rect.width == 0 || m_comp.rect.height == 0 ||
m_hist == 0 )
{
return false;
}
color_transform( cur_frame );
u.img = m_color_planes;
cvCalcArrBackProject( u.arr, m_back_project, m_hist );

View File

@@ -52,7 +52,7 @@
#include "_cvwrap.h"
/*typedef struct CvCliqueFinder
{
{
CvGraph* graph;
int** adj_matr;
int N; //graph size
@@ -61,7 +61,7 @@
int k; //stack size
int* current_comp;
int** All;
int* ne;
int* ce;
int* fixp; //node with minimal disconnections
@@ -99,7 +99,7 @@ void _MarkNodes( CvGraph* graph )
{
ver->flags = i<<1;
}
}
}
}
void _FillAdjMatrix( CvGraph* graph, int** connected, int reverse )
@@ -110,7 +110,7 @@ void _FillAdjMatrix( CvGraph* graph, int** connected, int reverse )
for( int j = 0; j < graph->total; j++ )
{
connected[i][j] = 0|reverse;
}
}
//memset( connected[i], 0, sizeof(int)*graph->total );
CvGraphVtx* ver = cvGetGraphVtx( graph, i );
if( ver )
@@ -146,7 +146,7 @@ void cvStartFindCliques( CvGraph* graph, CvCliqueFinder* finder, int reverse, in
assert(ver);
assert(ver->weight>=0);
finder->vertex_weights[i] = ver->weight;
finder->cand_weight[0] += ver->weight;
finder->cand_weight[0] += ver->weight;
}
}
else finder->weighted = 0;
@@ -174,14 +174,14 @@ void cvStartFindCliques( CvGraph* graph, CvCliqueFinder* finder, int reverse, in
if( edge )
{
assert( ((CvGraphWeightedEdge*)edge)->weight >= 0 );
finder->edge_weights[ i * graph->total + j ] =
finder->edge_weights[ i * graph->total + j ] =
finder->edge_weights[ j * graph->total + i ] = ((CvGraphWeightedEdge*)edge)->weight;
}
}
}
}
}
else finder->weighted_edges = 0;
//int* Compsub; //current component (vertex stack)
finder->k = 0; //counter of steps
@@ -198,7 +198,7 @@ void cvStartFindCliques( CvGraph* graph, CvCliqueFinder* finder, int reverse, in
finder->fixp = new int[N+1]; //node with minimal disconnections
finder->nod = new int[N+1];
finder->s = new int[N+1]; //for selected candidate
//form adj matrix
finder->adj_matr = new int*[N]; //assume filled with 0
for( i = 0 ; i < N; i++ )
@@ -220,12 +220,12 @@ void cvStartFindCliques( CvGraph* graph, CvCliqueFinder* finder, int reverse, in
finder->status = GO;
finder->best_score = 0;
}
}
void cvEndFindCliques( CvCliqueFinder* finder )
{
int i;
//int* Compsub; //current component (vertex stack)
delete finder->current_comp;
for( i = 0 ; i < finder->N; i++ )
@@ -233,25 +233,25 @@ void cvEndFindCliques( CvCliqueFinder* finder )
delete finder->All[i];
}
delete finder->All;
delete finder->ne;
delete finder->ce;
delete finder->fixp; //node with minimal disconnections
delete finder->nod;
delete finder->s; //for selected candidate
//delete adj matrix
for( i = 0 ; i < finder->N; i++ )
{
delete finder->adj_matr[i];
}
}
delete finder->adj_matr;
if(finder->weighted)
{
free(finder->vertex_weights);
free(finder->cur_weight);
free(finder->cand_weight);
free(finder->cand_weight);
}
if(finder->weighted_edges)
{
@@ -259,7 +259,7 @@ void cvEndFindCliques( CvCliqueFinder* finder )
}
}
int cvFindNextMaximalClique( CvCliqueFinder* finder )
int cvFindNextMaximalClique( CvCliqueFinder* finder )
{
int** connected = finder->adj_matr;
// int N = finder->N; //graph size
@@ -268,28 +268,28 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
int k = finder->k; //stack size
int* Compsub = finder->current_comp;
int** All = finder->All;
int* ne = finder->ne;
int* ce = finder->ce;
int* fixp = finder->fixp; //node with minimal disconnections
int* nod = finder->nod;
int* s = finder->s; //for selected candidate
int* s = finder->s; //for selected candidate
//START
while( k >= 0)
{
int* old = All[k];
switch(finder->status)
{
{
case GO://Forward step
/* we have all sets and will choose fixed point */
{
/* we have all sets and will choose fixed point */
{
//check potential size of clique
if( (!finder->weighted) && (k + ce[k] - ne[k] < finder->best_score) )
if( (!finder->weighted) && (k + ce[k] - ne[k] < finder->best_score) )
{
finder->status = BACK;
break;
}
}
//check potential weight
if( finder->weighted && !finder->weighted_edges &&
finder->cur_weight[k] + finder->cand_weight[k] < finder->best_weight )
@@ -302,33 +302,33 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
nod[k] = 0;
//for every vertex of All determine counter value and choose minimum
for( int i = 0; i < ce[k] && minnod != 0; i++)
{
for( int i = 0; i < ce[k] && minnod != 0; i++)
{
int p = old[i]; //current point
int count = 0; //counter
int pos = 0;
/* Count disconnections with candidates */
for (int j = ne[k]; j < ce[k] && (count < minnod); j++)
for (int j = ne[k]; j < ce[k] && (count < minnod); j++)
{
if ( !connected[p][old[j]] )
if ( !connected[p][old[j]] )
{
count++;
/* Save position of potential candidate */
pos = j;
}
}
/* Test new minimum */
if (count < minnod)
if (count < minnod)
{
fixp[k] = p; //set current point as fixed
minnod = count; //new value for minnod
if (i < ne[k]) //if current fixed point belongs to 'not'
{
s[k] = pos; //s - selected candidate
}
else
}
else
{
s[k] = i; //selected candidate is fixed point itself
/* preincr */
@@ -338,11 +338,11 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
}//for
nod[k] = minnod + nod[k];
finder->status = NEXT;//go to backtrackcycle
finder->status = NEXT;//go to backtrackcycle
}
break;
case NEXT:
//here we will look for candidate to translate into not
//here we will look for candidate to translate into not
//s[k] now contains index of choosen candidate
{
int* new_ = All[k+1];
@@ -355,37 +355,37 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
int newne = 0;
//fill new set 'not'
for ( i = 0; i < ne[k]; i++)
for ( i = 0; i < ne[k]; i++)
{
if (connected[sel][old[i]])
if (connected[sel][old[i]])
{
new_[newne] = old[i];
newne++;
}
}
//fill new set 'candidate'
int newce = newne;
i++;//skip selected candidate
float candweight = 0;
for (; i < ce[k]; i++)
for (; i < ce[k]; i++)
{
if (connected[sel][old[i]])
if (connected[sel][old[i]])
{
new_[newce] = old[i];
if( finder->weighted )
candweight += finder->vertex_weights[old[i]];
newce++;
if( finder->weighted )
candweight += finder->vertex_weights[old[i]];
newce++;
}
}
nod[k]--;
//add selected to stack
//add selected to stack
Compsub[k] = sel;
k++;
@@ -393,9 +393,9 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
if( finder->weighted )
{
//update weights of current clique and candidates
finder->cur_weight[k] = finder->cur_weight[k-1] + finder->vertex_weights[sel];
finder->cur_weight[k] = finder->cur_weight[k-1] + finder->vertex_weights[sel];
finder->cand_weight[k] = candweight;
}
}
if( finder->weighted_edges )
{
//update total weight by edge weights
@@ -405,8 +405,8 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
added += finder->edge_weights[ Compsub[ind] * finder->N + sel ];
}
finder->cur_weight[k] += added;
}
}
//check if 'not' and 'cand' are both empty
if( newce == 0 )
{
@@ -424,7 +424,7 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
fclose(file);
*/
//output new clique//************************
finder->status = BACK;
finder->k = k;
@@ -441,18 +441,18 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
finder->status = GO;
break;
}
}
else
else
finder->status = BACK;
}
break;
case BACK:
{
{
//decrease stack
k--;
k--;
old = All[k];
if( k < 0 ) break;
@@ -475,7 +475,7 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
}
break;
case END: assert(0);
case END: assert(0);
}
}//end while
@@ -485,7 +485,7 @@ int cvFindNextMaximalClique( CvCliqueFinder* finder )
}
void cvBronKerbosch( CvGraph* graph )
{
@@ -505,7 +505,7 @@ void cvBronKerbosch( CvGraph* graph )
int* fixp = new int[N]; //node with minimal disconnections
int* nod = new int[N];
int* s = new int[N]; //for selected candidate
//form adj matrix
int** connected = new int*[N]; //assume filled with 0
for( i = 0 ; i < N; i++ )
@@ -534,48 +534,48 @@ void cvBronKerbosch( CvGraph* graph )
{
int* old = All[k];
switch(status)
{
{
case GO://Forward step
/* we have all sets and will choose fixed point */
{
/* we have all sets and will choose fixed point */
{
if( k + ce[k] - ne[k] < best_score )
if( k + ce[k] - ne[k] < best_score )
{
status = BACK;
break;
}
}
int minnod = ce[k];
nod[k] = 0;
//for every vertex of All determine counter value and choose minimum
for( int i = 0; i < ce[k] && minnod != 0; i++)
{
for( int i = 0; i < ce[k] && minnod != 0; i++)
{
int p = old[i]; //current point
int count = 0; //counter
int pos = 0;
/* Count disconnections with candidates */
for (int j = ne[k]; j < ce[k] && (count < minnod); j++)
for (int j = ne[k]; j < ce[k] && (count < minnod); j++)
{
if ( !connected[p][old[j]] )
if ( !connected[p][old[j]] )
{
count++;
/* Save position of potential candidate */
pos = j;
}
}
/* Test new minimum */
if (count < minnod)
if (count < minnod)
{
fixp[k] = p; //set current point as fixed
minnod = count; //new value for minnod
if (i < ne[k]) //if current fixed point belongs to 'not'
{
s[k] = pos; //s - selected candidate
}
else
}
else
{
s[k] = i; //selected candidate is fixed point itself
/* preincr */
@@ -585,11 +585,11 @@ void cvBronKerbosch( CvGraph* graph )
}//for
nod[k] = minnod + nod[k];
status = NEXT;//go to backtrackcycle
status = NEXT;//go to backtrackcycle
}
break;
case NEXT:
//here we will look for candidate to translate into not
//here we will look for candidate to translate into not
//s[k] now contains index of choosen candidate
{
int* new_ = All[k+1];
@@ -602,21 +602,21 @@ void cvBronKerbosch( CvGraph* graph )
int newne = 0;
//fill new set 'not'
for ( i = 0; i < ne[k]; i++)
for ( i = 0; i < ne[k]; i++)
{
if (connected[sel][old[i]])
if (connected[sel][old[i]])
{
new_[newne] = old[i];
newne++;
}
}
//fill new set 'candidate'
int newce = newne;
i++;//skip selected candidate
for (; i < ce[k]; i++)
for (; i < ce[k]; i++)
{
if (connected[sel][old[i]])
if (connected[sel][old[i]])
{
new_[newce] = old[i];
newce++;
@@ -625,7 +625,7 @@ void cvBronKerbosch( CvGraph* graph )
nod[k]--;
//add selected to stack
//add selected to stack
Compsub[k] = sel;
k++;
@@ -664,18 +664,18 @@ void cvBronKerbosch( CvGraph* graph )
status = GO;
break;
}
}
else
else
status = BACK;
}
break;
case BACK:
{
{
//decrease stack
k--;
k--;
old = All[k];
if( k < 0 ) break;
@@ -698,7 +698,7 @@ void cvBronKerbosch( CvGraph* graph )
}
break;
}
}//end while

View File

@@ -48,10 +48,10 @@
// Kalman - double pointer to CvConDensation structure
// DP - dimension of the dynamical vector
// MP - dimension of the measurement vector
// SamplesNum - number of samples in sample set used in algorithm
// SamplesNum - number of samples in sample set used in algorithm
// Returns:
// Notes:
//
//
//F*/
CV_IMPL CvConDensation* cvCreateConDensation( int DP, int MP, int SamplesNum )
@@ -61,7 +61,7 @@ CV_IMPL CvConDensation* cvCreateConDensation( int DP, int MP, int SamplesNum )
if( DP < 0 || MP < 0 || SamplesNum < 0 )
CV_Error( CV_StsOutOfRange, "" );
/* allocating memory for the structure */
CD = (CvConDensation *) cvAlloc( sizeof( CvConDensation ));
/* setting structure params */
@@ -103,16 +103,16 @@ CV_IMPL CvConDensation* cvCreateConDensation( int DP, int MP, int SamplesNum )
// Kalman - double pointer to CvConDensation structure
// DP - dimension of the dynamical vector
// MP - dimension of the measurement vector
// SamplesNum - number of samples in sample set used in algorithm
// SamplesNum - number of samples in sample set used in algorithm
// Returns:
// Notes:
//
//
//F*/
CV_IMPL void
cvReleaseConDensation( CvConDensation ** ConDensation )
{
CvConDensation *CD = *ConDensation;
if( !ConDensation )
CV_Error( CV_StsNullPtr, "" );
@@ -120,7 +120,7 @@ cvReleaseConDensation( CvConDensation ** ConDensation )
return;
/* freeing the memory */
cvFree( &CD->State );
cvFree( &CD->State );
cvFree( &CD->DynamMatr);
cvFree( &CD->flConfidence );
cvFree( &CD->flCumulative );
@@ -143,7 +143,7 @@ cvReleaseConDensation( CvConDensation ** ConDensation )
// Kalman - pointer to CvConDensation structure
// Returns:
// Notes:
//
//
//F*/
CV_IMPL void
cvConDensUpdateByTime( CvConDensation * ConDens )
@@ -210,7 +210,7 @@ cvConDensUpdateByTime( CvConDensation * ConDens )
// lowerBound - vector of upper bounds used to random update of sample set
// Returns:
// Notes:
//
//
//F*/
CV_IMPL void

View File

@@ -43,7 +43,7 @@
#define _CV_BINTREE_LIST() \
struct _CvTrianAttr* prev_v; /* pointer to the parent element on the previous level of the tree */ \
struct _CvTrianAttr* next_v1; /* pointer to the child element on the next level of the tree */ \
struct _CvTrianAttr* next_v2; /* pointer to the child element on the next level of the tree */
struct _CvTrianAttr* next_v2; /* pointer to the child element on the next level of the tree */
typedef struct _CvTrianAttr
{
@@ -71,13 +71,13 @@ icvCalcTriAttr( const CvSeq * contour, CvPoint t2, CvPoint t1, int n1,
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: icvCreateContourTree
// Purpose:
// Create binary tree representation for the contour
// Create binary tree representation for the contour
// Context:
// Parameters:
// contour - pointer to input contour object.
// storage - pointer to the current storage block
// tree - output pointer to the binary tree representation
// threshold - threshold for the binary tree building
// tree - output pointer to the binary tree representation
// threshold - threshold for the binary tree building
//
//F*/
static CvStatus
@@ -604,7 +604,7 @@ icvCreateContourTree( const CvSeq * contour, CvMemStorage * storage,
/****************************************************************************************\
triangle attributes calculations
triangle attributes calculations
\****************************************************************************************/
static CvStatus
@@ -651,20 +651,20 @@ icvCalcTriAttr( const CvSeq * contour, CvPoint t2, CvPoint t1, int n1,
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCreateContourTree
// Purpose:
// Create binary tree representation for the contour
// Create binary tree representation for the contour
// Context:
// Parameters:
// contour - pointer to input contour object.
// storage - pointer to the current storage block
// tree - output pointer to the binary tree representation
// threshold - threshold for the binary tree building
// tree - output pointer to the binary tree representation
// threshold - threshold for the binary tree building
//
//F*/
CV_IMPL CvContourTree*
cvCreateContourTree( const CvSeq* contour, CvMemStorage* storage, double threshold )
{
CvContourTree* tree = 0;
IPPI_CALL( icvCreateContourTree( contour, storage, &tree, threshold ));
return tree;
@@ -674,10 +674,10 @@ cvCreateContourTree( const CvSeq* contour, CvMemStorage* storage, double thresho
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: icvContourFromContourTree
// Purpose:
// reconstracts contour from binary tree representation
// reconstracts contour from binary tree representation
// Context:
// Parameters:
// tree - pointer to the input binary tree representation
// tree - pointer to the input binary tree representation
// storage - pointer to the current storage block
// contour - pointer to output contour object.
// criteria - criteria for the definition threshold value
@@ -803,8 +803,8 @@ cvContourFromContourTree( const CvContourTree* tree,
// tree2 - pointer to the second input contour tree object.
// method - method for the matching calculation
// (now CV_CONTOUR_TREES_MATCH_I1 only )
// threshold - threshold for the contour trees matching
// result - output calculated measure
// threshold - threshold for the contour trees matching
// result - output calculated measure
//F*/
CV_IMPL double
cvMatchContourTrees( const CvContourTree* tree1, const CvContourTree* tree2,

View File

@@ -377,11 +377,11 @@ icvDynamicCorrespondMulti( int lines, /* number of scanlines */
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvDynamicCorrespondMulti
// Purpose: The functions
// Purpose: The functions
// Context:
// Parameters:
// Parameters:
//
// Notes:
// Notes:
//F*/
CV_IMPL void
cvDynamicCorrespondMulti( int lines, /* number of scanlines */

View File

@@ -103,13 +103,13 @@ static CvStatus icvCreateHandMask8uC1R(CvSeq * numbers,
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCreateHandMask
// Purpose: creates hand mask image
// Context:
// Parameters:
// Context:
// Parameters:
// numbers - pointer to the input sequence of the point's indexes inside
// hand region
// img_mask - pointer to the result mask image
// roi - result hand mask ROI
//
// hand region
// img_mask - pointer to the result mask image
// roi - result hand mask ROI
//
// Notes:
//F*/
CV_IMPL void

View File

@@ -226,7 +226,7 @@ bool icvEarCutTriangulation( CvPoint* contour,
if( t2 > ZERO_CLOSE && t2 < ONE_CLOSE ) {
isInternal = 0;
}
} // if( t1 > ZERO_CLOSE && t1 < ONE_CLOSE )
} // if( det != 0.0f )
@@ -541,7 +541,7 @@ void cvDecompPoly( CvContour* cont,
CvSeqReader reader;
CvPoint2D32f pnt;
CvQuadEdge2D* quadEdge;
numVtx = cont -> total;
if( numVtx < 3 ) {
return;

View File

@@ -334,14 +334,14 @@ icvFindDominantPointsIPAN( CvSeq * contour,
// Name: icvFindDominantPoints
// Purpose:
// Applies some algorithm to find dominant points ( corners ) of contour
//
//
// Context:
// Parameters:
// contours - pointer to input contour object.
// out_numbers - array of dominant points indices
// count - length of out_numbers array on input
// and numbers of founded dominant points on output
//
// and numbers of founded dominant points on output
//
// method - only CV_DOMINANT_IPAN now
// parameters - array of parameters
// for IPAN algorithm
@@ -352,7 +352,7 @@ icvFindDominantPointsIPAN( CvSeq * contour,
// Returns:
// CV_OK or error code
// Notes:
// User must allocate out_numbers array. If it is small - function fills array
// User must allocate out_numbers array. If it is small - function fills array
// with part of points and returns error
//F*/
CV_IMPL CvSeq*

View File

@@ -490,7 +490,7 @@ int makeHelpGraph( CvGraph* graph,
graphEdge = graphEdge -> next[ ofs ];
} /* while( graphEdge ) */
} /* while( orderCount != orderFirst ) */
int i;
@@ -836,7 +836,7 @@ void makePseudoMaxFlow( CvGraph* graph,
- ( ( Edge* )hlpGraphEdge ) -> flow;
delta = CV_MIN2( cargo[ v ], delta );
(( ( Edge* )hlpGraphEdge ) -> flow) += delta;
cargo[ v ] -= delta;
@@ -1162,7 +1162,7 @@ void CCvGraphCutMorpher::Morph( unsigned char* _leftImage,
int* result;
int number;
float alpha1 = 1.0f - alpha;
for( lineNumber = 0; lineNumber < height; lineNumber ++ )
{
leftTemp = leftArray + leftLineSize * lineNumber;
@@ -1172,7 +1172,7 @@ void CCvGraphCutMorpher::Morph( unsigned char* _leftImage,
result = _corrArray + width * lineNumber;
number = width;
prevLeftPixel = 0;
prevRightPixel = prevLeftPixel + result[ 0 ];
if( prevRightPixel >= width ) {
@@ -1198,7 +1198,7 @@ void CCvGraphCutMorpher::Morph( unsigned char* _leftImage,
leftPixel3 = leftPixel * 3;
middlePixel3 = middlePixel * 3;
rightPixel3 = rightPixel * 3;
if( imageNeed == morphDepthMap ) {
int t = leftPixel - rightPixel + maxDifference;
t = t < 0 ? -t : t;
@@ -1253,7 +1253,7 @@ void CCvGraphCutMorpher::Morph( unsigned char* _leftImage,
rightTemp[ tempIndex * 3 + 2 ];
}
} // if( leftPixel - prevLeftPixel > 1 ) else
} // if( middlePixel - prevMiddlePixel > 1 )
} // if( imageNeed == morphDepthMap ) else
@@ -1266,7 +1266,7 @@ void CCvGraphCutMorpher::Morph( unsigned char* _leftImage,
prevMiddlePixel = middlePixel;
}
} // for( i = number - 1; i >= 0; i -- )
} // for( lineNumber = 0; lineNumber < LeftImage -> m_Raster -> GetHeight() )
} // Morph

View File

@@ -49,24 +49,24 @@ Face::Face(FaceTemplate * lpFaceTemplate)
{
//init number of face elements;
m_lFaceFeaturesNumber = lpFaceTemplate->GetCount();
//init array of numbers of foundet face elements of each type
m_lplFaceFeaturesCount = new long[m_lFaceFeaturesNumber];
m_lplFaceFeaturesCount = new long[m_lFaceFeaturesNumber];
memset(m_lplFaceFeaturesCount,0,m_lFaceFeaturesNumber*sizeof(long));
//init array of ideal face features
m_lpIdealFace = new FaceFeature[m_lFaceFeaturesNumber];
//init array of founded features
m_lppFoundedFaceFeatures = new FaceFeature*[m_lFaceFeaturesNumber];
for (int i = 0;i < m_lFaceFeaturesNumber;i ++)
{
m_lppFoundedFaceFeatures[i] = (new FaceFeature[3*MAX_LAYERS]);
}
//set start weight 0
m_dWeight = 0;
m_dWeight = 0;
}//Face::Face(FaceTemplate * lpFaceTemplate)
@@ -77,8 +77,8 @@ Face::~Face()
delete [] (m_lppFoundedFaceFeatures[i]);
}
delete [] m_lppFoundedFaceFeatures;
delete [] m_lplFaceFeaturesCount;
delete [] m_lpIdealFace;
@@ -90,19 +90,19 @@ Face::~Face()
////////////
//class RFace(rect based face)
//class RFace(rect based face)
////////////
RFace::RFace(FaceTemplate * lpFaceTemplate):Face(lpFaceTemplate)
{
//init ideal face
FaceFeature * lpTmp = lpFaceTemplate->GetFeatures();
for (int j = 0;j < m_lFaceFeaturesNumber;j ++)
{
CvRect * lpTmpRect = NULL;
lpTmpRect = new CvRect;
*lpTmpRect = *(CvRect*)lpTmp[j].GetContour();
*lpTmpRect = *(CvRect*)lpTmp[j].GetContour();
m_lpIdealFace[j].SetContour( lpTmpRect );
m_lpIdealFace[j].SetWeight( lpTmp[j].GetWeight() );
m_lpIdealFace[j].SetFeature( lpTmp[j].isFaceFeature() );
@@ -133,16 +133,16 @@ double RFace::GetWeight()
bool RFace::CheckElem(void * lpCandidat,void * lpIdeal)
{
CvRect IdealRect = *(CvRect*)lpIdeal;
CvRect Rect = *(CvRect*)lpCandidat;
if (Rect.height > Rect.width)
return false;
long SizeIdeal = IdealRect.width*IdealRect.height;
long Size = Rect.width*Rect.height;
if ( (Size > SizeIdeal) || ( Size < (SizeIdeal/5) ) )
return false;
@@ -151,23 +151,23 @@ bool RFace::CheckElem(void * lpCandidat,void * lpIdeal)
// ResizeRect(IdealRect,&UpRect,UP_SCALE,7);
// ResizeRect(IdealRect,&DownRect,DOWN_SCALE,7);
long x = Rect.x + cvRound(Rect.width/2);
long x = Rect.x + cvRound(Rect.width/2);
long y = Rect.y + cvRound(Rect.height/2);
if ( isPointInRect(cvPoint(x,y),IdealRect) )
return true;
// if ( isPointInRect(cvPoint(Rect.x,Rect.y),UpRect) &&
// if ( isPointInRect(cvPoint(Rect.x,Rect.y),UpRect) &&
// isPointInRect(cvPoint(Rect.x + Rect.width,Rect.y + Rect.height),UpRect ) &&
// isPointInRect(cvPoint(DownRect.x,DownRect.y),Rect) &&
// isPointInRect(cvPoint(DownRect.x + DownRect.width,DownRect.y + DownRect.height),Rect) )
// return true;
// if ( isPointInRect(cvPoint(Rect.x,Rect.y),IdealRect) &&
// if ( isPointInRect(cvPoint(Rect.x,Rect.y),IdealRect) &&
// isPointInRect(cvPoint(Rect.x + Rect.width,Rect.y + Rect.height),IdealRect ) )
// return true;
return false;
}//inline bool RFace::CheckElem(CvRect rect)
@@ -178,21 +178,21 @@ void RFace::CalculateError(FaceData * lpFaceData)
CvRect LeftEyeRect = lpFaceData->LeftEyeRect;
CvRect RightEyeRect = lpFaceData->RightEyeRect;
CvRect MouthRect = lpFaceData->MouthRect;
long LeftSquare = LeftEyeRect.width*LeftEyeRect.height;
long RightSquare = RightEyeRect.width*RightEyeRect.height;
long dy = LeftEyeRect.y - RightEyeRect.y;
long dx1 = LeftEyeRect.x + LeftEyeRect.width/2 - MouthRect.x;
long dx2 = RightEyeRect.x + RightEyeRect.width/2 - MouthRect.x - MouthRect.width;
lpFaceData->Error = (double)(LeftSquare - RightSquare)*(double)(LeftSquare - RightSquare)/((double)(LeftSquare + RightSquare)*(LeftSquare + RightSquare)) +
(double)(dy*dy)/((double)(LeftEyeRect.height + RightEyeRect.height)*(LeftEyeRect.height + RightEyeRect.height)) +
(double)(dx1*dx1)/((double)MouthRect.width*MouthRect.width) +
lpFaceData->Error = (double)(LeftSquare - RightSquare)*(double)(LeftSquare - RightSquare)/((double)(LeftSquare + RightSquare)*(LeftSquare + RightSquare)) +
(double)(dy*dy)/((double)(LeftEyeRect.height + RightEyeRect.height)*(LeftEyeRect.height + RightEyeRect.height)) +
(double)(dx1*dx1)/((double)MouthRect.width*MouthRect.width) +
(double)(dx2*dx2)/((double)MouthRect.width*MouthRect.width);
}//void RFace::CalculateError(FaceData * lpFaceData)
#define MAX_ERROR 0xFFFFFFFF
@@ -200,23 +200,23 @@ void RFace::CalculateError(FaceData * lpFaceData)
void RFace::CreateFace(void * lpData)
{
FaceData Data;
double Error = MAX_ERROR;
double CurError = MAX_ERROR;
FaceData * lpFaceData = (FaceData*)lpData;
int im = 0;//mouth was find
int jl = 0;//left eye was find
int kr = 0;//right eye was find
long MouthNumber = 0;
long LeftEyeNumber = 0;
long RightEyeNumber = 0;
for (int i = 0;i < m_lplFaceFeaturesCount[0] + 1;i ++)
{
if ( !m_lplFaceFeaturesCount[0] )
Data.MouthRect = *(CvRect*)m_lpIdealFace[0].GetContour();
else
@@ -225,11 +225,11 @@ void RFace::CreateFace(void * lpData)
Data.MouthRect = *(CvRect*)m_lppFoundedFaceFeatures[0][i].GetContour();
im = 1;
}
for (int j = 0;j < m_lplFaceFeaturesCount[1] + 1;j ++)
{
if ( !m_lplFaceFeaturesCount[1] )
Data.LeftEyeRect = *(CvRect*)m_lpIdealFace[1].GetContour();
else
@@ -238,8 +238,8 @@ void RFace::CreateFace(void * lpData)
Data.LeftEyeRect = *(CvRect*)m_lppFoundedFaceFeatures[1][j].GetContour();
jl = 1;
}
for (int k = 0;k < m_lplFaceFeaturesCount[2] + 1;k ++)
{
@@ -251,15 +251,15 @@ void RFace::CreateFace(void * lpData)
Data.RightEyeRect = *(CvRect*)m_lppFoundedFaceFeatures[2][k].GetContour();
kr = 1;
}
CalculateError(&Data);
CalculateError(&Data);
if ( (im + jl + kr) )
{
Error = Data.Error/(im + jl + kr);
}else
Error = MAX_ERROR;
if (CurError > Error)
{
CurError = Error;
@@ -269,8 +269,8 @@ void RFace::CreateFace(void * lpData)
}
}
}
}
@@ -284,7 +284,7 @@ void RFace::CreateFace(void * lpData)
lpFaceData->LeftEyeRect = *(CvRect*)m_lppFoundedFaceFeatures[1][LeftEyeNumber].GetContour();
else
lpFaceData->LeftEyeRect = *(CvRect*)m_lpIdealFace[1].GetContour();
if ( m_lplFaceFeaturesCount[2] )
lpFaceData->RightEyeRect = *(CvRect*)m_lppFoundedFaceFeatures[2][RightEyeNumber].GetContour();
else
@@ -342,7 +342,7 @@ inline void RFace::ResizeRect(CvRect Rect,CvRect * lpRect,long lDir,long lD)
lpRect->width = Rect.width - 2*lD;
}else
lpRect->width = 0;
if (Rect.height - 2*lD >= 0)
{
lpRect->height = Rect.height - 2*lD;

View File

@@ -52,84 +52,84 @@
class Face
{
public:
Face(FaceTemplate * lpFaceTemplate);
virtual ~Face();
inline bool isFeature(void * lpElem);
virtual void Show(IplImage * /*Image*/){};
virtual void ShowIdeal(IplImage* /*Image*/){};
virtual void CreateFace(void * lpData) = 0;
virtual bool CheckElem(void * lpCandidat,void * lpIdeal) = 0;
virtual double GetWeight() = 0;
Face(FaceTemplate * lpFaceTemplate);
virtual ~Face();
inline bool isFeature(void * lpElem);
virtual void Show(IplImage * /*Image*/){};
virtual void ShowIdeal(IplImage* /*Image*/){};
virtual void CreateFace(void * lpData) = 0;
virtual bool CheckElem(void * lpCandidat,void * lpIdeal) = 0;
virtual double GetWeight() = 0;
protected:
FaceFeature * m_lpIdealFace; // Ideal face definition.
long m_lFaceFeaturesNumber; // Total number of different face features .
long * m_lplFaceFeaturesCount; // Count of each feature found on this face.
FaceFeature ** m_lppFoundedFaceFeatures; // Features found on current face.
double m_dWeight;
FaceFeature * m_lpIdealFace; // Ideal face definition.
long m_lFaceFeaturesNumber; // Total number of different face features .
long * m_lplFaceFeaturesCount; // Count of each feature found on this face.
FaceFeature ** m_lppFoundedFaceFeatures; // Features found on current face.
double m_dWeight;
};
inline bool Face::isFeature(void * lpElem)
{
for (int i = 0;i < m_lFaceFeaturesNumber;i ++)
{
void * lpIdeal = m_lpIdealFace[i].GetContour();
if ( CheckElem( lpElem,lpIdeal) )
{
if (m_lplFaceFeaturesCount[i] < 3*MAX_LAYERS)
{
double dWeight = m_lpIdealFace[i].GetWeight();
bool bIsFeature = m_lpIdealFace[i].isFaceFeature();
if (bIsFeature)
{
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetWeight(dWeight);
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetContour(lpElem);
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetFeature(bIsFeature);
m_lplFaceFeaturesCount[i] ++;
}
m_dWeight += dWeight;
if (bIsFeature)
return true;
}
}
}
for (int i = 0;i < m_lFaceFeaturesNumber;i ++)
{
void * lpIdeal = m_lpIdealFace[i].GetContour();
return false;
if ( CheckElem( lpElem,lpIdeal) )
{
if (m_lplFaceFeaturesCount[i] < 3*MAX_LAYERS)
{
double dWeight = m_lpIdealFace[i].GetWeight();
bool bIsFeature = m_lpIdealFace[i].isFaceFeature();
if (bIsFeature)
{
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetWeight(dWeight);
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetContour(lpElem);
m_lppFoundedFaceFeatures[i][m_lplFaceFeaturesCount[i]].SetFeature(bIsFeature);
m_lplFaceFeaturesCount[i] ++;
}
m_dWeight += dWeight;
if (bIsFeature)
return true;
}
}
}
return false;
}//inline bool RFace::isFeature(void * lpElem);
struct FaceData
{
CvRect LeftEyeRect;
CvRect RightEyeRect;
CvRect MouthRect;
double Error;
CvRect LeftEyeRect;
CvRect RightEyeRect;
CvRect MouthRect;
double Error;
};//struct FaceData
class RFace:public Face
{
public:
RFace(FaceTemplate * lpFaceTemplate);
virtual ~RFace();
virtual bool CheckElem(void * lpCandidat,void * lpIdeal);
virtual void CreateFace(void * lpData);
virtual void Show(IplImage* Image);
virtual void ShowIdeal(IplImage* Image);
virtual double GetWeight();
RFace(FaceTemplate * lpFaceTemplate);
virtual ~RFace();
virtual bool CheckElem(void * lpCandidat,void * lpIdeal);
virtual void CreateFace(void * lpData);
virtual void Show(IplImage* Image);
virtual void ShowIdeal(IplImage* Image);
virtual double GetWeight();
private:
bool isPointInRect(CvPoint p,CvRect rect);
bool m_bIsGenerated;
void ResizeRect(CvRect Rect,CvRect * lpRect,long lDir,long lD);
void CalculateError(FaceData * lpFaceData);
};
bool isPointInRect(CvPoint p,CvRect rect);
bool m_bIsGenerated;
void ResizeRect(CvRect Rect,CvRect * lpRect,long lDir,long lD);
void CalculateError(FaceData * lpFaceData);
};
#endif //__FACE_H__

View File

@@ -11,14 +11,14 @@
typedef struct CvContourRect
{
int iNumber; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iType; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iFlags; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
CvSeq *seqContour; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iContourLength; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CvRect r; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CvPoint pCenter; // center of rect
int iColor;// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iNumber; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iType; //<2F><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iFlags; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
CvSeq *seqContour; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int iContourLength; //<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CvRect r; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CvPoint pCenter; // center of rect
int iColor;// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
} CvContourRect;
//class Face;
@@ -26,64 +26,64 @@ typedef struct CvContourRect
class ListElem
{
public:
ListElem();
ListElem(Face * pFace,ListElem * pHead);
virtual ~ListElem();
ListElem * m_pNext;
ListElem * m_pPrev;
Face * m_pFace;
ListElem();
ListElem(Face * pFace,ListElem * pHead);
virtual ~ListElem();
ListElem * m_pNext;
ListElem * m_pPrev;
Face * m_pFace;
};//class ListElem
class List
{
public:
List();
int AddElem(Face * pFace);
virtual ~List();
Face* GetData();
List();
int AddElem(Face * pFace);
virtual ~List();
Face* GetData();
long m_FacesCount;
private:
ListElem * m_pHead;
ListElem * m_pCurElem;
ListElem * m_pHead;
ListElem * m_pCurElem;
};//class List
class FaceDetection
class FaceDetection
{
public:
void FindFace(IplImage* img);
void CreateResults(CvSeq * lpSeq);
FaceDetection();
virtual ~FaceDetection();
void SetBoosting(bool bBoosting) {m_bBoosting = bBoosting;}
bool isPostBoosting() {return m_bBoosting;}
void FindFace(IplImage* img);
void CreateResults(CvSeq * lpSeq);
FaceDetection();
virtual ~FaceDetection();
void SetBoosting(bool bBoosting) {m_bBoosting = bBoosting;}
bool isPostBoosting() {return m_bBoosting;}
protected:
IplImage* m_imgGray;
IplImage* m_imgThresh;
int m_iNumLayers;
CvMemStorage* m_mstgContours;
CvSeq* m_seqContours[MAX_LAYERS];
CvMemStorage* m_mstgRects;
CvSeq* m_seqRects;
bool m_bBoosting;
List * m_pFaceList;
IplImage* m_imgGray;
IplImage* m_imgThresh;
int m_iNumLayers;
CvMemStorage* m_mstgContours;
CvSeq* m_seqContours[MAX_LAYERS];
CvMemStorage* m_mstgRects;
CvSeq* m_seqRects;
bool m_bBoosting;
List * m_pFaceList;
protected:
void ResetImage();
void FindContours(IplImage* imgGray);
void AddContours2Rect(CvSeq* seq, int color, int iLayer);
void ThresholdingParam(IplImage* imgGray, int iNumLayers, int& iMinLevel, int& iMaxLevel, int& iStep);
void FindCandidats();
void PostBoostingFindCandidats(IplImage * FaceImage);
void ResetImage();
void FindContours(IplImage* imgGray);
void AddContours2Rect(CvSeq* seq, int color, int iLayer);
void ThresholdingParam(IplImage* imgGray, int iNumLayers, int& iMinLevel, int& iMaxLevel, int& iStep);
void FindCandidats();
void PostBoostingFindCandidats(IplImage * FaceImage);
};
inline void ReallocImage(IplImage** ppImage, CvSize sz, long lChNum)
{
IplImage* pImage;
if( ppImage == NULL )
return;
if( ppImage == NULL )
return;
pImage = *ppImage;
if( pImage != NULL )
{

View File

@@ -82,5 +82,5 @@ FaceTemplate::~FaceTemplate()
MouthFaceTemplate::~MouthFaceTemplate()
{
}//RFaceTemplate::~RFaceTemplate()

View File

@@ -48,49 +48,49 @@
class FaceFeature
{
public:
FaceFeature(double dWeight,void * lpContour,bool bIsFeature);
FaceFeature();
virtual ~FaceFeature();
inline bool isFaceFeature();
inline void * GetContour();
inline double GetWeight();
inline void SetContour(void * lpContour);
inline void SetWeight(double dWeight);
inline void SetFeature(bool bIsFeature);
FaceFeature(double dWeight,void * lpContour,bool bIsFeature);
FaceFeature();
virtual ~FaceFeature();
inline bool isFaceFeature();
inline void * GetContour();
inline double GetWeight();
inline void SetContour(void * lpContour);
inline void SetWeight(double dWeight);
inline void SetFeature(bool bIsFeature);
private:
double m_dWeight;
void * m_lpContour;
bool m_bIsFaceFeature;
double m_dWeight;
void * m_lpContour;
bool m_bIsFaceFeature;
};//class FaceFeature
inline void FaceFeature::SetFeature(bool bIsFeature)
{
m_bIsFaceFeature = bIsFeature;
m_bIsFaceFeature = bIsFeature;
}
inline bool FaceFeature::isFaceFeature()
{
return m_bIsFaceFeature;
return m_bIsFaceFeature;
}//inline bool FaceFeature::isFaceFeature()
inline void * FaceFeature::GetContour()
{
return m_lpContour;
return m_lpContour;
}//inline void * FaceFeature::GetContour()
inline double FaceFeature::GetWeight()
{
return m_dWeight;
return m_dWeight;
}//inline long FaceFeature::GetWeight()
inline void FaceFeature::SetContour(void * lpContour)
{
m_lpContour = lpContour;
m_lpContour = lpContour;
}//inline void FaceFeature::SetContour(void * lpContour)
inline void FaceFeature::SetWeight(double dWeight)
{
m_dWeight = dWeight;
m_dWeight = dWeight;
}//inline void FaceFeature::SetWeight(double * dWeight)
@@ -98,28 +98,28 @@ inline void FaceFeature::SetWeight(double dWeight)
class FaceTemplate
{
public:
FaceTemplate(long lFeatureCount) {m_lFeturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];};
virtual ~FaceTemplate();
inline long GetCount();
inline FaceFeature * GetFeatures();
FaceTemplate(long lFeatureCount) {m_lFeturesCount = lFeatureCount; m_lpFeaturesList = new FaceFeature[lFeatureCount];};
virtual ~FaceTemplate();
inline long GetCount();
inline FaceFeature * GetFeatures();
protected:
FaceFeature * m_lpFeaturesList;
FaceFeature * m_lpFeaturesList;
private:
long m_lFeturesCount;
long m_lFeturesCount;
};//class FaceTemplate
inline long FaceTemplate::GetCount()
{
return m_lFeturesCount;
return m_lFeturesCount;
}//inline long FaceTemplate::GetCount()
inline FaceFeature * FaceTemplate::GetFeatures()
{
return m_lpFeaturesList;
return m_lpFeaturesList;
}//inline FaceFeature * FaceTemplate::GetFeatures()
////////////
@@ -129,57 +129,57 @@ inline FaceFeature * FaceTemplate::GetFeatures()
class MouthFaceTemplate:public FaceTemplate
{
public:
inline MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,double dDistanceBetweenEye,double dDistanceEyeAboveMouth);
~MouthFaceTemplate();
inline MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,double dDistanceBetweenEye,double dDistanceEyeAboveMouth);
~MouthFaceTemplate();
};//class MouthFaceTemplate:public FaceTemplate
inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEyeWidth,double dEyeHeight,
double dDistanceBetweenEye,double dDistanceEyeAboveMouth):FaceTemplate(lNumber)
double dDistanceBetweenEye,double dDistanceEyeAboveMouth):FaceTemplate(lNumber)
{
CvRect MouthRect = rect;
CvRect LeftEyeRect = cvRect(cvRound(rect.x - (dEyeWidth + dDistanceBetweenEye/(double)2 - (double)rect.width/(double)2)),
cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
cvRound(dEyeWidth),
cvRound(dEyeHeight) );
CvRect RightEyeRect = cvRect(cvRound(rect.x + (double)rect.width/(double)2 + dDistanceBetweenEye/(double)2),
cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
cvRound(dEyeWidth),
cvRound(dEyeHeight) );
CvRect MouthRect = rect;
CvRect LeftEyeRect = cvRect(cvRound(rect.x - (dEyeWidth + dDistanceBetweenEye/(double)2 - (double)rect.width/(double)2)),
cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
cvRound(dEyeWidth),
cvRound(dEyeHeight) );
CvRect RightEyeRect = cvRect(cvRound(rect.x + (double)rect.width/(double)2 + dDistanceBetweenEye/(double)2),
cvRound(rect.y - dDistanceEyeAboveMouth - dEyeHeight),
cvRound(dEyeWidth),
cvRound(dEyeHeight) );
// CvRect NoseRect = cvRect(cvRound(rect.x + (double)rect.width/(double)4),
// cvRound(rect.y - (double)rect.width/(double)2 - (double)rect.height/(double)4),
// cvRound((double)rect.width/(double)2),
// cvRound((double)rect.width/(double)2) );
/*
CvRect CheenRect = cvRect(rect.x,rect.y + 3*rect.height/2,rect.width,rect.height);
*/
CvRect * lpMouthRect = new CvRect();
*lpMouthRect = MouthRect;
m_lpFeaturesList[0].SetContour(lpMouthRect);
m_lpFeaturesList[0].SetWeight(1);
m_lpFeaturesList[0].SetFeature(false);
/*
CvRect CheenRect = cvRect(rect.x,rect.y + 3*rect.height/2,rect.width,rect.height);
*/
CvRect * lpMouthRect = new CvRect();
*lpMouthRect = MouthRect;
m_lpFeaturesList[0].SetContour(lpMouthRect);
m_lpFeaturesList[0].SetWeight(1);
m_lpFeaturesList[0].SetFeature(false);
CvRect * lpLeftEyeRect = new CvRect();
*lpLeftEyeRect = LeftEyeRect;
m_lpFeaturesList[1].SetContour(lpLeftEyeRect);
m_lpFeaturesList[1].SetWeight(1);
m_lpFeaturesList[1].SetFeature(true);
CvRect * lpLeftEyeRect = new CvRect();
*lpLeftEyeRect = LeftEyeRect;
m_lpFeaturesList[1].SetContour(lpLeftEyeRect);
m_lpFeaturesList[1].SetWeight(1);
m_lpFeaturesList[1].SetFeature(true);
CvRect * lpRightEyeRect = new CvRect();
*lpRightEyeRect = RightEyeRect;
m_lpFeaturesList[2].SetContour(lpRightEyeRect);
m_lpFeaturesList[2].SetWeight(1);
m_lpFeaturesList[2].SetFeature(true);
CvRect * lpRightEyeRect = new CvRect();
*lpRightEyeRect = RightEyeRect;
m_lpFeaturesList[2].SetContour(lpRightEyeRect);
m_lpFeaturesList[2].SetWeight(1);
m_lpFeaturesList[2].SetFeature(true);
// CvRect * lpNoseRect = new CvRect();
// *lpNoseRect = NoseRect;
// m_lpFeaturesList[3].SetContour(lpNoseRect);
@@ -187,10 +187,10 @@ inline MouthFaceTemplate::MouthFaceTemplate(long lNumber,CvRect rect,double dEye
// m_lpFeaturesList[3].SetFeature(true);
/* CvRect * lpCheenRect = new CvRect();
*lpCheenRect = CheenRect;
m_lpFeaturesList[4].SetContour(lpCheenRect);
m_lpFeaturesList[4].SetWeight(1);
m_lpFeaturesList[4].SetFeature(false);
*lpCheenRect = CheenRect;
m_lpFeaturesList[4].SetContour(lpCheenRect);
m_lpFeaturesList[4].SetWeight(1);
m_lpFeaturesList[4].SetFeature(false);
*/

View File

@@ -62,7 +62,7 @@ CvSeq * cvPostBoostingFindFace(IplImage * Image,CvMemStorage* lpStorage)
FD.FindFace(Image);
CvSeq * lpSeq = cvCreateSeq(0,sizeof(*lpSeq),sizeof(CvFace),lpStorage);
FD.CreateResults(lpSeq);
return lpSeq;
}//cvPostBoostingFindFace(IplImage * Image)

View File

@@ -46,7 +46,7 @@
/****************************************************************************************\
find region where hand is (for gesture recognition)
flag = 0 (use left bucket) flag = 1 (use right bucket)
flag = 0 (use left bucket) flag = 1 (use right bucket)
\****************************************************************************************/
@@ -66,7 +66,7 @@ icvFindHandRegion( CvPoint3D32f * points, int count,
CvStatus status;
int nbins = 20, i, l, i_point, left, right;
int *bin_counts = 0; // pointer to the point's counter in the bickets
int low_count; // low threshold
int low_count; // low threshold
CvPoint *tmp_number = 0, *pt;
float value, vmin, vmax, vl, bsize, vc;
@@ -136,7 +136,7 @@ icvFindHandRegion( CvPoint3D32f * points, int count,
i_point = 0;
for( i = 0; i < count; i++ )
{
/*
/*
icvSubVector_32f ((IppmVect32f )&points[i], (IppmVect32f )&line[3], sub, 3);
icvCrossProduct2L_32f ((IppmVect32f )&line[0], sub, cros);
@@ -288,7 +288,7 @@ icvFindHandRegionA( CvPoint3D32f * points, int count,
int *bin_counts = 0; // pointer to the point's counter in the bickets
// int *bin_countsj = 0; // pointer to the index's counter in the bickets
int low_count; // low threshold
int low_count; // low threshold
CvPoint *tmp_number = 0, *pt;
float value, vmin, vmax, vl, bsize, bsizej, vc, vcl, vcr;
@@ -341,7 +341,7 @@ icvFindHandRegionA( CvPoint3D32f * points, int count,
memset( bin_counts, 0, nbins * sizeof( int ));
/* alloc memory for the point's counter in the bickets */
// bin_countsj = (int*) icvAlloc(nbins*sizeof(int));
// bin_countsj = (int*) icvAlloc(nbins*sizeof(int));
// if(bin_countsj == NULL) {status = CV_OUTOFMEM_ERR; goto M_END;}
// memset(bin_countsj,0,nbins*sizeof(int));
@@ -395,7 +395,7 @@ icvFindHandRegionA( CvPoint3D32f * points, int count,
icvDotProduct_32f( sub, &line[0], 3, &value);
if(value > vmax) vmax = value;
if(value < vmin) vmin = value;
vv[i_point] = value;
pt = (CvPoint* )icvGetSeqElem ( indexs, i, 0);
@@ -406,7 +406,7 @@ icvFindHandRegionA( CvPoint3D32f * points, int count,
tmp_number[i_point] = *pt;
i_point++;
}
else
else
*/
{
if( _CV_NORM_L32( a ) < threshold2 )
@@ -572,20 +572,20 @@ icvFindHandRegionA( CvPoint3D32f * points, int count,
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvFindHandRegion
// Purpose: finds hand region in range image data
// Context:
// Parameters:
// Context:
// Parameters:
// points - pointer to the input point's set.
// count - the number of the input points.
// indexs - pointer to the input sequence of the point's indexes
// line - pointer to the 3D-line
// size - size of the hand in meters
// flag - hand direction's flag (0 - left, -1 - right,
// size - size of the hand in meters
// flag - hand direction's flag (0 - left, -1 - right,
// otherwise j-index of the initial image center)
// center - pointer to the output hand center
// storage - pointer to the memory storage
// storage - pointer to the memory storage
// numbers - pointer to the output sequence of the point's indexes inside
// hand region
//
// hand region
//
// Notes:
//F*/
CV_IMPL void
@@ -595,31 +595,31 @@ cvFindHandRegion( CvPoint3D32f * points, int count,
CvPoint3D32f * center, CvMemStorage * storage, CvSeq ** numbers )
{
if(flag == 0 || flag == -1)
{
IPPI_CALL( icvFindHandRegion( points, count, indexs, line, size, -flag,
center, storage, numbers ));
}
else
IPPI_CALL( icvFindHandRegionA( points, count, indexs, line, size, flag,
center, storage, numbers ));
{
IPPI_CALL( icvFindHandRegion( points, count, indexs, line, size, -flag,
center, storage, numbers ));
}
else
IPPI_CALL( icvFindHandRegionA( points, count, indexs, line, size, flag,
center, storage, numbers ));
}
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvFindHandRegionA
// Purpose: finds hand region in range image data
// Context:
// Parameters:
// Context:
// Parameters:
// points - pointer to the input point's set.
// count - the number of the input points.
// indexs - pointer to the input sequence of the point's indexes
// line - pointer to the 3D-line
// size - size of the hand in meters
// size - size of the hand in meters
// jc - j-index of the initial image center
// center - pointer to the output hand center
// storage - pointer to the memory storage
// storage - pointer to the memory storage
// numbers - pointer to the output sequence of the point's indexes inside
// hand region
//
// hand region
//
// Notes:
//F*/
CV_IMPL void

File diff suppressed because it is too large Load Diff

View File

@@ -71,7 +71,7 @@
// So, total number of observation vectors is Nx*Ny, and total size of
// array obs must be >= Nx*Ny*obsSize.width*obsSize.height*sizeof(float).
// 2. Observation vectors are calculated in the following loop
// ( actual implementation may be different ), where
// ( actual implementation may be different ), where
// I[x1:x2,y1:y2] means block of pixels from source image with
// x1 <= x < x2, y1 <= y < y2,
// D[x1:x2,y1:y2] means sub matrix of DCT matrix D.

View File

@@ -103,7 +103,7 @@ typedef struct CvLCMData
// Returns: 1, if hybrid model was succesfully constructed
// 0, if some error occures
//F*/
CV_IMPL
CV_IMPL
int _cvConstructLCM(CvLCM* LCM);
/*F///////////////////////////////////////////////////////////////////////////////////////
@@ -180,7 +180,7 @@ CvLCMNode* _cvTreatExeptionalCase(CvLCM* pLCM,
// LinkedEdges : out, matrix of incident edges
// LinkedSites : out, matrix of incident sites
// pSite: in, original site (pNode must be the begin point of pEdge
// for this pSite, this property hold out far all edges)
// for this pSite, this property hold out far all edges)
// Returns: number of incident edges (must be less than 10)
//F*/
CV_IMPL
@@ -223,10 +223,10 @@ CvLCMEdge* _cvCreateLCMEdge(CvLCM* pLCM);
// LCMNode : in, graph node
// LCMEdge : in, graph edge
// LCMEdge_prev : in&out, previous edge, connected with given node
// index: in,
// index: in,
// i : =0, if node is initial for edge
// =1, if node is terminal for edge
// Returns:
// Returns:
//F*/
CV_IMPL
void _cvAttachLCMEdgeToLCMNode(CvLCMNode* LCMNode,
@@ -244,7 +244,7 @@ void _cvAttachLCMEdgeToLCMNode(CvLCMNode* LCMNode,
// PointO, PointA,PointB: in, given points
// PrPoint : out, projection
// dist : distance from PointO to PrPoint
// Returns:
// Returns:
//F*/
CV_IMPL
void _cvProjectionPointToSegment(CvPoint2D32f* PointO,
@@ -261,7 +261,7 @@ void _cvProjectionPointToSegment(CvPoint2D32f* PointO,
// Parameters:
// pLCMData : in
// pLCMCCNData : out
// Returns:
// Returns:
//F*/
CV_IMPL
void _cvPrepareData(CvLCMComplexNodeData* pLCMCCNData,
@@ -280,12 +280,12 @@ CV_IMPL CvGraph* cvLinearContorModelFromVoronoiDiagram(CvVoronoiDiagram2D* Voron
CV_FUNCNAME( "cvLinearContorModelFromVoronoiDiagram" );
__BEGIN__;
if( !VoronoiDiagram )
CV_ERROR( CV_StsBadArg,"Voronoi Diagram is not defined" );
if( maxWidth < 0 )
CV_ERROR( CV_StsBadArg,"Treshold parameter must be non negative" );
for(SiteSet = VoronoiDiagram->sites;
SiteSet != NULL;
SiteSet = (CvSet*)SiteSet->h_next)
@@ -295,7 +295,7 @@ CV_IMPL CvGraph* cvLinearContorModelFromVoronoiDiagram(CvVoronoiDiagram2D* Voron
if(SiteSet->total > 70000)
CV_ERROR( CV_StsBadArg,"Can't operate with large domains" );
}
LCMstorage = cvCreateMemStorage(0);
LCM.EdgeStorage = cvCreateChildMemStorage(LCMstorage);
@@ -308,7 +308,7 @@ CV_IMPL CvGraph* cvLinearContorModelFromVoronoiDiagram(CvVoronoiDiagram2D* Voron
if(!_cvConstructLCM(&LCM))
cvReleaseLinearContorModelStorage(&LCM.Graph);
__END__;
return LCM.Graph;
}//end of cvLinearContorModelFromVoronoiDiagram
@@ -343,7 +343,7 @@ CV_IMPL int cvReleaseLinearContorModelStorage(CvGraph** Graph)
cvReleaseMemStorage(&(*Graph)->storage);
*Graph = NULL;
__END__;
return 1;
}//end of cvReleaseLinearContorModelStorage
@@ -353,10 +353,10 @@ int _cvConstructLCM(CvLCM* LCM)
CvVoronoiSite2D* pSite = 0;
CvVoronoiEdge2D* pEdge = 0, *pEdge1;
CvVoronoiNode2D* pNode, *pNode1;
CvVoronoiEdge2D* LinkedEdges[10];
CvVoronoiSite2D* LinkedSites[10];
CvSeqReader reader;
CvLCMData LCMdata;
int i;
@@ -375,7 +375,7 @@ int _cvConstructLCM(CvLCM* LCM)
pNode = CV_VORONOIEDGE2D_BEGINNODE(pEdge,pSite);
if(pNode->radius > LCM->maxWidth)
goto PREPARECOMPLEXNODE;
pEdge1 = CV_PREV_VORONOIEDGE2D(pEdge,pSite);
pNode1 = CV_VORONOIEDGE2D_BEGINNODE(pEdge1,pSite);
if(pNode1->radius > LCM->maxWidth)
@@ -396,7 +396,7 @@ PREPARECOMPLEXNODE:
if(!_cvConstructLCMComplexNode(LCM,NULL,&LCMdata))
return 0;
continue;
PREPARESIMPLENODE:
_CV_INITIALIZE_CVLCMDATA(&LCMdata,pSite,pEdge,CV_VORONOIEDGE2D_ENDNODE(pEdge,pSite));
if(!_cvConstructLCMSimpleNode(LCM,NULL,&LCMdata))
@@ -419,7 +419,7 @@ CvLCMNode* _cvConstructLCMComplexNode(CvLCM* pLCM,
CvLCMData LCMOutputData;
CvLCMComplexNodeData LCMCCNData;
int index = 0;
_cvPrepareData(&LCMCCNData,pLCMInputData);
pLCMNode = _cvCreateLCMNode(pLCM);
@@ -435,11 +435,11 @@ CvLCMNode* _cvConstructLCMComplexNode(CvLCM* pLCM,
index+=2;
}
pSite_first = LCMCCNData.site_first;
pSite_first = LCMCCNData.site_first;
pSite_last = LCMCCNData.site_last;
pEdge = LCMCCNData.edge;
for(pSite = pSite_first;
for(pSite = pSite_first;
pSite != pSite_last;
pSite = CV_NEXT_VORONOISITE2D(pSite),
pEdge = CV_PREV_VORONOIEDGE2D(CV_LAST_VORONOIEDGE2D(pSite),pSite))
@@ -498,7 +498,7 @@ CvLCMNode* _cvConstructLCMSimpleNode(CvLCM* pLCM,
pLCMInputData->psite = CV_TWIN_VORONOISITE2D(LinkedSites[1],LinkedEdges[1]);
return NULL;
}
CvLCMEdge* pLCMEdge_prev = NULL;
CvLCMNode* pLCMNode;
CvLCMData LCMOutputData;
@@ -530,7 +530,7 @@ CvLCMEdge* _cvConstructLCMEdge(CvLCM* pLCM,
CvVoronoiNode2D* pNode0,*pNode1;
CvLCMEdge* pLCMEdge = _cvCreateLCMEdge(pLCM);
CvSeqWriter writer;
cvStartAppendToSeq(pLCMEdge->chain,&writer );
@@ -636,7 +636,7 @@ int _cvNodeMultyplicity(CvVoronoiSite2D* pSite,
CvVoronoiSite2D** LinkedSites)
{
if(!pNode->radius)
return -1;
return -1;
assert(pNode == CV_VORONOIEDGE2D_BEGINNODE(pEdge,pSite));
int multyplicity = 0;

View File

@@ -85,7 +85,7 @@ icvFetchLine8uC3R( uchar * src, int src_step,
for( i = dx; i >= 0; i -= 2, dst += 3 )
{
int mask = (err -= dy) < 0 ? -1 : 0;
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
@@ -441,7 +441,7 @@ cvPreWarpImage( int numLines, /* number of scanlines */
// Context:
// Parameters: img - initial image (in the beginning)
//
// Notes:
// Notes:
//F*/
CV_IMPL void
cvPostWarpImage( int numLines, /* number of scanlines */

View File

@@ -846,7 +846,7 @@ CvStatus
icvRank2Constraint( double *F )
{
double U[9], V[9], W[3];
double aW[3];
double aW[3];
int i, i3, j, j3, t;
if( F == 0 )
@@ -1595,17 +1595,17 @@ icvGaussMxN( double *A, double *B, int M, int N, double **solutions )
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: icvPoint7
// Purpose:
//
//
//
//
// Context:
// Parameters:
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// Returns:
// CV_NO_ERR if all Ok or error code
// Notes:

View File

@@ -53,10 +53,10 @@
// * allow efficient async storage
// Datar, M., Immorlica, N., Indyk, P., and Mirrokni, V. S. 2004. Locality-sensitive hashing
// scheme based on p-stable distributions. In Proceedings of the Twentieth Annual Symposium on
// Computational Geometry (Brooklyn, New York, USA, June 08 - 11, 2004). SCG '04. ACM, New York,
// NY, 253-262. DOI= http://doi.acm.org/10.1145/997817.997857
// Datar, M., Immorlica, N., Indyk, P., and Mirrokni, V. S. 2004. Locality-sensitive hashing
// scheme based on p-stable distributions. In Proceedings of the Twentieth Annual Symposium on
// Computational Geometry (Brooklyn, New York, USA, June 08 - 11, 2004). SCG '04. ACM, New York,
// NY, 253-262. DOI= http://doi.acm.org/10.1145/997817.997857
#include "precomp.hpp"
#include <math.h>
@@ -128,11 +128,11 @@ public:
for (int ii = bins[h1], iin, iip = -1; ii != -1; iip = ii, ii = iin) {
iin = nodes[ii].next;
if (nodes[ii].h2 == h.h2 && nodes[ii].i == i) {
free_nodes.push_back(ii);
if (iip == -1)
bins[h1] = iin;
else
nodes[iip].next = iin;
free_nodes.push_back(ii);
if (iip == -1)
bins[h1] = iin;
else
nodes[iip].next = iin;
}
}
}
@@ -141,7 +141,7 @@ public:
int k = 0;
for (int ii = bins[h1]; ii != -1 && k < ret_i_max; ii = nodes[ii].next)
if (nodes[ii].h2 == h.h2)
ret_i[k++] = nodes[ii].i;
ret_i[k++] = nodes[ii].i;
return k;
}
};
@@ -166,11 +166,11 @@ public:
cvRandArr(&rng, a, CV_RAND_NORMAL, cvScalar(0), cvScalar(1));
cvRandArr(&rng, b, CV_RAND_UNI, cvScalar(0), cvScalar(r));
cvRandArr(&rng, r1, CV_RAND_UNI,
cvScalar(std::numeric_limits<int>::min()),
cvScalar(std::numeric_limits<int>::max()));
cvScalar(std::numeric_limits<int>::min()),
cvScalar(std::numeric_limits<int>::max()));
cvRandArr(&rng, r2, CV_RAND_UNI,
cvScalar(std::numeric_limits<int>::min()),
cvScalar(std::numeric_limits<int>::max()));
cvScalar(std::numeric_limits<int>::min()),
cvScalar(std::numeric_limits<int>::max()));
}
~pstable_l2_func() {
cvReleaseMat(&a);
@@ -179,20 +179,20 @@ public:
cvReleaseMat(&r2);
}
// * factor all L functions into this (reduces number of matrices to 4 total;
// * simpler syntax in lsh_table). give parameter l here that tells us which
// * factor all L functions into this (reduces number of matrices to 4 total;
// * simpler syntax in lsh_table). give parameter l here that tells us which
// * row to use etc.
lsh_hash operator() (const T* x) const {
const T* aj = (const T*)a->data.ptr;
const T* bj = (const T*)b->data.ptr;
const T* bj = (const T*)b->data.ptr;
lsh_hash h;
h.h1 = h.h2 = 0;
for (int j = 0; j < k; ++j) {
accum_type s = 0;
for (int jj = 0; jj < d; ++jj)
s += aj[jj] * x[jj];
s += aj[jj] * x[jj];
s += *bj;
s = accum_type(s/r);
int si = int(s);
@@ -226,7 +226,7 @@ private:
double r;
static accum_type comp_dist(const std::pair<int,accum_type>& x,
const std::pair<int,accum_type>& y) {
const std::pair<int,accum_type>& y) {
return x.second < y.second;
}
@@ -257,11 +257,11 @@ public:
const scalar_type* x = data+j*d;
int i = ops->vector_add(x);
if (ret_indices)
ret_indices[j] = i;
ret_indices[j] = i;
for (int l = 0; l < L; ++l) {
lsh_hash h = (*g[l])(x);
ops->hash_insert(h, l, i);
lsh_hash h = (*g[l])(x);
ops->hash_insert(h, l, i);
}
}
}
@@ -271,8 +271,8 @@ public:
const scalar_type* x = (const scalar_type*)ops->vector_lookup(i);
for (int l = 0; l < L; ++l) {
lsh_hash h = (*g[l])(x);
ops->hash_remove(h, l, i);
lsh_hash h = (*g[l])(x);
ops->hash_remove(h, l, i);
}
ops->vector_remove(i);
}
@@ -289,17 +289,17 @@ public:
lsh_hash h = (*g[l])(q);
int m = ops->hash_lookup(h, l, tmp, emax);
for (int j = 0; j < m && emax > 0; ++j, --emax) {
int i = tmp[j];
const scalar_type* p = (const scalar_type*)ops->vector_lookup(i);
accum_type pd = (*g[l]).distance(p, q);
if (k1 < k0) {
dr[k1++] = std::make_pair(i, pd);
std::push_heap(&dr[0], &dr[k1], comp_dist);
} else if (pd < dr[0].second) {
std::pop_heap(&dr[0], &dr[k0], comp_dist);
dr[k0 - 1] = std::make_pair(i, pd);
std::push_heap(&dr[0], &dr[k0], comp_dist);
}
int i = tmp[j];
const scalar_type* p = (const scalar_type*)ops->vector_lookup(i);
accum_type pd = (*g[l]).distance(p, q);
if (k1 < k0) {
dr[k1++] = std::make_pair(i, pd);
std::push_heap(&dr[0], &dr[k1], comp_dist);
} else if (pd < dr[0].second) {
std::pop_heap(&dr[0], &dr[k0], comp_dist);
dr[k0 - 1] = std::make_pair(i, pd);
std::push_heap(&dr[0], &dr[k0], comp_dist);
}
}
}
@@ -454,9 +454,9 @@ void cvLSHQuery(CvLSH* lsh, const CvMat* data, CvMat* indices, CvMat* dist, int
switch (lsh->type) {
case CV_32FC1: lsh->u.lsh_32f->query(data->data.fl, data->rows,
k, emax, dist->data.db, indices->data.i); break;
k, emax, dist->data.db, indices->data.i); break;
case CV_64FC1: lsh->u.lsh_64f->query(data->data.db, data->rows,
k, emax, dist->data.db, indices->data.i); break;
k, emax, dist->data.db, indices->data.i); break;
default: assert(0); return;
}
}

View File

@@ -97,7 +97,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
const int SMALL_DIFF=2;
const int BIG_DIFF=128;
// scanning scheme coordinates
cv::vector<CvPoint> _ss((2 * maxRange.width + 1) * (2 * maxRange.height + 1));
CvPoint* ss = &_ss[0];
@@ -107,50 +107,50 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
int blSize = blWidth*blHeight;
int acceptLevel = blSize * SMALL_DIFF;
int escapeLevel = blSize * BIG_DIFF;
int i, j;
cv::vector<uchar> _blockA(cvAlign(blSize + 16, 16));
uchar* blockA = (uchar*)cvAlignPtr(&_blockA[0], 16);
// Calculate scanning scheme
int min_count = MIN( maxRange.width, maxRange.height );
// use spiral search pattern
//
//
// 9 10 11 12
// 8 1 2 13
// 7 * 3 14
// 6 5 4 15
// 6 5 4 15
//... 20 19 18 17
//
for( i = 0; i < min_count; i++ )
{
// four cycles along sides
int x = -i-1, y = x;
// upper side
for( j = -i; j <= i + 1; j++, ss_count++ )
{
ss[ss_count].x = ++x;
ss[ss_count].y = y;
}
// right side
for( j = -i; j <= i + 1; j++, ss_count++ )
{
ss[ss_count].x = x;
ss[ss_count].y = ++y;
}
// bottom side
for( j = -i; j <= i + 1; j++, ss_count++ )
{
ss[ss_count].x = --x;
ss[ss_count].y = y;
}
// left side
for( j = -i; j <= i + 1; j++, ss_count++ )
{
@@ -158,26 +158,26 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
ss[ss_count].y = --y;
}
}
// the rest part
if( maxRange.width < maxRange.height )
{
int xleft = -min_count;
// cycle by neighbor rings
for( i = min_count; i < maxRange.height; i++ )
{
// two cycles by x
int y = -(i + 1);
int x = xleft;
// upper side
for( j = -maxRange.width; j <= maxRange.width; j++, ss_count++, x++ )
{
ss[ss_count].x = x;
ss[ss_count].y = y;
}
x = xleft;
y = -y;
// bottom side
@@ -191,21 +191,21 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
else if( maxRange.width > maxRange.height )
{
int yupper = -min_count;
// cycle by neighbor rings
for( i = min_count; i < maxRange.width; i++ )
{
// two cycles by y
int x = -(i + 1);
int y = yupper;
// left side
for( j = -maxRange.height; j <= maxRange.height; j++, ss_count++, y++ )
{
ss[ss_count].x = x;
ss[ss_count].y = y;
}
y = yupper;
x = -x;
// right side
@@ -221,18 +221,18 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
const uchar* Adata = srcA->data.ptr;
const uchar* Bdata = srcB->data.ptr;
int Astep = srcA->step, Bstep = srcB->step;
// compute the flow
for( i = 0; i < velx->rows; i++ )
{
float* vx = (float*)(velx->data.ptr + velx->step*i);
float* vy = (float*)(vely->data.ptr + vely->step*i);
for( j = 0; j < velx->cols; j++ )
{
int X1 = j*shiftSize.width, Y1 = i*shiftSize.height, X2, Y2;
int offX = 0, offY = 0;
if( usePrevious )
{
offX = cvRound(vx[j]);
@@ -242,7 +242,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
int k;
for( k = 0; k < blHeight; k++ )
memcpy( blockA + k*blWidth, Adata + Astep*(Y1 + k) + X1, blWidth );
X2 = X1 + offX;
Y2 = Y1 + offY;
int dist = INT_MAX;
@@ -261,10 +261,10 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
int dy = offY + ss[k].y;
X2 = X1 + dx;
Y2 = Y1 + dy;
if( !(0 <= X2 && X2 <= maxX && 0 <= Y2 && Y2 <= maxY) )
continue;
int tmpDist = cmpBlocks( blockA, Bdata + Bstep*Y2 + X2, Bstep, blockSize );
if( tmpDist < acceptLevel )
{
@@ -272,7 +272,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
countMin = 1;
break;
}
if( tmpDist < dist )
{
dist = tmpDist;
@@ -285,7 +285,7 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
countMin++;
}
}
if( dist > escapeLevel )
{
sumx = offX;
@@ -293,10 +293,10 @@ cvCalcOpticalFlowBM( const void* srcarrA, const void* srcarrB,
countMin = 1;
}
}
vx[j] = (float)sumx/countMin;
vy[j] = (float)sumy/countMin;
}
}
}
}

View File

@@ -555,7 +555,7 @@ icvCalcOpticalFlowLK_8u32fR( uchar * imgA,
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: cvCalcOpticalFlowLK
// Purpose: Optical flow implementation
// Context:
// Context:
// Parameters:
// srcA, srcB - source image
// velx, vely - destination image

View File

@@ -199,8 +199,8 @@ icvCalcPGH( const CvSeq * contour, float *pgh, int angle_dim, int dist_dim )
buffer[i] = (float)(1./sqrt(dx * dx + dy * dy));
}
/*
do 2 passes.
/*
do 2 passes.
First calculates maximal distance.
Second calculates histogram itself.
*/
@@ -335,14 +335,14 @@ cvCalcPGH( const CvSeq * contour, CvHistogram * hist )
{
int size[CV_MAX_DIM];
int dims;
if( !CV_IS_HIST(hist))
CV_Error( CV_StsBadArg, "The histogram header is invalid " );
if( CV_IS_SPARSE_HIST( hist ))
CV_Error( CV_StsUnsupportedFormat, "Sparse histogram are not supported" );
dims = cvGetDims( hist->bins, size );
dims = cvGetDims( hist->bins, size );
if( dims != 2 )
CV_Error( CV_StsBadSize, "The histogram must be two-dimensional" );

View File

@@ -1215,8 +1215,8 @@ void FernClassifier::setVerbose(bool _verbose)
{
verbose = _verbose;
}
/****************************************************************************************\
* FernDescriptorMatcher *
\****************************************************************************************/
@@ -1252,7 +1252,7 @@ FernDescriptorMatcher::~FernDescriptorMatcher()
void FernDescriptorMatcher::clear()
{
GenericDescriptorMatcher::clear();
classifier.release();
prevTrainCount = 0;
}
@@ -1262,11 +1262,11 @@ void FernDescriptorMatcher::train()
if( classifier.empty() || prevTrainCount < (int)trainPointCollection.keypointCount() )
{
assert( params.filename.empty() );
vector<vector<Point2f> > points( trainPointCollection.imageCount() );
for( size_t imgIdx = 0; imgIdx < trainPointCollection.imageCount(); imgIdx++ )
KeyPoint::convert( trainPointCollection.getKeypoints((int)imgIdx), points[imgIdx] );
classifier = new FernClassifier( points, trainPointCollection.getImages(), vector<vector<int> >(), 0, // each points is a class
params.patchSize, params.signatureSize, params.nstructs, params.structSize,
params.nviews, params.compressionMethod, params.patchGenerator );
@@ -1282,7 +1282,7 @@ void FernDescriptorMatcher::calcBestProbAndMatchIdx( const Mat& image, const Poi
float& bestProb, int& bestMatchIdx, vector<float>& signature )
{
(*classifier)( image, pt, signature);
bestProb = -FLT_MAX;
bestMatchIdx = -1;
for( int ci = 0; ci < classifier->getClassCount(); ci++ )
@@ -1300,14 +1300,14 @@ void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint
const vector<Mat>& /*masks*/, bool /*compactResult*/ )
{
train();
matches.resize( queryKeypoints.size() );
vector<float> signature( (size_t)classifier->getClassCount() );
for( size_t queryIdx = 0; queryIdx < queryKeypoints.size(); queryIdx++ )
{
(*classifier)( queryImage, queryKeypoints[queryIdx].pt, signature);
for( int k = 0; k < knn; k++ )
{
DMatch bestMatch;
@@ -1322,7 +1322,7 @@ void FernDescriptorMatcher::knnMatchImpl( const Mat& queryImage, vector<KeyPoint
best_ci = ci;
}
}
if( bestMatch.trainIdx == -1 )
break;
signature[best_ci] = -std::numeric_limits<float>::max();
@@ -1338,11 +1338,11 @@ void FernDescriptorMatcher::radiusMatchImpl( const Mat& queryImage, vector<KeyPo
train();
matches.resize( queryKeypoints.size() );
vector<float> signature( (size_t)classifier->getClassCount() );
for( size_t i = 0; i < queryKeypoints.size(); i++ )
{
(*classifier)( queryImage, queryKeypoints[i].pt, signature);
for( int ci = 0; ci < classifier->getClassCount(); ci++ )
{
if( -signature[ci] < maxDistance )
@@ -1364,7 +1364,7 @@ void FernDescriptorMatcher::read( const FileNode &fn )
params.structSize = fn["structSize"];
params.nviews = fn["nviews"];
params.compressionMethod = fn["compressionMethod"];
//classifier->read(fn);
}
@@ -1377,7 +1377,7 @@ void FernDescriptorMatcher::write( FileStorage& fs ) const
fs << "structSize" << params.structSize;
fs << "nviews" << params.nviews;
fs << "compressionMethod" << params.compressionMethod;
// classifier->write(fs);
}
@@ -1393,7 +1393,7 @@ Ptr<GenericDescriptorMatcher> FernDescriptorMatcher::clone( bool emptyTrainData
{
CV_Error( CV_StsNotImplemented, "deep clone dunctionality is not implemented, because "
"FernClassifier has not copy constructor or clone method ");
//matcher->classifier;
matcher->params = params;
matcher->prevTrainCount = prevTrainCount;
@@ -1401,7 +1401,7 @@ Ptr<GenericDescriptorMatcher> FernDescriptorMatcher::clone( bool emptyTrainData
}
return matcher;
}
////////////////////////////////////// Planar Object Detector ////////////////////////////////////
PlanarObjectDetector::PlanarObjectDetector()
@@ -1440,7 +1440,7 @@ void PlanarObjectDetector::train(const vector<Mat>& pyr, int npoints,
ldetector = detector;
ldetector.setVerbose(verbose);
ldetector.getMostStable2D(pyr[0], modelPoints, npoints, patchGenerator);
npoints = (int)modelPoints.size();
fernClassifier.setVerbose(verbose);
fernClassifier.trainFromSingleView(pyr[0], modelPoints,
@@ -1458,7 +1458,7 @@ void PlanarObjectDetector::train(const vector<Mat>& pyr, const vector<KeyPoint>&
ldetector.setVerbose(verbose);
modelPoints.resize(keypoints.size());
std::copy(keypoints.begin(), keypoints.end(), modelPoints.begin());
fernClassifier.setVerbose(verbose);
fernClassifier.trainFromSingleView(pyr[0], modelPoints,
patchSize, (int)modelPoints.size(), nstructs, structSize, nviews,
@@ -1479,7 +1479,7 @@ void PlanarObjectDetector::read(const FileNode& node)
void PlanarObjectDetector::write(FileStorage& fs, const String& objname) const
{
WriteStructContext ws(fs, objname, CV_NODE_MAP);
{
WriteStructContext wsroi(fs, "model-roi", CV_NODE_SEQ + CV_NODE_FLOW);
cv::write(fs, modelROI.x);
@@ -1499,7 +1499,7 @@ bool PlanarObjectDetector::operator()(const Mat& image, Mat& H, vector<Point2f>&
buildPyramid(image, pyr, ldetector.nOctaves - 1);
vector<KeyPoint> keypoints;
ldetector(pyr, keypoints);
return (*this)(pyr, keypoints, H, corners);
}
@@ -1511,7 +1511,7 @@ bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPo
vector<float> maxLogProb(m, -FLT_MAX);
vector<float> signature;
vector<Point2f> fromPt, toPt;
for( i = 0; i < n; i++ )
{
KeyPoint kpt = keypoints[i];
@@ -1525,20 +1525,20 @@ bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPo
bestMatches[k] = i;
}
}
if(pairs)
pairs->resize(0);
for( i = 0; i < m; i++ )
if( bestMatches[i] >= 0 )
{
fromPt.push_back(modelPoints[i].pt);
toPt.push_back(keypoints[bestMatches[i]].pt);
}
if( fromPt.size() < 4 )
return false;
vector<uchar> mask;
matH = findHomography(fromPt, toPt, RANSAC, 10, mask);
if( matH.data )
@@ -1554,7 +1554,7 @@ bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPo
(float)((H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w));
}
}
if( pairs )
{
for( i = j = 0; i < m; i++ )
@@ -1564,7 +1564,7 @@ bool PlanarObjectDetector::operator()(const vector<Mat>& pyr, const vector<KeyPo
pairs->push_back(bestMatches[i]);
}
}
return matH.data != 0;
}

View File

@@ -148,7 +148,7 @@ CV_INLINE float icvRGBDist_Sum( const _CvRGBf& a, const _CvRGBf& b )
float tr = (float)fabs(a.red - b.red);
float tg = (float)fabs(a.green - b.green);
float tb = (float)fabs(a.blue - b.blue);
return (tr + tg + tb);
}
@@ -294,7 +294,7 @@ icvPyrSegmentation8uC1R( uchar * src_image, int src_step,
cvSetData( &prev_level, pyramida, step );
cvSetData( &next_level, pyramida, step );
cvPyrDown( &prev_level, &next_level );
//_CV_CHECK( icvPyrDown_Gauss5x5_32f_C1R( pyramida, step, pyramida, step, size, buff ));
//_CV_CHECK( icvPyrDownBorder_32f_CnR( pyramida, step, size, pyramida, step, dst_size, 1 ));
pyram[l] = p_cur;
@@ -436,7 +436,7 @@ icvPyrSegmentation8uC1R( uchar * src_image, int src_step,
{
p_cur[j].c = p_prev->c;
}
if( l == 0 )
p_prev = _CV_NEXT_BASE_C1(p_prev,2);
else
@@ -530,7 +530,7 @@ icvPyrSegmentation8uC1R( uchar * src_image, int src_step,
cvEndWriteSeq( &writer );
/* clusterization segmented components and construction
/* clusterization segmented components and construction
output connected components */
icvSegmentClusterC1( cmp_seq, res_seq, threshold2, pyram[1], roi );
@@ -590,7 +590,7 @@ icvPyrSegmentation8uC1R( uchar * src_image, int src_step,
/****************************************************************************************\
color!!! image segmentation by pyramid-linking
color!!! image segmentation by pyramid-linking
\****************************************************************************************/
static CvStatus
icvPyrSegmentation8uC3R( uchar * src_image, int src_step,
@@ -859,7 +859,7 @@ icvPyrSegmentation8uC3R( uchar * src_image, int src_step,
{
p_cur[j].c = p_prev->c;
}
if( l == 0 )
p_prev = _CV_NEXT_BASE_C3( p_prev, 2 );
else
@@ -960,7 +960,7 @@ icvPyrSegmentation8uC3R( uchar * src_image, int src_step,
cvEndWriteSeq( &writer );
/* clusterization segmented components and construction
/* clusterization segmented components and construction
output connected components */
icvSegmentClusterC3( cmp_seq, res_seq, threshold2, pyram[1], roi );
@@ -1388,7 +1388,7 @@ static CvStatus icvUpdatePyrLinks_8u_C3
/****************************************************************************************\
clusterization segmented components
clusterization segmented components
\****************************************************************************************/
static void
@@ -1564,7 +1564,7 @@ icvSegmentClusterC1( CvSeq * cmp_seq, CvSeq * res_seq,
/****************************************************************************************\
clusterization segmented components
clusterization segmented components
\****************************************************************************************/
static void
@@ -1757,7 +1757,7 @@ icvSegmentClusterC3( CvSeq * cmp_seq, CvSeq * res_seq,
/****************************************************************************************\
definition of the maximum roi size
definition of the maximum roi size
\****************************************************************************************/
void
@@ -1815,7 +1815,7 @@ icvMaxRoi1( _CvRect16u * max_rect, int x, int y )
// Name: cvPyrSegmentation
// Purpose:
// segments an image using pyramid-linking technique
// Context:
// Context:
// Parameters:
// src - source image
// dst - destination image

View File

@@ -53,7 +53,7 @@ typedef struct Seg
Seg;
#define UP 1
#define DOWN -1
#define DOWN -1
#define PUSH(Y,IL,IR,IPL,IPR,FL) { stack[StIn].y=(ushort)(Y); \
stack[StIn].l=(ushort)(IL); \
@@ -93,7 +93,7 @@ icvSegmFloodFill_Stage1( uchar* pImage, int step,
unsigned Interval = (unsigned) (d_up + d_lw);
Seg *stack = (Seg*)pStack;
int StIn = 0;
int i, L, R;
int i, L, R;
int area = 0;
int sum[] = { 0, 0, 0 };
int XMin, XMax, YMin = seed.y, YMax = seed.y;
@@ -166,7 +166,7 @@ icvSegmFloodFill_Stage1( uchar* pImage, int step,
}
}
}
img = pImage + YC * step;
for( i = L; i <= R; i++ )
@@ -178,7 +178,7 @@ icvSegmFloodFill_Stage1( uchar* pImage, int step,
area += R - L + 1;
}
region->area = area;
region->rect.x = XMin;
region->rect.y = YMin;
@@ -230,7 +230,7 @@ icvSegmFloodFill_Stage2( uchar* pImage, int step,
static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
{
static int tab[] = { 0, 2, 2, 1 };
uchar *src = 0, *dst = 0;
int dst_step, src_step;
int x, y;
@@ -244,13 +244,13 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
src += 3;
#define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
for( y = 1; y < size.height - 1; y++ )
{
src += src_step;
dst += dst_step;
uchar* src0 = src;
dst[0] = dst[size.width - 1] = 0;
for( x = 1; x < size.width - 1; x++, src += 3 )
@@ -275,7 +275,7 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
m[2] = dh[0]*dv[0] + dh[1]*dv[1] + dh[2]*dv[2];
m[1] = dv[0]*dv[0] + dv[1]*dv[1] + dh[2]*dh[2];
val = (m[0] + m[2]) +
val = (m[0] + m[2]) +
sqrt(((double)((double)m[0] - m[2]))*(m[0] - m[2]) + (4.*m[1])*m[1]);
/*
@@ -285,7 +285,7 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
v /= sqrt(xx*xx + yy*yy) + 1e-7;
xx *= v;
yy *= v;
dx[x] = (short)cvRound(xx);
dy[x] = (short)cvRound(yy);
@@ -302,7 +302,7 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
ad[2] = CV_IABS(d[2]);
f0 = ad[1] > ad[0];
f1 = ad[2] > ad[f0];
f1 = ad[2] > ad[f0];
val = d[tab[f0*2 + f1]];
@@ -316,7 +316,7 @@ static void color_derv( const CvArr* srcArr, CvArr* dstArr, int thresh )
ad[2] = CV_IABS(d[2]);
f0 = ad[1] > ad[0];
f1 = ad[2] > ad[f0];
f1 = ad[2] > ad[f0];
dst[x] = (uchar)(val + d[tab[f0*2 + f1]] > thresh ? 255 : 0);*/
dst[x] = (uchar)(val > thresh);
@@ -352,7 +352,7 @@ icvGetComponent( uchar* img, int step, CvRect rect,
for( y = rect.y; y < rect.height; y++, ptr += step )
{
int prev = ptr[rect.x - 1] & -2;
for( x = rect.x; x < rect.width; x++ )
{
int p = ptr[x] & -2;
@@ -484,7 +484,7 @@ cvSegmentImage( const CvArr* srcarr, CvArr* dstarr,
CvMat* canny = 0;
//CvMat* temp = 0;
void* stack = 0;
CV_FUNCNAME( "cvSegmentImage" );
__BEGIN__;
@@ -531,7 +531,7 @@ cvSegmentImage( const CvArr* srcarr, CvArr* dstarr,
{
CvConnectedComp region;
int avgVal[3] = { 0, 0, 0 };
icvSegmFloodFill_Stage1( src->data.ptr, src->step,
mask->data.ptr, mask->step,
size, pt, avgVal,

View File

@@ -57,7 +57,7 @@ struct CvSpillTreeNode
};
struct CvSpillTree
{
{
CvSpillTreeNode* root;
CvMat** refmat; // leaf ref matrix
int total; // total leaves
@@ -69,15 +69,15 @@ struct CvSpillTree
struct CvResult
{
int index;
int index;
double distance;
};
// find the farthest node in the "list" from "node"
static inline CvSpillTreeNode*
icvFarthestNode( CvSpillTreeNode* node,
CvSpillTreeNode* list,
int total )
CvSpillTreeNode* list,
int total )
{
double farthest = -1.;
CvSpillTreeNode* result = NULL;
@@ -85,10 +85,10 @@ icvFarthestNode( CvSpillTreeNode* node,
{
double norm = cvNorm( node->center, list->center );
if ( norm > farthest )
{
farthest = norm;
result = list;
}
{
farthest = norm;
result = list;
}
list = list->rc;
}
return result;
@@ -106,7 +106,7 @@ icvCloneSpillTreeNode( CvSpillTreeNode* node )
// append the link-list of a tree node
static inline void
icvAppendSpillTreeNode( CvSpillTreeNode* node,
CvSpillTreeNode* append )
CvSpillTreeNode* append )
{
if ( node->lc == NULL )
{
@@ -125,8 +125,8 @@ icvAppendSpillTreeNode( CvSpillTreeNode* node,
static void
icvDFSInitSpillTreeNode( const CvSpillTree* tr,
const int d,
CvSpillTreeNode* node )
const int d,
CvSpillTreeNode* node )
{
if ( node->cc <= tr->naive )
{
@@ -151,7 +151,7 @@ icvDFSInitSpillTreeNode( const CvSpillTree* tr,
node->u = cvCreateMat( 1, d, tr->type );
cvSub( lnode->center, rnode->center, node->u );
cvNormalize( node->u, node->u );
// find the center of node in hyperspace
node->center = cvCreateMat( 1, d, tr->type );
cvZero( node->center );
@@ -172,7 +172,7 @@ icvDFSInitSpillTreeNode( const CvSpillTree* tr,
node->mp += ( it->p = cvDotProduct( it->center, node->u ) );
double norm = cvNorm( node->center, it->center );
if ( norm > node->r )
node->r = norm;
node->r = norm;
it = it->rc;
}
node->mp = node->mp / node->cc;
@@ -187,13 +187,13 @@ icvDFSInitSpillTreeNode( const CvSpillTree* tr,
for ( int i = 0; i < node->cc; i++ )
{
if ( it->p <= node->ub )
sl++;
sl++;
if ( it->p >= node->lb )
sr++;
sr++;
if ( it->p < node->mp )
l++;
l++;
else
r++;
r++;
it = it->rc;
}
// precision problem, return the node as it is.
@@ -217,32 +217,32 @@ icvDFSInitSpillTreeNode( const CvSpillTree* tr,
// it is not a spill point (defeatist search disabled)
it = node->lc;
for ( int i = 0; i < node->cc; i++ )
{
CvSpillTreeNode* next = it->rc;
if ( it->p < node->mp )
icvAppendSpillTreeNode( lc, it );
else
icvAppendSpillTreeNode( rc, it );
it = next;
}
{
CvSpillTreeNode* next = it->rc;
if ( it->p < node->mp )
icvAppendSpillTreeNode( lc, it );
else
icvAppendSpillTreeNode( rc, it );
it = next;
}
node->spill = false;
} else {
// a spill point
it = node->lc;
for ( int i = 0; i < node->cc; i++ )
{
CvSpillTreeNode* next = it->rc;
if ( it->p < node->lb )
icvAppendSpillTreeNode( lc, it );
else if ( it->p > node->ub )
icvAppendSpillTreeNode( rc, it );
else {
CvSpillTreeNode* cit = icvCloneSpillTreeNode( it );
icvAppendSpillTreeNode( lc, it );
icvAppendSpillTreeNode( rc, cit );
}
it = next;
}
{
CvSpillTreeNode* next = it->rc;
if ( it->p < node->lb )
icvAppendSpillTreeNode( lc, it );
else if ( it->p > node->ub )
icvAppendSpillTreeNode( rc, it );
else {
CvSpillTreeNode* cit = icvCloneSpillTreeNode( it );
icvAppendSpillTreeNode( lc, it );
icvAppendSpillTreeNode( rc, cit );
}
it = next;
}
node->spill = true;
}
node->lc = lc;
@@ -255,9 +255,9 @@ icvDFSInitSpillTreeNode( const CvSpillTree* tr,
static CvSpillTree*
icvCreateSpillTree( const CvMat* raw_data,
const int naive,
const double rho,
const double tau )
const int naive,
const double rho,
const double tau )
{
int n = raw_data->rows;
int d = raw_data->cols;
@@ -304,8 +304,8 @@ icvCreateSpillTree( const CvMat* raw_data,
static void
icvSpillTreeNodeHeapify( CvResult * heap,
int i,
const int k )
int i,
const int k )
{
if ( heap[i].index == -1 )
return;
@@ -319,7 +319,7 @@ icvSpillTreeNodeHeapify( CvResult * heap,
largest = l;
else if (( r < k )&&( heap[r].index == -1 ))
largest = r;
else {
else {
if (( l < k )&&( heap[l].distance > heap[i].distance ))
largest = l;
if (( r < k )&&( heap[r].distance > heap[largest].distance ))
@@ -332,12 +332,12 @@ icvSpillTreeNodeHeapify( CvResult * heap,
static void
icvSpillTreeDFSearch( CvSpillTree* tr,
CvSpillTreeNode* node,
CvResult* heap,
int* es,
const CvMat* desc,
const int k,
const int emax,
CvSpillTreeNode* node,
CvResult* heap,
int* es,
const CvMat* desc,
const int k,
const int emax,
bool * cache)
{
if ((emax > 0)&&( *es >= emax ))
@@ -348,15 +348,15 @@ icvSpillTreeDFSearch( CvSpillTree* tr,
{
// defeatist search
if ( !node->leaf )
p = cvDotProduct( node->u, desc );
p = cvDotProduct( node->u, desc );
if ( p < node->lb && node->lc->cc >= k ) // check the number of children larger than k otherwise you'll skip over better neighbor
node = node->lc;
node = node->lc;
else if ( p > node->ub && node->rc->cc >= k )
node = node->rc;
node = node->rc;
else
break;
break;
if ( NULL == node )
return;
return;
}
if ( node->leaf )
{
@@ -366,20 +366,20 @@ icvSpillTreeDFSearch( CvSpillTree* tr,
{
if ( !cache[it->i] )
{
distance = cvNorm( it->center, desc );
distance = cvNorm( it->center, desc );
cache[it->i] = true;
if (( heap[0].index == -1)||( distance < heap[0].distance ))
{
if (( heap[0].index == -1)||( distance < heap[0].distance ))
{
CvResult current_result;
current_result.index = it->i;
current_result.distance = distance;
heap[0] = current_result;
icvSpillTreeNodeHeapify( heap, 0, k );
(*es)++;
}
icvSpillTreeNodeHeapify( heap, 0, k );
(*es)++;
}
}
it = it->rc;
}
}
return;
}
dist = cvNorm( node->center, desc );
@@ -400,11 +400,11 @@ icvSpillTreeDFSearch( CvSpillTree* tr,
static void
icvFindSpillTreeFeatures( CvSpillTree* tr,
const CvMat* desc,
CvMat* results,
CvMat* dist,
const int k,
const int emax )
const CvMat* desc,
CvMat* results,
CvMat* dist,
const int k,
const int emax )
{
assert( desc->type == tr->type );
CvResult* heap = (CvResult*)cvAlloc( k*sizeof(heap[0]) );
@@ -416,26 +416,26 @@ icvFindSpillTreeFeatures( CvSpillTree* tr,
CvResult current;
current.index=-1;
current.distance=-1;
heap[i] = current;
heap[i] = current;
}
memset( cache, 0, sizeof(bool)*tr->total );
int es = 0;
icvSpillTreeDFSearch( tr, tr->root, heap, &es, &_desc, k, emax, cache );
CvResult inp;
for ( int i = k-1; i > 0; i-- )
{
CV_SWAP( heap[i], heap[0], inp );
icvSpillTreeNodeHeapify( heap, 0, i );
}
{
CV_SWAP( heap[i], heap[0], inp );
icvSpillTreeNodeHeapify( heap, 0, i );
}
int* rs = results->data.i+j*results->cols;
double* dt = dist->data.db+j*dist->cols;
for ( int i = 0; i < k; i++, rs++, dt++ )
if ( heap[i].index != -1 )
{
*rs = heap[i].index;
*dt = heap[i].distance;
} else
*rs = -1;
if ( heap[i].index != -1 )
{
*rs = heap[i].index;
*dt = heap[i].distance;
} else
*rs = -1;
}
cvFree( &heap );
cvFree( &cache );
@@ -476,9 +476,9 @@ class CvSpillTreeWrap : public CvFeatureTree {
CvSpillTree* tr;
public:
CvSpillTreeWrap(const CvMat* raw_data,
const int naive,
const double rho,
const double tau) {
const int naive,
const double rho,
const double tau) {
tr = icvCreateSpillTree(raw_data, naive, rho, tau);
}
~CvSpillTreeWrap() {
@@ -491,8 +491,8 @@ public:
};
CvFeatureTree* cvCreateSpillTree( const CvMat* raw_data,
const int naive,
const double rho,
const double tau ) {
const int naive,
const double rho,
const double tau ) {
return new CvSpillTreeWrap(raw_data, naive, rho, tau);
}

View File

@@ -92,7 +92,7 @@ cvSubdiv2DAddPoint( CvSubdiv2D * subdiv, CvPoint2D32f pt, int is_virtual )
subdiv_point->pt = pt;
subdiv_point->first = 0;
subdiv_point->flags |= is_virtual ? CV_SUBDIV2D_VIRTUAL_POINT_FLAG : 0;
subdiv_point->id = -1;
subdiv_point->id = -1;
}
return subdiv_point;
@@ -278,7 +278,7 @@ cvSubdiv2DLocate( CvSubdiv2D * subdiv, CvPoint2D32f pt,
}
}
exit:
subdiv->recent_edge = edge;
if( location == CV_PTLOC_INSIDE )
@@ -532,11 +532,11 @@ icvCreateCenterNormalLine( CvSubdiv2DEdge edge, double *_a, double *_b, double *
{
CvPoint2D32f org = cvSubdiv2DEdgeOrg( edge )->pt;
CvPoint2D32f dst = cvSubdiv2DEdgeDst( edge )->pt;
double a = dst.x - org.x;
double b = dst.y - org.y;
double c = -(a * (dst.x + org.x) + b * (dst.y + org.y));
*_a = a + a;
*_b = b + b;
*_c = c;
@@ -548,7 +548,7 @@ icvIntersectLines3( double *a0, double *b0, double *c0,
double *a1, double *b1, double *c1, CvPoint2D32f * point )
{
double det = a0[0] * b1[0] - a1[0] * b0[0];
if( det != 0 )
{
det = 1. / det;
@@ -665,15 +665,15 @@ cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt )
CvPoint2D32f start;
CvPoint2D32f diff;
CvSubdiv2DPointLocation loc;
CvSubdiv2DEdge edge;
CvSubdiv2DEdge edge;
int i;
if( !subdiv )
CV_Error( CV_StsNullPtr, "" );
if( !CV_IS_SUBDIV2D( subdiv ))
CV_Error( CV_StsNullPtr, "" );
if( subdiv->edges->active_count <= 3 )
return 0;
@@ -702,11 +702,11 @@ cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt )
for( i = 0; i < subdiv->total; i++ )
{
CvPoint2D32f t;
for(;;)
{
assert( cvSubdiv2DEdgeDst( edge ));
t = cvSubdiv2DEdgeDst( edge )->pt;
if( icvIsRightOf2( t, start, diff ) >= 0 )
break;
@@ -749,11 +749,11 @@ icvSubdiv2DCheck( CvSubdiv2D* subdiv )
{
int i, j, total = subdiv->edges->total;
CV_Assert( subdiv != 0 );
for( i = 0; i < total; i++ )
{
CvQuadEdge2D* edge = (CvQuadEdge2D*)cvGetSetElem(subdiv->edges,i);
if( edge && CV_IS_SET_ELEM( edge ))
{
for( j = 0; j < 4; j++ )
@@ -803,7 +803,7 @@ draw_subdiv_facet( CvSubdiv2D * subdiv, IplImage * dst, IplImage * src, CvSubdiv
CvPoint local_buf[100];
CvPoint *buf = local_buf;
// count number of edges in facet
// count number of edges in facet
do
{
count++;

View File

@@ -997,13 +997,13 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
memcpy(bestFlags,flags,sizeof(flags[0])*numPoints);
/* Adaptive number of samples to count*/
double ep = 1 - (double)numGoodPoints / (double)numPoints;
double ep = 1 - (double)numGoodPoints / (double)numPoints;
if( ep == 1 )
{
ep = 0.5;/* if there is not good points set ration of outliers to 50% */
}
double newNumSamples = (log(1-p) / log(1-pow(1-ep,6)));
double newNumSamples = (log(1-p) / log(1-pow(1-ep,6)));
if( newNumSamples < double(NumSamples) )
{
NumSamples = cvRound(newNumSamples);

View File

@@ -45,7 +45,7 @@ CV_IMPL void
cvDeInterlace( const CvArr* framearr, CvArr* fieldEven, CvArr* fieldOdd )
{
CV_FUNCNAME("cvDeInterlace");
__BEGIN__;
CvMat frame_stub, *frame = (CvMat*)framearr;
@@ -74,7 +74,7 @@ cvDeInterlace( const CvArr* framearr, CvArr* fieldEven, CvArr* fieldOdd )
frame->data.ptr + frame->step*y*2, size.width );
memcpy( odd->data.ptr + even->step*y,
frame->data.ptr + frame->step*(y*2+1), size.width );
}
}
__END__;
}