Move cv::Mat out of core.hpp
This commit is contained in:
@@ -334,7 +334,7 @@ void RandomizedTree::train(std::vector<BaseKeypoint> const& base_set,
|
||||
Size patchSize(PATCH_SIZE, PATCH_SIZE);
|
||||
for (keypt_it = base_set.begin(); keypt_it != base_set.end(); ++keypt_it, ++class_id) {
|
||||
for (int i = 0; i < views; ++i) {
|
||||
make_patch( Mat(keypt_it->image), Point(keypt_it->x, keypt_it->y ), patch, patchSize, rng );
|
||||
make_patch( cv::cvarrToMat(keypt_it->image), Point(keypt_it->x, keypt_it->y ), patch, patchSize, rng );
|
||||
IplImage iplPatch = patch;
|
||||
addExample(class_id, getData(&iplPatch));
|
||||
}
|
||||
|
@@ -139,15 +139,15 @@ void init_params(const CvEMParams& src,
|
||||
Mat& prbs, Mat& weights,
|
||||
Mat& means, std::vector<Mat>& covsHdrs)
|
||||
{
|
||||
prbs = src.probs;
|
||||
weights = src.weights;
|
||||
means = src.means;
|
||||
prbs = cv::cvarrToMat(src.probs);
|
||||
weights = cv::cvarrToMat(src.weights);
|
||||
means = cv::cvarrToMat(src.means);
|
||||
|
||||
if(src.covs)
|
||||
{
|
||||
covsHdrs.resize(src.nclusters);
|
||||
for(size_t i = 0; i < covsHdrs.size(); i++)
|
||||
covsHdrs[i] = src.covs[i];
|
||||
covsHdrs[i] = cv::cvarrToMat(src.covs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -745,6 +745,7 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
|
||||
double* matrW_dat = 0;
|
||||
|
||||
CV_FUNCNAME( "icvReconstructPoints4DStatus" );
|
||||
|
||||
__BEGIN__;
|
||||
|
||||
/* ----- Test input params for errors ----- */
|
||||
@@ -770,6 +771,7 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
|
||||
CV_ERROR( CV_StsOutOfRange, "Points must have 4 cordinates" );
|
||||
}
|
||||
|
||||
|
||||
/* !!! Not tested all input parameters */
|
||||
/* ----- End test ----- */
|
||||
|
||||
@@ -778,75 +780,75 @@ void icvReconstructPoints4DStatus(CvMat** projPoints, CvMat **projMatrs, CvMat**
|
||||
|
||||
/* Allocate maximum data */
|
||||
|
||||
|
||||
CvMat matrV;
|
||||
double matrV_dat[4*4];
|
||||
matrV = cvMat(4,4,CV_64F,matrV_dat);
|
||||
|
||||
CV_CALL(matrA_dat = (double*)cvAlloc(3*numImages * 4 * sizeof(double)));
|
||||
CV_CALL(matrW_dat = (double*)cvAlloc(3*numImages * 4 * sizeof(double)));
|
||||
|
||||
/* reconstruct each point */
|
||||
for( currPoint = 0; currPoint < numPoints; currPoint++ )
|
||||
{
|
||||
/* Reconstruct current point */
|
||||
/* Define number of visible projections */
|
||||
int numVisProj = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
double matrV_dat[4*4];
|
||||
CvMat matrV = cvMat(4,4,CV_64F,matrV_dat);
|
||||
|
||||
CV_CALL(matrA_dat = (double*)cvAlloc(3*numImages * 4 * sizeof(double)));
|
||||
CV_CALL(matrW_dat = (double*)cvAlloc(3*numImages * 4 * sizeof(double)));
|
||||
|
||||
/* reconstruct each point */
|
||||
for( currPoint = 0; currPoint < numPoints; currPoint++ )
|
||||
{
|
||||
if( cvmGet(presPoints[currImage],0,currPoint) > 0 )
|
||||
/* Reconstruct current point */
|
||||
/* Define number of visible projections */
|
||||
int numVisProj = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )
|
||||
{
|
||||
numVisProj++;
|
||||
}
|
||||
}
|
||||
|
||||
if( numVisProj < 2 )
|
||||
{
|
||||
/* This point can't be reconstructed */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Allocate memory and create matrices */
|
||||
CvMat matrA;
|
||||
matrA = cvMat(3*numVisProj,4,CV_64F,matrA_dat);
|
||||
|
||||
CvMat matrW;
|
||||
matrW = cvMat(3*numVisProj,4,CV_64F,matrW_dat);
|
||||
|
||||
int currVisProj = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )/* For each view */
|
||||
{
|
||||
if( cvmGet(presPoints[currImage],0,currPoint) > 0 )
|
||||
{
|
||||
double x,y;
|
||||
x = cvmGet(projPoints[currImage],0,currPoint);
|
||||
y = cvmGet(projPoints[currImage],1,currPoint);
|
||||
for( int k = 0; k < 4; k++ )
|
||||
if( cvmGet(presPoints[currImage],0,currPoint) > 0 )
|
||||
{
|
||||
matrA_dat[currVisProj*12 + k] =
|
||||
x * cvmGet(projMatrs[currImage],2,k) - cvmGet(projMatrs[currImage],0,k);
|
||||
|
||||
matrA_dat[currVisProj*12+4 + k] =
|
||||
y * cvmGet(projMatrs[currImage],2,k) - cvmGet(projMatrs[currImage],1,k);
|
||||
|
||||
matrA_dat[currVisProj*12+8 + k] =
|
||||
x * cvmGet(projMatrs[currImage],1,k) - y * cvmGet(projMatrs[currImage],0,k);
|
||||
numVisProj++;
|
||||
}
|
||||
currVisProj++;
|
||||
}
|
||||
|
||||
if( numVisProj < 2 )
|
||||
{
|
||||
/* This point can't be reconstructed */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Allocate memory and create matrices */
|
||||
CvMat matrA;
|
||||
matrA = cvMat(3*numVisProj,4,CV_64F,matrA_dat);
|
||||
|
||||
CvMat matrW;
|
||||
matrW = cvMat(3*numVisProj,4,CV_64F,matrW_dat);
|
||||
|
||||
int currVisProj = 0;
|
||||
for( currImage = 0; currImage < numImages; currImage++ )/* For each view */
|
||||
{
|
||||
if( cvmGet(presPoints[currImage],0,currPoint) > 0 )
|
||||
{
|
||||
double x,y;
|
||||
x = cvmGet(projPoints[currImage],0,currPoint);
|
||||
y = cvmGet(projPoints[currImage],1,currPoint);
|
||||
for( int k = 0; k < 4; k++ )
|
||||
{
|
||||
matrA_dat[currVisProj*12 + k] =
|
||||
x * cvmGet(projMatrs[currImage],2,k) - cvmGet(projMatrs[currImage],0,k);
|
||||
|
||||
matrA_dat[currVisProj*12+4 + k] =
|
||||
y * cvmGet(projMatrs[currImage],2,k) - cvmGet(projMatrs[currImage],1,k);
|
||||
|
||||
matrA_dat[currVisProj*12+8 + k] =
|
||||
x * cvmGet(projMatrs[currImage],1,k) - y * cvmGet(projMatrs[currImage],0,k);
|
||||
}
|
||||
currVisProj++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Solve system for current point */
|
||||
{
|
||||
cvSVD(&matrA,&matrW,0,&matrV,CV_SVD_V_T);
|
||||
|
||||
/* Copy computed point */
|
||||
cvmSet(points4D,0,currPoint,cvmGet(&matrV,3,0));//X
|
||||
cvmSet(points4D,1,currPoint,cvmGet(&matrV,3,1));//Y
|
||||
cvmSet(points4D,2,currPoint,cvmGet(&matrV,3,2));//Z
|
||||
cvmSet(points4D,3,currPoint,cvmGet(&matrV,3,3));//W
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Solve system for current point */
|
||||
{
|
||||
cvSVD(&matrA,&matrW,0,&matrV,CV_SVD_V_T);
|
||||
|
||||
/* Copy computed point */
|
||||
cvmSet(points4D,0,currPoint,cvmGet(&matrV,3,0));//X
|
||||
cvmSet(points4D,1,currPoint,cvmGet(&matrV,3,1));//Y
|
||||
cvmSet(points4D,2,currPoint,cvmGet(&matrV,3,2));//Z
|
||||
cvmSet(points4D,3,currPoint,cvmGet(&matrV,3,3));//W
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{/* Compute projection error */
|
||||
@@ -913,7 +915,7 @@ static void icvProjPointsStatusFunc( int numImages, CvMat *points4D, CvMat **pro
|
||||
{
|
||||
CV_ERROR( CV_StsNullPtr, "Some of parameters is a NULL pointer" );
|
||||
}
|
||||
|
||||
{
|
||||
int numPoints;
|
||||
numPoints = points4D->cols;
|
||||
if( numPoints < 1 )
|
||||
@@ -994,7 +996,7 @@ static void icvProjPointsStatusFunc( int numImages, CvMat *points4D, CvMat **pro
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
__END__;
|
||||
}
|
||||
|
||||
|
@@ -1740,7 +1740,7 @@ namespace cv{
|
||||
CV_Error(CV_StsNotImplemented, "OpenCV was built without SURF support");
|
||||
surf_extractor->set("hessianThreshold", 1.0);
|
||||
//printf("Extracting SURF features...");
|
||||
surf_extractor->detect(Mat(img), features);
|
||||
surf_extractor->detect(cv::cvarrToMat(img), features);
|
||||
//printf("done\n");
|
||||
|
||||
for (int j = 0; j < (int)features.size(); j++)
|
||||
|
@@ -223,7 +223,7 @@ int icvComputeProjectMatrices6Points( CvMat* points1,CvMat* points2,CvMat* point
|
||||
CV_ERROR( CV_StsUnmatchedSizes, "Number of coordinates of points4D must be 4" );
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
/* Find transform matrix for each camera */
|
||||
int i;
|
||||
CvMat* points[3];
|
||||
@@ -400,7 +400,7 @@ int icvComputeProjectMatrices6Points( CvMat* points1,CvMat* points2,CvMat* point
|
||||
#endif
|
||||
|
||||
}/* for all sollutions */
|
||||
|
||||
}
|
||||
__END__;
|
||||
return numSol;
|
||||
}
|
||||
@@ -1362,7 +1362,7 @@ void icvFindBaseTransform(CvMat* points,CvMat* resultT)
|
||||
/* Function gets four points and compute transformation to e1=(100) e2=(010) e3=(001) e4=(111) */
|
||||
|
||||
/* !!! test each three points not collinear. Need to test */
|
||||
|
||||
{
|
||||
/* Create matrices */
|
||||
CvMat matrA;
|
||||
CvMat vectB;
|
||||
@@ -1410,7 +1410,7 @@ void icvFindBaseTransform(CvMat* points,CvMat* resultT)
|
||||
cvInvert(&matrA,&tmpRes);
|
||||
|
||||
cvConvert(&tmpRes,resultT);
|
||||
|
||||
}
|
||||
__END__;
|
||||
|
||||
return;
|
||||
@@ -1459,7 +1459,7 @@ void GetGeneratorReduceFundSolution(CvMat* points1,CvMat* points2,CvMat* fundRed
|
||||
}
|
||||
|
||||
/* Using 3 corr. points compute reduce */
|
||||
|
||||
{
|
||||
/* Create matrix */
|
||||
CvMat matrA;
|
||||
double matrA_dat[3*5];
|
||||
@@ -1507,7 +1507,7 @@ void GetGeneratorReduceFundSolution(CvMat* points1,CvMat* points2,CvMat* fundRed
|
||||
cvmSet(fundReduceCoef1,0,i,cvmGet(&matrV,3,i));
|
||||
cvmSet(fundReduceCoef2,0,i,cvmGet(&matrV,4,i));
|
||||
}
|
||||
|
||||
}
|
||||
__END__;
|
||||
return;
|
||||
|
||||
@@ -1551,7 +1551,7 @@ int GetGoodReduceFundamMatrFromTwo(CvMat* fundReduceCoef1,CvMat* fundReduceCoef2
|
||||
{
|
||||
CV_ERROR( CV_StsUnmatchedSizes, "Size of resFundReduceCoef must be 1x5" );
|
||||
}
|
||||
|
||||
{
|
||||
double p1,q1,r1,s1,t1;
|
||||
double p2,q2,r2,s2,t2;
|
||||
p1 = cvmGet(fundReduceCoef1,0,0);
|
||||
@@ -1599,7 +1599,7 @@ int GetGoodReduceFundamMatrFromTwo(CvMat* fundReduceCoef1,CvMat* fundReduceCoef2
|
||||
numRoots++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
__END__;
|
||||
return numRoots;
|
||||
}
|
||||
@@ -1636,7 +1636,7 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
|
||||
/* Computes project matrix from given reduced matrix */
|
||||
/* we have p,q,r,s,t and need get a,b,c,d */
|
||||
/* Fill matrix to compute ratio a:b:c as A:B:C */
|
||||
|
||||
{
|
||||
CvMat matrA;
|
||||
double matrA_dat[3*3];
|
||||
matrA = cvMat(3,3,CV_64F,matrA_dat);
|
||||
@@ -1752,7 +1752,7 @@ void GetProjMatrFromReducedFundamental(CvMat* fundReduceCoefs,CvMat* projMatrCoe
|
||||
cvmSet(projMatrCoefs,0,3,d);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
__END__;
|
||||
return;
|
||||
}
|
||||
@@ -2106,7 +2106,7 @@ void icvReconstructPointsFor3View( CvMat* projMatr1,CvMat* projMatr2,CvMat* proj
|
||||
{
|
||||
CV_ERROR( CV_StsUnmatchedSizes, "Size of projection matrices must be 3x4" );
|
||||
}
|
||||
|
||||
{
|
||||
CvMat matrA;
|
||||
double matrA_dat[36];
|
||||
matrA = cvMat(9,4,CV_64F,matrA_dat);
|
||||
@@ -2203,7 +2203,7 @@ void icvReconstructPointsFor3View( CvMat* projMatr1,CvMat* projMatr2,CvMat* proj
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
__END__;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user