Fixed number of warnings. Fixed mingw64 build.
This commit is contained in:
@@ -41,18 +41,9 @@
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning(disable:4786) // Disable MSVC warnings in the standard library.
|
||||
#pragma warning(disable:4100)
|
||||
#pragma warning(disable:4512)
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning(default:4100)
|
||||
#pragma warning(default:4512)
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZEOF(a) (sizeof(a)/sizeof((a)[0]))
|
||||
|
||||
|
@@ -53,10 +53,6 @@
|
||||
#include "assert.h"
|
||||
#include "math.h"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||
#pragma warning(disable: 4512) // suppress "assignment operator could not be generated"
|
||||
#endif
|
||||
|
||||
// J.S. Beis and D.G. Lowe. Shape indexing using approximate nearest-neighbor search
|
||||
// in highdimensional spaces. In Proc. IEEE Conf. Comp. Vision Patt. Recog.,
|
||||
// pages 1000--1006, 1997. http://citeseer.ist.psu.edu/beis97shape.html
|
||||
@@ -140,6 +136,8 @@ private:
|
||||
bool operator() (const __instype & lhs) const {
|
||||
return deref(ctor(lhs), dim) <= deref(ctor(pivot), dim);
|
||||
}
|
||||
private:
|
||||
median_pr& operator=(const median_pr&);
|
||||
};
|
||||
|
||||
template < class __instype, class __valuector >
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -206,7 +206,6 @@ CvBlobTrackerAuto1::~CvBlobTrackerAuto1()
|
||||
void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
{
|
||||
int CurBlobNum = 0;
|
||||
int i;
|
||||
IplImage* pFG = pMask;
|
||||
|
||||
/* Bump frame counter: */
|
||||
@@ -268,15 +267,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBT)
|
||||
{
|
||||
int i;
|
||||
m_pBT->Process(pImg, pFG);
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update data of tracked blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
int BlobID = CV_BLOB_ID(pB);
|
||||
int i = m_pBT->GetBlobIndexByID(BlobID);
|
||||
m_pBT->ProcessBlob(i, pB, pImg, pFG);
|
||||
int idx = m_pBT->GetBlobIndexByID(BlobID);
|
||||
m_pBT->ProcessBlob(idx, pB, pImg, pFG);
|
||||
pB->ID = BlobID;
|
||||
}
|
||||
CurBlobNum = m_pBT->GetBlobNum();
|
||||
@@ -286,9 +284,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
/* This part should be removed: */
|
||||
if(m_BTReal && m_pBT)
|
||||
{ /* Update blob list (detect new blob for real blob tracker): */
|
||||
int i;
|
||||
|
||||
for(i=m_pBT->GetBlobNum(); i>0; --i)
|
||||
for(int i=m_pBT->GetBlobNum(); i>0; --i)
|
||||
{ /* Update data of tracked blob list: */
|
||||
CvBlob* pB = m_pBT->GetBlob(i-1);
|
||||
if(pB && m_BlobList.GetBlobByID(CV_BLOB_ID(pB)) == NULL )
|
||||
@@ -301,7 +297,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
} /* Next blob. */
|
||||
|
||||
/* Delete blobs: */
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
if(pB && m_pBT->GetBlobByID(CV_BLOB_ID(pB)) == NULL )
|
||||
@@ -315,15 +311,14 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBTPostProc)
|
||||
{ /* Post-processing module: */
|
||||
int i;
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
m_pBTPostProc->AddBlob(pB);
|
||||
}
|
||||
m_pBTPostProc->Process();
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update tracked-blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
int BlobID = CV_BLOB_ID(pB);
|
||||
@@ -423,12 +418,12 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
if(m_pBD->DetectNewBlob(pImg, pFG, &NewBlobList, &m_BlobList))
|
||||
{ /* Add new blob to tracker and blob list: */
|
||||
int i;
|
||||
IplImage* pMask = pFG;
|
||||
IplImage* pmask = pFG;
|
||||
|
||||
/*if(0)if(NewBlobList.GetBlobNum()>0 && pFG )
|
||||
{// erode FG mask (only for FG_0 and MS1||MS2)
|
||||
pMask = cvCloneImage(pFG);
|
||||
cvErode(pFG,pMask,NULL,2);
|
||||
pmask = cvCloneImage(pFG);
|
||||
cvErode(pFG,pmask,NULL,2);
|
||||
}*/
|
||||
|
||||
for(i=0; i<NewBlobList.GetBlobNum(); ++i)
|
||||
@@ -438,7 +433,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
|
||||
if(pBN && pBN->w >= CV_BLOB_MINW && pBN->h >= CV_BLOB_MINH)
|
||||
{
|
||||
CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pMask );
|
||||
CvBlob* pB = m_pBT->AddBlob(pBN, pImg, pmask );
|
||||
if(pB)
|
||||
{
|
||||
NewB.blob = pB[0];
|
||||
@@ -449,7 +444,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
}
|
||||
} /* Add next blob from list of detected blob. */
|
||||
|
||||
if(pMask != pFG) cvReleaseImage(&pMask);
|
||||
if(pmask != pFG) cvReleaseImage(&pmask);
|
||||
|
||||
} /* Create and add new blobs and trackers. */
|
||||
|
||||
@@ -460,7 +455,7 @@ void CvBlobTrackerAuto1::Process(IplImage* pImg, IplImage* pMask)
|
||||
TIME_BEGIN()
|
||||
if(m_pBTGen)
|
||||
{ /* Run track generator: */
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Update data of tracked blob list: */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
m_pBTGen->AddBlob(pB);
|
||||
|
@@ -175,7 +175,6 @@ public:
|
||||
{
|
||||
CvSeq* cnts;
|
||||
CvSeq* cnt;
|
||||
int i;
|
||||
//CvMat* pMC = NULL;
|
||||
|
||||
if(m_BlobList.GetBlobNum() <= 0 ) return;
|
||||
@@ -219,7 +218,7 @@ public:
|
||||
cvReleaseImage(&pBin);
|
||||
}
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Predict new blob position. */
|
||||
CvBlob* pB = NULL;
|
||||
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
|
||||
@@ -237,11 +236,10 @@ public:
|
||||
|
||||
if(m_BlobList.GetBlobNum()>0 && m_BlobListNew.GetBlobNum()>0)
|
||||
{ /* Resolve new blob to old: */
|
||||
int i,j;
|
||||
int NOld = m_BlobList.GetBlobNum();
|
||||
int NNew = m_BlobListNew.GetBlobNum();
|
||||
|
||||
for(i=0; i<NOld; i++)
|
||||
for(int i=0; i<NOld; i++)
|
||||
{ /* Set 0 collision and clear all hyp: */
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
|
||||
pF->Collision = 0;
|
||||
@@ -249,12 +247,12 @@ public:
|
||||
} /* Set 0 collision. */
|
||||
|
||||
/* Create correspondence records: */
|
||||
for(j=0; j<NNew; ++j)
|
||||
for(int j=0; j<NNew; ++j)
|
||||
{
|
||||
CvBlob* pB1 = m_BlobListNew.GetBlob(j);
|
||||
DefBlobTrackerCR* pFLast = NULL;
|
||||
|
||||
for(i=0; i<NOld; i++)
|
||||
for(int i=0; i<NOld; i++)
|
||||
{ /* Check intersection: */
|
||||
int Intersection = 0;
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i);
|
||||
@@ -276,14 +274,13 @@ public:
|
||||
} /* Check next new blob. */
|
||||
} /* Resolve new blob to old. */
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Track each blob. */
|
||||
CvBlob* pB = m_BlobList.GetBlob(i-1);
|
||||
DefBlobTrackerCR* pBT = (DefBlobTrackerCR*)pB;
|
||||
int BlobID = CV_BLOB_ID(pB);
|
||||
//CvBlob* pBBest = NULL;
|
||||
//double DistBest = -1;
|
||||
int j;
|
||||
|
||||
if(pBT->pResolver)
|
||||
{
|
||||
@@ -309,7 +306,7 @@ public:
|
||||
CvBlob* pBBest = NULL;
|
||||
double DistBest = -1;
|
||||
double CMax = 0;
|
||||
for(j=pBT->pBlobHyp->GetBlobNum();j>0;--j)
|
||||
for(int j=pBT->pBlobHyp->GetBlobNum();j>0;--j)
|
||||
{ /* Find best CC: */
|
||||
CvBlob* pBNew = pBT->pBlobHyp->GetBlob(j-1);
|
||||
if(pBT->pResolver)
|
||||
@@ -354,8 +351,7 @@ public:
|
||||
if(m_Wnd)
|
||||
{
|
||||
IplImage* pI = cvCloneImage(pImg);
|
||||
int i;
|
||||
for(i=m_BlobListNew.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobListNew.GetBlobNum(); i>0; --i)
|
||||
{ /* Draw each new CC: */
|
||||
CvBlob* pB = m_BlobListNew.GetBlob(i-1);
|
||||
CvPoint p = cvPointFrom32f(CV_BLOB_CENTER(pB));
|
||||
@@ -369,7 +365,7 @@ public:
|
||||
CV_RGB(255,255,0), 1 );
|
||||
}
|
||||
|
||||
for(i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
for(int i=m_BlobList.GetBlobNum(); i>0; --i)
|
||||
{ /* Draw each new CC: */
|
||||
DefBlobTrackerCR* pF = (DefBlobTrackerCR*)m_BlobList.GetBlob(i-1);
|
||||
CvBlob* pB = &(pF->BlobPredict);
|
||||
|
@@ -395,7 +395,7 @@ public:
|
||||
|
||||
{ /* Mean shift in scale space: */
|
||||
float news = 0;
|
||||
float sum = 0;
|
||||
float sum1 = 0;
|
||||
float scale;
|
||||
|
||||
Center = cvPoint(cvRound(m_Blob.x),cvRound(m_Blob.y));
|
||||
@@ -407,13 +407,13 @@ public:
|
||||
{
|
||||
double W = cvDotProduct(m_Weights, m_KernelMeanShiftG[si]);;
|
||||
int s = si-SCALE_RANGE;
|
||||
sum += (float)fabs(W);
|
||||
sum1 += (float)fabs(W);
|
||||
news += (float)(s*W);
|
||||
}
|
||||
|
||||
if(sum>0)
|
||||
if(sum1>0)
|
||||
{
|
||||
news /= sum;
|
||||
news /= sum1;
|
||||
}
|
||||
|
||||
scale = (float)pow((double)SCALE_BASE,(double)news);
|
||||
|
@@ -74,9 +74,9 @@ public:
|
||||
{
|
||||
float WSum = 0;
|
||||
int i;
|
||||
int index = m_Frame % TIME_WND;
|
||||
int idx = m_Frame % TIME_WND;
|
||||
int size = MIN((m_Frame+1), TIME_WND);
|
||||
m_pBlobs[index] = pBlob[0];
|
||||
m_pBlobs[idx] = pBlob[0];
|
||||
m_Blob.x = m_Blob.y = m_Blob.w = m_Blob.h = 0;
|
||||
|
||||
for(i=0; i<size; ++i)
|
||||
|
@@ -44,10 +44,6 @@
|
||||
|
||||
#undef quad
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4701 )
|
||||
#endif
|
||||
|
||||
CvCalibFilter::CvCalibFilter()
|
||||
{
|
||||
/* etalon data */
|
||||
@@ -93,7 +89,7 @@ CvCalibFilter::~CvCalibFilter()
|
||||
|
||||
|
||||
bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
int pointCount, CvPoint2D32f* points )
|
||||
int pointCount, CvPoint2D32f* _points )
|
||||
{
|
||||
int i, arrSize;
|
||||
|
||||
@@ -132,7 +128,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
case CV_CALIB_ETALON_USER:
|
||||
etalonParamCount = 0;
|
||||
|
||||
if( !points || pointCount < 4 )
|
||||
if( !_points || pointCount < 4 )
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
@@ -188,9 +184,9 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
{
|
||||
memcpy( etalonParams, params, arrSize );
|
||||
}
|
||||
if (points != NULL)
|
||||
if (_points != NULL)
|
||||
{
|
||||
memcpy( etalonPoints, points, arrSize );
|
||||
memcpy( etalonPoints, _points, arrSize );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -205,7 +201,7 @@ bool CvCalibFilter::SetEtalon( CvCalibEtalonType type, double* params,
|
||||
|
||||
CvCalibEtalonType
|
||||
CvCalibFilter::GetEtalon( int* paramCount, const double** params,
|
||||
int* pointCount, const CvPoint2D32f** points ) const
|
||||
int* pointCount, const CvPoint2D32f** _points ) const
|
||||
{
|
||||
if( paramCount )
|
||||
*paramCount = etalonParamCount;
|
||||
@@ -216,8 +212,8 @@ CvCalibFilter::GetEtalon( int* paramCount, const double** params,
|
||||
if( pointCount )
|
||||
*pointCount = etalonPointCount;
|
||||
|
||||
if( points )
|
||||
*points = etalonPoints;
|
||||
if( _points )
|
||||
*_points = etalonPoints;
|
||||
|
||||
return etalonType;
|
||||
}
|
||||
|
@@ -311,19 +311,19 @@ int RandomizedTree::getIndex(uchar* patch_data) const
|
||||
}
|
||||
|
||||
void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
|
||||
RNG &rng, int depth, int views, size_t reduced_num_dim,
|
||||
RNG &rng, int _depth, int views, size_t reduced_num_dim,
|
||||
int num_quant_bits)
|
||||
{
|
||||
PatchGenerator make_patch;
|
||||
train(base_set, rng, make_patch, depth, views, reduced_num_dim, num_quant_bits);
|
||||
train(base_set, rng, make_patch, _depth, views, reduced_num_dim, num_quant_bits);
|
||||
}
|
||||
|
||||
void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
|
||||
RNG &rng, PatchGenerator &make_patch,
|
||||
int depth, int views, size_t reduced_num_dim,
|
||||
int _depth, int views, size_t reduced_num_dim,
|
||||
int num_quant_bits)
|
||||
{
|
||||
init((int)base_set.size(), depth, rng);
|
||||
init((int)base_set.size(), _depth, rng);
|
||||
|
||||
Mat patch;
|
||||
|
||||
@@ -381,10 +381,10 @@ void RandomizedTree::freePosteriors(int which)
|
||||
classes_ = -1;
|
||||
}
|
||||
|
||||
void RandomizedTree::init(int num_classes, int depth, RNG &rng)
|
||||
void RandomizedTree::init(int num_classes, int _depth, RNG &rng)
|
||||
{
|
||||
depth_ = depth;
|
||||
num_leaves_ = 1 << depth; // 2**d
|
||||
depth_ = _depth;
|
||||
num_leaves_ = 1 << _depth; // 2**d
|
||||
int num_nodes = num_leaves_ - 1; // 2**d - 1
|
||||
|
||||
// Initialize probabilities and counts to 0
|
||||
@@ -631,9 +631,9 @@ void RandomizedTree::savePosteriors(std::string url, bool append)
|
||||
for (int i=0; i<num_leaves_; i++) {
|
||||
float *post = posteriors_[i];
|
||||
char buf[20];
|
||||
for (int i=0; i<classes_; i++) {
|
||||
for (int j=0; j<classes_; j++) {
|
||||
sprintf(buf, "%.10e", *post++);
|
||||
file << buf << ((i<classes_-1) ? " " : "");
|
||||
file << buf << ((j<classes_-1) ? " " : "");
|
||||
}
|
||||
file << std::endl;
|
||||
}
|
||||
@@ -645,8 +645,8 @@ void RandomizedTree::savePosteriors2(std::string url, bool append)
|
||||
std::ofstream file(url.c_str(), (append?std::ios::app:std::ios::out));
|
||||
for (int i=0; i<num_leaves_; i++) {
|
||||
uchar *post = posteriors2_[i];
|
||||
for (int i=0; i<classes_; i++)
|
||||
file << int(*post++) << (i<classes_-1?" ":"");
|
||||
for (int j=0; j<classes_; j++)
|
||||
file << int(*post++) << (j<classes_-1?" ":"");
|
||||
file << std::endl;
|
||||
}
|
||||
file.close();
|
||||
|
@@ -190,79 +190,79 @@ static void icvFindStereoCorrespondenceByBirchfieldDP( uchar* src1, uchar* src2,
|
||||
|
||||
for( x = 1; x < imgW; x++ )
|
||||
{
|
||||
int d = MIN( x + 1, maxDisparity + 1);
|
||||
int dp = MIN( x + 1, maxDisparity + 1);
|
||||
uchar* _edges = edges + y*imgW + x;
|
||||
int e0 = _edges[0] & 1;
|
||||
_CvDPCell* _cell = cells + x*dispH;
|
||||
|
||||
do
|
||||
{
|
||||
int s = dsi[d*imgW+x];
|
||||
int _s = dsi[dp*imgW+x];
|
||||
int sum[3];
|
||||
|
||||
//check left step
|
||||
sum[0] = _cell[d-dispH].sum - param2;
|
||||
sum[0] = _cell[dp-dispH].sum - param2;
|
||||
|
||||
//check up step
|
||||
if( _cell[d+1].step != ICV_DP_STEP_DIAG && e0 )
|
||||
if( _cell[dp+1].step != ICV_DP_STEP_DIAG && e0 )
|
||||
{
|
||||
sum[1] = _cell[d+1].sum + param1;
|
||||
sum[1] = _cell[dp+1].sum + param1;
|
||||
|
||||
if( _cell[d-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-d] & 2) )
|
||||
if( _cell[dp-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-dp] & 2) )
|
||||
{
|
||||
int t;
|
||||
|
||||
sum[2] = _cell[d-1-dispH].sum + param1;
|
||||
sum[2] = _cell[dp-1-dispH].sum + param1;
|
||||
|
||||
t = sum[1] < sum[0];
|
||||
|
||||
//choose local-optimal pass
|
||||
if( sum[t] <= sum[2] )
|
||||
{
|
||||
_cell[d].step = (uchar)t;
|
||||
_cell[d].sum = sum[t] + s;
|
||||
_cell[dp].step = (uchar)t;
|
||||
_cell[dp].sum = sum[t] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_DIAG;
|
||||
_cell[d].sum = sum[2] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_DIAG;
|
||||
_cell[dp].sum = sum[2] + _s;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( sum[0] <= sum[1] )
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_UP;
|
||||
_cell[d].sum = sum[1] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_UP;
|
||||
_cell[dp].sum = sum[1] + _s;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( _cell[d-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-d] & 2) )
|
||||
else if( _cell[dp-1-dispH].step != ICV_DP_STEP_UP && (_edges[1-dp] & 2) )
|
||||
{
|
||||
sum[2] = _cell[d-1-dispH].sum + param1;
|
||||
sum[2] = _cell[dp-1-dispH].sum + param1;
|
||||
if( sum[0] <= sum[2] )
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_DIAG;
|
||||
_cell[d].sum = sum[2] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_DIAG;
|
||||
_cell[dp].sum = sum[2] + _s;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_cell[d].step = ICV_DP_STEP_LEFT;
|
||||
_cell[d].sum = sum[0] + s;
|
||||
_cell[dp].step = ICV_DP_STEP_LEFT;
|
||||
_cell[dp].sum = sum[0] + _s;
|
||||
}
|
||||
}
|
||||
while( --d );
|
||||
while( --dp );
|
||||
}// for x
|
||||
|
||||
//extract optimal way and fill disparity image
|
||||
|
@@ -206,7 +206,7 @@ icvJacobiEigens_32f(float *A, float *V, float *E, int n, float eps)
|
||||
//
|
||||
// Returns: CV_NO_ERR or error code
|
||||
//
|
||||
// Notes:
|
||||
// Notes:
|
||||
//F*/
|
||||
static CvStatus CV_STDCALL
|
||||
icvCalcCovarMatrixEx_8u32fR( int nObjects, void *input, int objStep1,
|
||||
@@ -539,8 +539,7 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
|
||||
/* Buffer size determination */
|
||||
if( ioFlags )
|
||||
{
|
||||
int size = icvDefaultBufferSize();
|
||||
ioBufSize = MIN( size, n );
|
||||
ioBufSize = MIN( icvDefaultBufferSize(), n );
|
||||
}
|
||||
|
||||
/* memory allocation (if necesseay) */
|
||||
@@ -695,13 +694,13 @@ icvCalcEigenObjects_8u32fR( int nObjects, void* input, int objStep,
|
||||
|
||||
for( igr = 0; igr < ngr; igr++ )
|
||||
{
|
||||
int i, io, ie, imin = igr * nio, imax = imin + nio;
|
||||
int io, ie, imin = igr * nio, imax = imin + nio;
|
||||
|
||||
if( imax > m1 )
|
||||
imax = m1;
|
||||
|
||||
for( i = 0; i < eigSize.width * (imax - imin); i++ )
|
||||
((float *) buffer)[i] = 0.f;
|
||||
for(int k = 0; k < eigSize.width * (imax - imin); k++ )
|
||||
((float *) buffer)[k] = 0.f;
|
||||
|
||||
for( io = 0; io < nObjects; io++ )
|
||||
{
|
||||
@@ -1313,7 +1312,7 @@ cvCalcEigenObjects( int nObjects,
|
||||
int ioBufSize,
|
||||
void* userData,
|
||||
CvTermCriteria* calcLimit,
|
||||
IplImage* avg,
|
||||
IplImage* avg,
|
||||
float* eigVals )
|
||||
{
|
||||
float *avg_data;
|
||||
@@ -1570,7 +1569,7 @@ cvCalcDecompCoeff( IplImage * obj, IplImage * eigObj, IplImage * avg )
|
||||
avg_data, avg_step, obj_size );
|
||||
|
||||
__END__;
|
||||
|
||||
|
||||
return coeff;
|
||||
}
|
||||
|
||||
@@ -1598,9 +1597,9 @@ CV_IMPL void
|
||||
cvEigenDecomposite( IplImage* obj,
|
||||
int nEigObjs,
|
||||
void* eigInput,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
IplImage* avg,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
IplImage* avg,
|
||||
float* coeffs )
|
||||
{
|
||||
float *avg_data;
|
||||
@@ -1716,7 +1715,7 @@ cvEigenProjection( void* eigInput,
|
||||
int nEigObjs,
|
||||
int ioFlags,
|
||||
void* userData,
|
||||
float* coeffs,
|
||||
float* coeffs,
|
||||
IplImage* avg,
|
||||
IplImage* proj )
|
||||
{
|
||||
|
@@ -158,7 +158,7 @@ bool CvEM::train( const CvMat* _samples, const CvMat* _sample_idx,
|
||||
Mat samples = cvarrToMat(_samples), labels0, labels;
|
||||
if( _labels )
|
||||
labels0 = labels = cvarrToMat(_labels);
|
||||
|
||||
|
||||
bool isOk = train(samples, Mat(), _params, _labels ? &labels : 0);
|
||||
CV_Assert( labels0.data == labels.data );
|
||||
|
||||
@@ -202,8 +202,8 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
|
||||
{
|
||||
CV_Assert(_sample_idx.empty());
|
||||
Mat prbs, weights, means, logLikelihoods;
|
||||
std::vector<Mat> covsHdrs;
|
||||
init_params(_params, prbs, weights, means, covsHdrs);
|
||||
std::vector<Mat> covshdrs;
|
||||
init_params(_params, prbs, weights, means, covshdrs);
|
||||
|
||||
emObj = EM(_params.nclusters, _params.cov_mat_type, _params.term_crit);
|
||||
bool isOk = false;
|
||||
@@ -211,14 +211,14 @@ bool CvEM::train( const Mat& _samples, const Mat& _sample_idx,
|
||||
isOk = emObj.train(_samples,
|
||||
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
|
||||
else if( _params.start_step == EM::START_E_STEP )
|
||||
isOk = emObj.trainE(_samples, means, covsHdrs, weights,
|
||||
isOk = emObj.trainE(_samples, means, covshdrs, weights,
|
||||
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
|
||||
else if( _params.start_step == EM::START_M_STEP )
|
||||
isOk = emObj.trainM(_samples, prbs,
|
||||
logLikelihoods, _labels ? _OutputArray(*_labels) : cv::noArray(), probs);
|
||||
else
|
||||
CV_Error(CV_StsBadArg, "Bad start type of EM algorithm");
|
||||
|
||||
|
||||
if(isOk)
|
||||
{
|
||||
logLikelihood = sum(logLikelihoods).val[0];
|
||||
|
@@ -117,11 +117,11 @@ static void cvFindBlobsByCCClasters(IplImage* pFG, CvBlobSeq* pBlobs, CvMemStora
|
||||
for(cnt_cur=0; cnt_cur<clasters->total; ++cnt_cur)
|
||||
{
|
||||
CvRect rect;
|
||||
CvSeq* cnt;
|
||||
CvSeq* cont;
|
||||
int k = *(int*)cvGetSeqElem( clasters, cnt_cur );
|
||||
if(k!=claster_cur) continue;
|
||||
cnt = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur );
|
||||
rect = ((CvContour*)cnt)->rect;
|
||||
cont = *(CvSeq**)cvGetSeqElem( cnt_list, cnt_cur );
|
||||
rect = ((CvContour*)cont)->rect;
|
||||
|
||||
if(rect_res.height<0)
|
||||
{
|
||||
@@ -399,7 +399,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
if(Good)
|
||||
do{ /* For each configuration: */
|
||||
CvBlob* pBL[EBD_FRAME_NUM];
|
||||
int Good = 1;
|
||||
int good = 1;
|
||||
double Error = 0;
|
||||
CvBlob* pBNew = m_pBlobLists[EBD_FRAME_NUM-1]->GetBlob(pBLIndex[EBD_FRAME_NUM-1]);
|
||||
|
||||
@@ -408,7 +408,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
Count++;
|
||||
|
||||
/* Check intersection last blob with existed: */
|
||||
if(Good && pOldBlobList)
|
||||
if(good && pOldBlobList)
|
||||
{ /* Check intersection last blob with existed: */
|
||||
int k;
|
||||
for(k=pOldBlobList->GetBlobNum(); k>0; --k)
|
||||
@@ -416,22 +416,22 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
CvBlob* pBOld = pOldBlobList->GetBlob(k-1);
|
||||
if((fabs(pBOld->x-pBNew->x) < (CV_BLOB_RX(pBOld)+CV_BLOB_RX(pBNew))) &&
|
||||
(fabs(pBOld->y-pBNew->y) < (CV_BLOB_RY(pBOld)+CV_BLOB_RY(pBNew))))
|
||||
Good = 0;
|
||||
good = 0;
|
||||
}
|
||||
} /* Check intersection last blob with existed. */
|
||||
|
||||
/* Check distance to image border: */
|
||||
if(Good)
|
||||
if(good)
|
||||
{ /* Check distance to image border: */
|
||||
CvBlob* pB = pBNew;
|
||||
float dx = MIN(pB->x,S.width-pB->x)/CV_BLOB_RX(pB);
|
||||
float dy = MIN(pB->y,S.height-pB->y)/CV_BLOB_RY(pB);
|
||||
|
||||
if(dx < 1.1 || dy < 1.1) Good = 0;
|
||||
if(dx < 1.1 || dy < 1.1) good = 0;
|
||||
} /* Check distance to image border. */
|
||||
|
||||
/* Check uniform motion: */
|
||||
if(Good)
|
||||
if(good)
|
||||
{
|
||||
int N = EBD_FRAME_NUM;
|
||||
float sum[2] = {0,0};
|
||||
@@ -466,13 +466,13 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
if( Error > S.width*0.01 ||
|
||||
fabs(a[0])>S.width*0.1 ||
|
||||
fabs(a[1])>S.height*0.1)
|
||||
Good = 0;
|
||||
good = 0;
|
||||
|
||||
} /* Check configuration. */
|
||||
|
||||
|
||||
/* New best trajectory: */
|
||||
if(Good && (BestError == -1 || BestError > Error))
|
||||
if(good && (BestError == -1 || BestError > Error))
|
||||
{
|
||||
for(i=0; i<EBD_FRAME_NUM; ++i)
|
||||
{
|
||||
@@ -491,7 +491,7 @@ int CvBlobDetectorSimple::DetectNewBlob(IplImage* /*pImg*/, IplImage* pFGMask, C
|
||||
|
||||
if(i==EBD_FRAME_NUM)finish=1;
|
||||
|
||||
} while(!finish); /* Check next time configuration of connected components. */
|
||||
} while(!finish); /* Check next time configuration of connected components. */
|
||||
|
||||
#if 0
|
||||
{/**/
|
||||
|
@@ -2729,8 +2729,7 @@ static int icvSelectBestRt( int numImages,
|
||||
/* allocate memory for 64d data */
|
||||
int totalNum = 0;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < numImages; i++ )
|
||||
for(int i = 0; i < numImages; i++ )
|
||||
{
|
||||
totalNum += numPoints[i];
|
||||
}
|
||||
@@ -2828,8 +2827,7 @@ static int icvSelectBestRt( int numImages,
|
||||
points2 = (CvPoint3D64d*)calloc(numberPnt,sizeof(CvPoint3D64d));
|
||||
|
||||
/* Transform object points to first camera position */
|
||||
int i;
|
||||
for( i = 0; i < numberPnt; i++ )
|
||||
for(int i = 0; i < numberPnt; i++ )
|
||||
{
|
||||
/* Create second camera point */
|
||||
CvPoint3D64d tmpPoint;
|
||||
@@ -2859,8 +2857,6 @@ static int icvSelectBestRt( int numImages,
|
||||
dy = tmpPoint2.y - points1[i].y;
|
||||
dz = tmpPoint2.z - points1[i].z;
|
||||
err = sqrt(dx*dx + dy*dy + dz*dz);*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -3094,8 +3090,7 @@ int icvComputeRestStereoParams(CvStereoCamera *stereoparams)
|
||||
corns[3].x = 0;
|
||||
corns[3].y = (float)(stereoparams->camera[0]->imgSize[1]-1);
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 4; i++ )
|
||||
for(int i = 0; i < 4; i++ )
|
||||
{
|
||||
/* For first camera */
|
||||
icvConvertWarpCoordinates( stereoparams->coeffs[0],
|
||||
|
@@ -67,7 +67,7 @@ FaceDetection::FaceDetection()
|
||||
m_iNumLayers = 16;
|
||||
assert(m_iNumLayers <= MAX_LAYERS);
|
||||
m_pFaceList = new FaceDetectionList();
|
||||
|
||||
|
||||
|
||||
|
||||
m_bBoosting = false;
|
||||
@@ -87,7 +87,7 @@ FaceDetection::~FaceDetection()
|
||||
|
||||
if (m_mstgRects)
|
||||
cvReleaseMemStorage(&m_mstgRects);
|
||||
|
||||
|
||||
|
||||
}// ~FaceDetection()
|
||||
|
||||
@@ -111,7 +111,7 @@ void FaceDetection::FindContours(IplImage* imgGray)
|
||||
m_mstgRects = cvCreateMemStorage();
|
||||
if (NULL == m_mstgRects)
|
||||
return;
|
||||
m_seqRects = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvContourRect), m_mstgRects);
|
||||
m_seqRects = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvContourRect), m_mstgRects);
|
||||
if (NULL == m_seqRects)
|
||||
return;
|
||||
// find contours
|
||||
@@ -148,23 +148,23 @@ void FaceDetection::ThresholdingParam(IplImage *imgGray, int iNumLayers, int &iM
|
||||
buffImg += imgGray->widthStep;
|
||||
}
|
||||
// params
|
||||
|
||||
|
||||
for (i = 0; i <= GIST_NUM; i ++)
|
||||
{
|
||||
if (gistImg[i] >= GIST_MIN)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
iMinLevel = i * GIST_STEP;
|
||||
|
||||
|
||||
for (i = GIST_NUM; i >= 0; i --)
|
||||
{
|
||||
if (gistImg[i] >= GIST_MIN)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
iMaxLevel = i * GIST_STEP;
|
||||
|
||||
|
||||
int dLevels = iMaxLevel - iMinLevel;
|
||||
if (dLevels <= 0)
|
||||
{
|
||||
@@ -191,12 +191,12 @@ void FaceDetection::ThresholdingParam(IplImage *imgGray, int iNumLayers, int &iM
|
||||
|
||||
void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
{
|
||||
|
||||
|
||||
Face * tmp;
|
||||
|
||||
|
||||
double Max = 0;
|
||||
double CurStat = 0;
|
||||
|
||||
|
||||
FaceData tmpData;
|
||||
if (m_bBoosting)
|
||||
{
|
||||
@@ -218,12 +218,12 @@ void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
if (CurStat > Max)
|
||||
Max = CurStat;
|
||||
}
|
||||
|
||||
|
||||
while ( (tmp = m_pFaceList->GetData()) != 0 )
|
||||
{
|
||||
tmp->CreateFace(&tmpData);
|
||||
CurStat = tmp->GetWeight();
|
||||
|
||||
|
||||
if (CurStat == Max)
|
||||
{
|
||||
CvFace tmpFace;
|
||||
@@ -232,7 +232,7 @@ void FaceDetection::CreateResults(CvSeq * lpSeq)
|
||||
tmpFace.RightEyeRect = tmpData.RightEyeRect;
|
||||
cvSeqPush(lpSeq,&tmpFace);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ void FaceDetection::AddContours2Rect(CvSeq *seq, int color, int iLayer)
|
||||
cvSeqPush(m_seqRects, &cr);
|
||||
for (CvSeq* internal = external->v_next; internal; internal = internal->h_next)
|
||||
{
|
||||
cr.r = cvContourBoundingRect(internal, 0);
|
||||
cr.r = cvContourBoundingRect(internal, 0);
|
||||
cr.pCenter.x = cr.r.x + cr.r.width / 2;
|
||||
cr.pCenter.y = cr.r.y + cr.r.height / 2;
|
||||
cr.iNumber = iLayer;
|
||||
@@ -294,8 +294,8 @@ void FaceDetection::FindFace(IplImage *img)
|
||||
if (m_bBoosting)
|
||||
PostBoostingFindCandidats(img);
|
||||
else
|
||||
FindCandidats();
|
||||
|
||||
FindCandidats();
|
||||
|
||||
}// void FaceDetection::FindFace(IplImage *img)
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ void FaceDetection::FindCandidats()
|
||||
RFace * lpFace1 = 0;
|
||||
bool bInvalidRect1 = false;
|
||||
CvRect * lpRect1 = NULL;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < m_seqRects->total; i++)
|
||||
@@ -320,38 +320,38 @@ void FaceDetection::FindCandidats()
|
||||
3*(double)rect.width/(double)4,
|
||||
(double)rect.width/(double)2,
|
||||
(double)rect.width/(double)2);
|
||||
|
||||
|
||||
|
||||
lpFace1 = new RFace(lpFaceTemplate1);
|
||||
|
||||
|
||||
for (int j = 0; j < m_seqRects->total; j++)
|
||||
{
|
||||
CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, j);
|
||||
|
||||
CvContourRect* prect = (CvContourRect*)cvGetSeqElem(m_seqRects, j);
|
||||
|
||||
if ( !bInvalidRect1 )
|
||||
{
|
||||
lpRect1 = NULL;
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
*lpRect1 = prect->r;
|
||||
}else
|
||||
{
|
||||
delete lpRect1;
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
*lpRect1 = prect->r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( lpFace1->isFeature(lpRect1) )
|
||||
{
|
||||
{
|
||||
bFound1 = true;
|
||||
bInvalidRect1 = false;
|
||||
}else
|
||||
bInvalidRect1 = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (bFound1)
|
||||
{
|
||||
m_pFaceList->AddElem(lpFace1);
|
||||
@@ -363,10 +363,10 @@ void FaceDetection::FindCandidats()
|
||||
lpFace1 = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
delete lpFaceTemplate1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
@@ -381,10 +381,10 @@ void FaceDetection::FindCandidats()
|
||||
void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
{
|
||||
BoostingFaceTemplate * lpFaceTemplate1 = 0;
|
||||
RFace * lpFace1 = 0;
|
||||
RFace * lpFace1 = 0;
|
||||
bool bInvalidRect1 = false;
|
||||
CvRect * lpRect1 = NULL;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
if ( ( !FaceImage->roi ) )
|
||||
@@ -392,13 +392,13 @@ void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
else
|
||||
lpFaceTemplate1 = new BoostingFaceTemplate(3,cvRect(FaceImage->roi->xOffset,FaceImage->roi->yOffset,
|
||||
FaceImage->roi->width,FaceImage->roi->height));
|
||||
|
||||
|
||||
lpFace1 = new RFace(lpFaceTemplate1);
|
||||
|
||||
for (int i = 0; i < m_seqRects->total; i++)
|
||||
{
|
||||
CvContourRect* pRect = (CvContourRect*)cvGetSeqElem(m_seqRects, i);
|
||||
|
||||
|
||||
if ( !bInvalidRect1 )
|
||||
{
|
||||
lpRect1 = NULL;
|
||||
@@ -410,21 +410,21 @@ void FaceDetection::PostBoostingFindCandidats(IplImage * FaceImage)
|
||||
lpRect1 = new CvRect();
|
||||
*lpRect1 = pRect->r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( lpFace1->isFeature(lpRect1) )
|
||||
{
|
||||
{
|
||||
//bFound1 = true;
|
||||
bInvalidRect1 = false;
|
||||
}else
|
||||
bInvalidRect1 = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
m_pFaceList->AddElem(lpFace1);
|
||||
lpFace1 = NULL;
|
||||
|
||||
|
||||
delete lpFaceTemplate1;
|
||||
}
|
||||
catch(...)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -182,13 +182,13 @@ void CvImage::show( const char* window_name )
|
||||
|
||||
/////////////////////////////// CvMatrix implementation //////////////////////////////////
|
||||
|
||||
CvMatrix::CvMatrix( int rows, int cols, int type, CvMemStorage* storage, bool alloc_data )
|
||||
CvMatrix::CvMatrix( int _rows, int _cols, int _type, CvMemStorage* storage, bool alloc_data )
|
||||
{
|
||||
if( storage )
|
||||
{
|
||||
matrix = (CvMat*)cvMemStorageAlloc( storage, sizeof(*matrix) );
|
||||
cvInitMatHeader( matrix, rows, cols, type, alloc_data ?
|
||||
cvMemStorageAlloc( storage, rows*cols*CV_ELEM_SIZE(type) ) : 0 );
|
||||
cvInitMatHeader( matrix, _rows, _cols, _type, alloc_data ?
|
||||
cvMemStorageAlloc( storage, _rows*_cols*CV_ELEM_SIZE(_type) ) : 0 );
|
||||
}
|
||||
else
|
||||
matrix = 0;
|
||||
|
@@ -48,10 +48,6 @@
|
||||
#include "_kdtree.hpp"
|
||||
#include "_featuretree.h"
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1400
|
||||
#pragma warning(disable:4996) // suppress "function call with parameters may be unsafe" in std::copy
|
||||
#endif
|
||||
|
||||
class CvKDTreeWrap : public CvFeatureTree {
|
||||
template <class __scalartype, int __cvtype>
|
||||
struct deref {
|
||||
|
@@ -135,13 +135,11 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
|
||||
}
|
||||
/* ----- End test ----- */
|
||||
|
||||
int i;
|
||||
|
||||
/* Allocate memory for derivates */
|
||||
|
||||
double p[12];
|
||||
/* Copy projection matrix */
|
||||
for( i = 0; i < 12; i++ )
|
||||
for(int i = 0; i < 12; i++ )
|
||||
{
|
||||
p[i] = cvmGet(projMatr,i/4,i%4);
|
||||
}
|
||||
@@ -168,7 +166,6 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
|
||||
piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7];
|
||||
piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11];
|
||||
|
||||
int i;
|
||||
/* fill derivate by point */
|
||||
|
||||
double tmp3 = 1/(piX[2]*piX[2]);
|
||||
@@ -177,7 +174,7 @@ static void icvComputeDerivateProj(CvMat *points4D,CvMat *projMatr, CvMat *statu
|
||||
double tmp2 = -piX[1]*tmp3;
|
||||
|
||||
/* fill derivate by projection matrix */
|
||||
for( i = 0; i < 4; i++ )
|
||||
for(int i = 0; i < 4; i++ )
|
||||
{
|
||||
/* derivate for x */
|
||||
cvmSet(derivProj,currVisPoint*2,i,X[i]/piX[2]);//x' p1i
|
||||
@@ -291,8 +288,7 @@ static void icvComputeDerivatePoints(CvMat *points4D,CvMat *projMatr, CvMat *pre
|
||||
/* Compute derivates by points */
|
||||
|
||||
double p[12];
|
||||
int i;
|
||||
for( i = 0; i < 12; i++ )
|
||||
for(int i = 0; i < 12; i++ )
|
||||
{
|
||||
p[i] = cvmGet(projMatr,i/4,i%4);
|
||||
}
|
||||
@@ -316,13 +312,11 @@ static void icvComputeDerivatePoints(CvMat *points4D,CvMat *projMatr, CvMat *pre
|
||||
piX[1] = X[0]*p[4] + X[1]*p[5] + X[2]*p[6] + X[3]*p[7];
|
||||
piX[2] = X[0]*p[8] + X[1]*p[9] + X[2]*p[10] + X[3]*p[11];
|
||||
|
||||
int i,j;
|
||||
|
||||
double tmp3 = 1/(piX[2]*piX[2]);
|
||||
|
||||
for( j = 0; j < 2; j++ )//for x and y
|
||||
for(int j = 0; j < 2; j++ )//for x and y
|
||||
{
|
||||
for( i = 0; i < 4; i++ )// for X,Y,Z,W
|
||||
for(int i = 0; i < 4; i++ )// for X,Y,Z,W
|
||||
{
|
||||
cvmSet( derivPoint,
|
||||
j, currVisPoint*4+i,
|
||||
@@ -863,26 +857,25 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
|
||||
double point3D_dat[3];
|
||||
point3D = cvMat(3,1,CV_64F,point3D_dat);
|
||||
|
||||
int currPoint;
|
||||
int numVis = 0;
|
||||
double totalError = 0;
|
||||
for( currPoint = 0; currPoint < numPoints; currPoint++ )
|
||||
for(int curPoint = 0; curPoint < numPoints; curPoint++ )
|
||||
{
|
||||
if( cvmGet(presPoints[currImage],0,currPoint) > 0)
|
||||
if( cvmGet(presPoints[currImage],0,curPoint) > 0)
|
||||
{
|
||||
double dx,dy;
|
||||
cvGetCol(points4D,&point4D,currPoint);
|
||||
cvGetCol(points4D,&point4D,curPoint);
|
||||
cvmMul(projMatrs[currImage],&point4D,&point3D);
|
||||
double w = point3D_dat[2];
|
||||
double x = point3D_dat[0] / w;
|
||||
double y = point3D_dat[1] / w;
|
||||
|
||||
dx = cvmGet(projPoints[currImage],0,currPoint) - x;
|
||||
dy = cvmGet(projPoints[currImage],1,currPoint) - y;
|
||||
dx = cvmGet(projPoints[currImage],0,curPoint) - x;
|
||||
dy = cvmGet(projPoints[currImage],1,curPoint) - y;
|
||||
if( projError )
|
||||
{
|
||||
cvmSet(projError[currImage],0,currPoint,dx);
|
||||
cvmSet(projError[currImage],1,currPoint,dy);
|
||||
cvmSet(projError[currImage],0,curPoint,dx);
|
||||
cvmSet(projError[currImage],1,curPoint,dy);
|
||||
}
|
||||
totalError += sqrt(dx*dx+dy*dy);
|
||||
numVis++;
|
||||
@@ -1147,10 +1140,8 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
CV_CALL( changeVectorX_points4D = cvCreateMat(4,numPoints,CV_64F));
|
||||
CV_CALL( changeVectorX_projMatrs = cvCreateMat(3,4,CV_64F));
|
||||
|
||||
int currImage;
|
||||
|
||||
/* ----- Test input params ----- */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
/* Test size of input initial and result projection matrices */
|
||||
if( !CV_IS_MAT(projMatrs[currImage]) )
|
||||
@@ -1194,7 +1185,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* ----- End test ----- */
|
||||
|
||||
/* Copy projection matrices to vectorX0 */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
CV_CALL( vectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F));
|
||||
CV_CALL( newVectorX_projMatrs[currImage] = cvCreateMat(3,4,CV_64F));
|
||||
@@ -1230,7 +1221,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
CV_CALL( workMatrsInvVi[i] = cvCreateMat(4,4,CV_64F) );
|
||||
}
|
||||
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
CV_CALL( matrsUk[currImage] = cvCreateMat(12,12,CV_64F) );
|
||||
CV_CALL( workMatrsUk[currImage] = cvCreateMat(12,12,CV_64F) );
|
||||
@@ -1299,7 +1290,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* Compute error with observed value and computed projection */
|
||||
double prevError;
|
||||
prevError = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
|
||||
double currNorm = cvNorm(errorProjPoints[currImage]);
|
||||
@@ -1325,8 +1316,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
fprintf(file,"projection errors\n");
|
||||
|
||||
/* Print all proejction errors */
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++)
|
||||
for(int currImage = 0; currImage < numImages; currImage++)
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
int numPn = errorProjPoints[currImage]->cols;
|
||||
@@ -1419,7 +1409,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
#endif
|
||||
/* Copy matrices Uk to work matrices Uk */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvCopy(matrsUk[currImage],workMatrsUk[currImage]);
|
||||
}
|
||||
@@ -1459,7 +1449,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
{
|
||||
cvCopy(matrsVi[currV],workMatrVi);
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
cvmSet(workMatrVi,i,i,cvmGet(matrsVi[currV],i,i)*(1+alpha) );
|
||||
}
|
||||
@@ -1468,7 +1458,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
|
||||
/* Add alpha to matrUk and make matrix workMatrsUk */
|
||||
for( currImage = 0; currImage< numImages; currImage++ )
|
||||
for(int currImage = 0; currImage< numImages; currImage++ )
|
||||
{
|
||||
|
||||
for( i = 0; i < 12; i++ )
|
||||
@@ -1485,7 +1475,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
int currRowV;
|
||||
for( currRowV = 0; currRowV < 4; currRowV++ )
|
||||
{
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
for( int currCol = 0; currCol < 12; currCol++ )/* For each column of transposed matrix W */
|
||||
{
|
||||
@@ -1506,7 +1496,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
cvmMul(matrW,matrTmpSys1,matrSysDeltaP);
|
||||
|
||||
/* need to compute U-matrTmpSys2. But we compute matTmpSys2-U */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
CvMat subMatr;
|
||||
cvGetSubRect(matrSysDeltaP,&subMatr,cvRect(currImage*12,currImage*12,12,12));
|
||||
@@ -1536,8 +1526,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
FILE* file;
|
||||
file = fopen( TRACK_BUNDLE_FILE_DELTAP ,"w");
|
||||
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
int i;
|
||||
@@ -1576,7 +1565,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* We know delta and compute new value of vector X: nextVectX = vectX + deltas */
|
||||
|
||||
/* Compute new P */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
@@ -1604,7 +1593,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
icvProjPointsStatusFunc(numImages, newVectorX_points4D, newVectorX_projMatrs, pointsPres, projVisPoints);
|
||||
/* Compute error with observed value and computed projection */
|
||||
double newError = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvSub(observVisPoints[currImage],projVisPoints[currImage],errorProjPoints[currImage]);
|
||||
double currNorm = cvNorm(errorProjPoints[currImage]);
|
||||
@@ -1643,8 +1632,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/* Print all projection errors */
|
||||
#if 0
|
||||
fprintf(file,"projection errors\n");
|
||||
int currImage;
|
||||
for( currImage = 0; currImage < numImages; currImage++)
|
||||
for(int currImage = 0; currImage < numImages; currImage++)
|
||||
{
|
||||
fprintf(file,"\nImage=%d\n",currImage);
|
||||
int numPn = errorProjPoints[currImage]->cols;
|
||||
@@ -1676,7 +1664,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
double currNorm1 = 0;
|
||||
double currNorm2 = 0;
|
||||
/* compute norm for projection matrices */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
currNorm1 = cvNorm(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]);
|
||||
currNorm2 = cvNorm(newVectorX_projMatrs[currImage]);
|
||||
@@ -1713,7 +1701,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
}
|
||||
|
||||
alpha /= 10;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvCopy(newVectorX_projMatrs[currImage],vectorX_projMatrs[currImage]);
|
||||
}
|
||||
@@ -1745,7 +1733,7 @@ void cvOptimizeLevenbergMarquardtBundle( CvMat** projMatrs, CvMat** observProjPo
|
||||
/*--------------------------------------------*/
|
||||
/* Optimization complete copy computed params */
|
||||
/* Copy projection matrices */
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
for(int currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
cvCopy(newVectorX_projMatrs[currImage],resultProjMatrs[currImage]);
|
||||
}
|
||||
|
@@ -423,8 +423,8 @@ namespace cv{
|
||||
}
|
||||
|
||||
cvAdd(pca_descriptors[0].GetPatch(i), m_samples[i], m_samples[i]);
|
||||
double sum = cvSum(m_samples[i]).val[0];
|
||||
cvConvertScale(m_samples[i], m_samples[i], 1.0/sum);
|
||||
double sm = cvSum(m_samples[i]).val[0];
|
||||
cvConvertScale(m_samples[i], m_samples[i], 1.0/sm);
|
||||
|
||||
#if 0
|
||||
IplImage* test = cvCreateImage(cvSize(12, 12), IPL_DEPTH_8U, 1);
|
||||
@@ -1671,7 +1671,6 @@ namespace cv{
|
||||
|
||||
if (! m_pca_descriptors[i].ReadByName(fn, buf))
|
||||
{
|
||||
char buf[1024];
|
||||
sprintf(buf, "descriptor for pca component %d", i);
|
||||
m_pca_descriptors[i].ReadByName(fn, buf);
|
||||
}
|
||||
|
@@ -41,10 +41,6 @@
|
||||
#ifndef __OPENCV_PRECOMP_H__
|
||||
#define __OPENCV_PRECOMP_H__
|
||||
|
||||
#if defined _MSC_VER && _MSC_VER >= 1200
|
||||
#pragma warning( disable: 4251 4710 4711 4514 4996 )
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CVCONFIG_H
|
||||
#include "cvconfig.h"
|
||||
#endif
|
||||
|
@@ -143,7 +143,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
int norphans = 0, maxOrphans = _maxOrphans;
|
||||
GCVtx** orphans = _orphans;
|
||||
stub.next = nilNode;
|
||||
|
||||
|
||||
// initialize the active queue and the graph vertices
|
||||
for( i = 0; i < nvtx; i++ )
|
||||
{
|
||||
@@ -170,7 +170,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
GCVtx* v, *u;
|
||||
int e0 = -1, ei = 0, ej = 0, min_weight, weight;
|
||||
uchar vt;
|
||||
|
||||
|
||||
// grow S & T search trees, find an edge connecting them
|
||||
while( first != nilNode )
|
||||
{
|
||||
@@ -262,7 +262,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
v->parent = ORPHAN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
v->weight = (short)(v->weight + min_weight*(1-k*2));
|
||||
if( v->weight == 0 )
|
||||
{
|
||||
@@ -277,12 +277,12 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
curr_ts++;
|
||||
while( norphans > 0 )
|
||||
{
|
||||
GCVtx* v = orphans[--norphans];
|
||||
GCVtx* v1 = orphans[--norphans];
|
||||
int d, min_dist = INT_MAX;
|
||||
e0 = 0;
|
||||
vt = v->t;
|
||||
vt = v1->t;
|
||||
|
||||
for( ei = v->first; ei != 0; ei = edges[ei].next )
|
||||
for( ei = v1->first; ei != 0; ei = edges[ei].next )
|
||||
{
|
||||
if( edges[ei^(vt^1)].weight == 0 )
|
||||
continue;
|
||||
@@ -329,16 +329,16 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
}
|
||||
}
|
||||
|
||||
if( (v->parent = e0) > 0 )
|
||||
if( (v1->parent = e0) > 0 )
|
||||
{
|
||||
v->ts = curr_ts;
|
||||
v->dist = min_dist;
|
||||
v1->ts = curr_ts;
|
||||
v1->dist = min_dist;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* no parent is found */
|
||||
v->ts = 0;
|
||||
for( ei = v->first; ei != 0; ei = edges[ei].next )
|
||||
v1->ts = 0;
|
||||
for( ei = v1->first; ei != 0; ei = edges[ei].next )
|
||||
{
|
||||
u = edges[ei].dst;
|
||||
ej = u->parent;
|
||||
@@ -349,7 +349,7 @@ static int64 icvGCMaxFlow( GCVtx* vtx, int nvtx, GCEdge* edges, GCVtx**& _orphan
|
||||
u->next = nilNode;
|
||||
last = last->next = u;
|
||||
}
|
||||
if( ej > 0 && edges[ej].dst == v )
|
||||
if( ej > 0 && edges[ej].dst == v1 )
|
||||
{
|
||||
if( norphans >= maxOrphans )
|
||||
maxOrphans = icvGCResizeOrphansBuf( orphans, norphans );
|
||||
@@ -387,7 +387,7 @@ CvStereoGCState* cvCreateStereoGCState( int numberOfDisparities, int maxIters )
|
||||
void cvReleaseStereoGCState( CvStereoGCState** _state )
|
||||
{
|
||||
CvStereoGCState* state;
|
||||
|
||||
|
||||
if( !_state && !*_state )
|
||||
return;
|
||||
|
||||
@@ -438,7 +438,7 @@ static void icvInitGraySubpix( const CvMat* left, const CvMat* right,
|
||||
CvMat* left3, CvMat* right3 )
|
||||
{
|
||||
int k, x, y, rows = left->rows, cols = left->cols;
|
||||
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
const CvMat* src = k == 0 ? left : right;
|
||||
@@ -452,11 +452,11 @@ static void icvInitGraySubpix( const CvMat* left, const CvMat* right,
|
||||
const uchar* sptr_next = y < rows-1 ? sptr + sstep : sptr;
|
||||
uchar* dptr = dst->data.ptr + dst->step*y;
|
||||
int v_prev = sptr[0];
|
||||
|
||||
|
||||
for( x = 0; x < cols; x++, dptr += 3 )
|
||||
{
|
||||
int v = sptr[x], v1, minv = v, maxv = v;
|
||||
|
||||
|
||||
v1 = (v + v_prev)/2;
|
||||
minv = MIN(minv, v1); maxv = MAX(maxv, v1);
|
||||
v1 = (v + sptr_prev[x])/2;
|
||||
@@ -492,7 +492,7 @@ icvComputeK( CvStereoGCState* state )
|
||||
{
|
||||
const uchar* lptr = state->left->data.ptr + state->left->step*y;
|
||||
const uchar* rptr = state->right->data.ptr + state->right->step*y;
|
||||
|
||||
|
||||
for( x = 0; x < cols; x++ )
|
||||
{
|
||||
for( d = maxd-1, i = 0; d >= mind; d-- )
|
||||
@@ -701,7 +701,7 @@ static int64 icvAlphaExpand( int64 Eprev, int alpha, CvStereoGCState* state, CvS
|
||||
GCVtx** pright = pright0 + pstep*y;
|
||||
const uchar* lr[] = { left, right };
|
||||
const short* dlr[] = { dleft, dright };
|
||||
GCVtx** plr[] = { pleft, pright };
|
||||
GCVtx** plr[] = { pleft, pright };
|
||||
|
||||
for( k = 0; k < 2; k++ )
|
||||
{
|
||||
@@ -820,12 +820,12 @@ static int64 icvAlphaExpand( int64 Eprev, int alpha, CvStereoGCState* state, CvS
|
||||
GCVtx** pright = pright0 + pstep*y;
|
||||
for( x = 0; x < cols; x++ )
|
||||
{
|
||||
GCVtx* var = pleft[x];
|
||||
if( var && var->parent && var->t )
|
||||
dleft[x] = (short)alpha;
|
||||
GCVtx* var2 = pleft[x];
|
||||
if( var2 && var2->parent && var2->t )
|
||||
dleft[x] = (short)alpha;
|
||||
|
||||
var = pright[x];
|
||||
if( var && var->parent && var->t )
|
||||
var2 = pright[x];
|
||||
if( var2 && var2->parent && var2->t )
|
||||
dright[x] = (short)-alpha;
|
||||
}
|
||||
}
|
||||
@@ -903,7 +903,7 @@ CV_IMPL void cvFindStereoCorrespondenceGC( const CvArr* _left, const CvArr* _rig
|
||||
|
||||
icvInitStereoConstTabs();
|
||||
icvInitGraySubpix( left, right, state->left, state->right );
|
||||
|
||||
|
||||
std::vector<int> disp(state->numberOfDisparities);
|
||||
CvMat _disp = cvMat( 1, (int)disp.size(), CV_32S, &disp[0] );
|
||||
cvRange( &_disp, state->minDisparity, state->minDisparity + state->numberOfDisparities );
|
||||
|
@@ -500,15 +500,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
int y0=0, y1=pFG->height-1;
|
||||
for(y0=0; y0<pFG->height; ++y0)
|
||||
{
|
||||
CvMat m;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &m, y0));
|
||||
CvMat tmp;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &tmp, y0));
|
||||
if(s.val[0] > 255*7) break;
|
||||
}
|
||||
|
||||
for(y1=pFG->height-1; y1>0; --y1)
|
||||
{
|
||||
CvMat m;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &m, y1));
|
||||
CvMat tmp;
|
||||
CvScalar s = cvSum(cvGetRow(pFG, &tmp, y1));
|
||||
if(s.val[0] > 255*7) break;
|
||||
}
|
||||
|
||||
@@ -573,8 +573,8 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
p->FrameNum = cvReadIntByName( fs, node, "FrameNum", p->FrameNum );
|
||||
p->FrameNum = cvReadIntByName( fs, node, "Dur", p->FrameNum );
|
||||
{
|
||||
int LastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 );
|
||||
p->FrameNum = MIN(p->FrameNum,LastFrame - p->FrameBegin+1);
|
||||
int lastFrame = cvReadIntByName( fs, node, "LastFrame", p->FrameBegin+p->FrameNum-1 );
|
||||
p->FrameNum = MIN(p->FrameNum,lastFrame - p->FrameBegin+1);
|
||||
}
|
||||
|
||||
icvTestSeqAllocTrans(p);
|
||||
@@ -621,8 +621,8 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
|
||||
if(pTransSeq&&KeyFrameNum>1)
|
||||
{
|
||||
int i0,i1,i;
|
||||
for(i=0; i<KeyFrameNum; ++i)
|
||||
int i0,i1;
|
||||
for(int i=0; i<KeyFrameNum; ++i)
|
||||
{
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i);
|
||||
KeyFrames[i] = cvReadIntByName(fs,pTN,"frame",-1);
|
||||
@@ -633,14 +633,12 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
|
||||
for(i0=0, i1=1; i1<KeyFrameNum;)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i1=i0+1; i1<KeyFrameNum && KeyFrames[i1]<0; i1++);
|
||||
|
||||
assert(i1<KeyFrameNum);
|
||||
assert(i1>i0);
|
||||
|
||||
for(i=i0+1; i<i1; ++i)
|
||||
for(int i=i0+1; i<i1; ++i)
|
||||
{
|
||||
KeyFrames[i] = cvRound(KeyFrames[i0] + (float)(i-i0)*(float)(KeyFrames[i1] - KeyFrames[i0])/(float)(i1-i0));
|
||||
}
|
||||
@@ -665,9 +663,9 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
{ /* Only one transform record: */
|
||||
int i;
|
||||
double val;
|
||||
CvFileNode* node = cvGetFileNodeByName( fs, pTN,name);
|
||||
if(node == NULL) continue;
|
||||
val = cvReadReal(node,defv);
|
||||
CvFileNode* fnode = cvGetFileNodeByName( fs, pTN,name);
|
||||
if(fnode == NULL) continue;
|
||||
val = cvReadReal(fnode,defv);
|
||||
|
||||
for(i=0; i<p->TransNum; ++i)
|
||||
{
|
||||
@@ -683,15 +681,15 @@ static CvTestSeqElem* icvTestSeqReadElemOne(CvTestSeq_* pTS, CvFileStorage* fs,
|
||||
double v0;
|
||||
double v1;
|
||||
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,0);
|
||||
v0 = cvReadRealByName(fs, pTN,name,defv);
|
||||
CvFileNode* pTN1 = (CvFileNode*)cvGetSeqElem(pTransSeq,0);
|
||||
v0 = cvReadRealByName(fs, pTN1,name,defv);
|
||||
|
||||
for(i1=1,i0=0; i1<KeyFrameNum; ++i1)
|
||||
{
|
||||
int f0,f1;
|
||||
int i;
|
||||
CvFileNode* pTN = (CvFileNode*)cvGetSeqElem(pTransSeq,i1);
|
||||
CvFileNode* pVN = cvGetFileNodeByName(fs,pTN,name);
|
||||
CvFileNode* pTN2 = (CvFileNode*)cvGetSeqElem(pTransSeq,i1);
|
||||
CvFileNode* pVN = cvGetFileNodeByName(fs,pTN2,name);
|
||||
|
||||
if(pVN)v1 = cvReadReal(pVN,defv);
|
||||
else if(pVN == NULL && i1 == KeyFrameNum-1) v1 = defv;
|
||||
|
@@ -861,8 +861,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
projMatrs[1] = projMatr2;
|
||||
projMatrs[2] = projMatr3;
|
||||
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
for(int i = 0; i < 3; i++ )
|
||||
{
|
||||
if( projMatrs[i]->cols != 4 || projMatrs[i]->rows != 3 )
|
||||
{
|
||||
@@ -870,7 +869,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
}
|
||||
}
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
for(int i = 0; i < 3; i++ )
|
||||
{
|
||||
if( points[i]->rows != 2)
|
||||
{
|
||||
@@ -951,10 +950,9 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
icvProject4DPoints(recPoints4D,&proj6[2],tmpProjPoints[2]);
|
||||
|
||||
/* Compute distances and number of good points (inliers) */
|
||||
int i;
|
||||
int currImage;
|
||||
numGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
dist = 0;
|
||||
@@ -1051,7 +1049,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
CvMat *optStatus;
|
||||
optStatus = cvCreateMat(1,numPoints,CV_64F);
|
||||
int testNumber = 0;
|
||||
for( i=0;i<numPoints;i++ )
|
||||
for(int i=0;i<numPoints;i++ )
|
||||
{
|
||||
cvmSet(optStatus,0,i,(double)bestFlags[i]);
|
||||
testNumber += bestFlags[i];
|
||||
@@ -1063,7 +1061,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
CvMat *gPresPoints;
|
||||
gPresPoints = cvCreateMat(1,maxGoodPoints,CV_64F);
|
||||
for( i = 0; i < maxGoodPoints; i++)
|
||||
for(int i = 0; i < maxGoodPoints; i++)
|
||||
{
|
||||
cvmSet(gPresPoints,0,i,1.0);
|
||||
}
|
||||
@@ -1130,7 +1128,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
int currImage;
|
||||
finalGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
/* Choose max distance for each of three points */
|
||||
@@ -1178,7 +1176,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
/* Create status */
|
||||
CvMat *optStatus;
|
||||
optStatus = cvCreateMat(1,numPoints,CV_64F);
|
||||
for( i=0;i<numPoints;i++ )
|
||||
for(int i=0;i<numPoints;i++ )
|
||||
{
|
||||
cvmSet(optStatus,0,i,(double)bestFlags[i]);
|
||||
}
|
||||
@@ -1236,7 +1234,7 @@ int icvComputeProjectMatricesNPoints( CvMat* points1,CvMat* points2,CvMat* poin
|
||||
|
||||
int currImage;
|
||||
finalGoodPoints = 0;
|
||||
for( i = 0; i < numPoints; i++ )
|
||||
for(int i = 0; i < numPoints; i++ )
|
||||
{
|
||||
double dist=-1;
|
||||
/* Choose max distance for each of three points */
|
||||
@@ -1662,15 +1660,12 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
|
||||
matrA_dat[7] = s;
|
||||
matrA_dat[8] = -(p+q+r+s+t);
|
||||
|
||||
CvMat matrU;
|
||||
CvMat matrW;
|
||||
CvMat matrV;
|
||||
|
||||
double matrU_dat[3*3];
|
||||
double matrW_dat[3*3];
|
||||
double matrV_dat[3*3];
|
||||
|
||||
matrU = cvMat(3,3,CV_64F,matrU_dat);
|
||||
matrW = cvMat(3,3,CV_64F,matrW_dat);
|
||||
matrV = cvMat(3,3,CV_64F,matrV_dat);
|
||||
|
||||
@@ -1731,27 +1726,24 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
|
||||
matrK_dat[4*6+5] = -B2;
|
||||
matrK_dat[5*6+5] = -C2;
|
||||
|
||||
CvMat matrU;
|
||||
CvMat matrW;
|
||||
CvMat matrV;
|
||||
CvMat matrW1;
|
||||
CvMat matrV1;
|
||||
|
||||
double matrU_dat[36];
|
||||
double matrW_dat[36];
|
||||
double matrV_dat[36];
|
||||
double matrW_dat1[36];
|
||||
double matrV_dat1[36];
|
||||
|
||||
matrU = cvMat(6,6,CV_64F,matrU_dat);
|
||||
matrW = cvMat(6,6,CV_64F,matrW_dat);
|
||||
matrV = cvMat(6,6,CV_64F,matrV_dat);
|
||||
matrW1 = cvMat(6,6,CV_64F,matrW_dat1);
|
||||
matrV1 = cvMat(6,6,CV_64F,matrV_dat1);
|
||||
|
||||
/* From svd we need just last vector of V or last row V' */
|
||||
/* We get transposed matrixes U and V */
|
||||
|
||||
cvSVD(&matrK,&matrW,0,&matrV,CV_SVD_V_T);
|
||||
cvSVD(&matrK,&matrW1,0,&matrV1,CV_SVD_V_T);
|
||||
|
||||
a = matrV_dat[6*5+0];
|
||||
b = matrV_dat[6*5+1];
|
||||
c = matrV_dat[6*5+2];
|
||||
d = matrV_dat[6*5+3];
|
||||
a = matrV_dat1[6*5+0];
|
||||
b = matrV_dat1[6*5+1];
|
||||
c = matrV_dat1[6*5+2];
|
||||
d = matrV_dat1[6*5+3];
|
||||
/* we don't need last two coefficients. Because it just a k1,k2 */
|
||||
|
||||
cvmSet(projMatrCoefs,0,0,a);
|
||||
|
@@ -137,7 +137,7 @@ struct CvFaceTracker
|
||||
if (NULL != mstgContours)
|
||||
cvReleaseMemStorage(&mstgContours);
|
||||
};
|
||||
int Init(CvRect* pRects, IplImage* imgGray)
|
||||
int Init(CvRect* pRects, IplImage* imgray)
|
||||
{
|
||||
for (int i = 0; i < NUM_FACE_ELEMENTS; i++)
|
||||
{
|
||||
@@ -146,10 +146,10 @@ struct CvFaceTracker
|
||||
ptTempl[i] = face[i].ptCenter;
|
||||
rTempl[i] = face[i].r;
|
||||
}
|
||||
imgGray = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1);
|
||||
imgThresh = cvCreateImage(cvSize(imgGray->width, imgGray->height), 8, 1);
|
||||
imgray = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
|
||||
imgThresh = cvCreateImage(cvSize(imgray->width, imgray->height), 8, 1);
|
||||
mstgContours = cvCreateMemStorage();
|
||||
if ((NULL == imgGray) ||
|
||||
if ((NULL == imgray) ||
|
||||
(NULL == imgThresh) ||
|
||||
(NULL == mstgContours))
|
||||
return FALSE;
|
||||
|
Reference in New Issue
Block a user