fixed warnings
This commit is contained in:
@@ -46,11 +46,11 @@ using namespace std;
|
||||
|
||||
const int angularBins=12;
|
||||
const int radialBins=4;
|
||||
const float minRad=0.2;
|
||||
const float minRad=0.2f;
|
||||
const float maxRad=2;
|
||||
const int NSN=5;//10;//20; //number of shapes per class
|
||||
const int NP=100; //number of points sympliying the contour
|
||||
const float outlierWeight=0.1;
|
||||
const float outlierWeight=0.1f;
|
||||
const int numOutliers=20;
|
||||
const float CURRENT_MAX_ACCUR=95; //98% and 99% reached in several tests, 95 is fixed as minimum boundary
|
||||
|
||||
@@ -96,7 +96,7 @@ vector <Point2f> CV_ShapeEMDTest::convertContourType(const Mat& currentQuery, in
|
||||
|
||||
// In case actual number of points is less than n
|
||||
int dum=0;
|
||||
for (int add=contoursQuery.size()-1; add<n; add++)
|
||||
for (int add=(int)contoursQuery.size()-1; add<n; add++)
|
||||
{
|
||||
contoursQuery.push_back(contoursQuery[dum++]); //adding dummy values
|
||||
}
|
||||
@@ -148,14 +148,14 @@ void CV_ShapeEMDTest::mpegTest()
|
||||
listShapeNames(namesHeaders);
|
||||
|
||||
// distance matrix //
|
||||
Mat distanceMat=Mat::zeros(NSN*namesHeaders.size(), NSN*namesHeaders.size(), CV_32F);
|
||||
Mat distanceMat=Mat::zeros(NSN*(int)namesHeaders.size(), NSN*(int)namesHeaders.size(), CV_32F);
|
||||
|
||||
// query contours (normal v flipped, h flipped) and testing contour //
|
||||
vector<Point2f> contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting;
|
||||
|
||||
// reading query and computing its properties //
|
||||
int counter=0;
|
||||
const int loops=NSN*namesHeaders.size()*NSN*namesHeaders.size();
|
||||
const int loops=NSN*(int)namesHeaders.size()*NSN*(int)namesHeaders.size();
|
||||
for (size_t n=0; n<namesHeaders.size(); n++)
|
||||
{
|
||||
for (int i=1; i<=NSN; i++)
|
||||
@@ -165,7 +165,6 @@ void CV_ShapeEMDTest::mpegTest()
|
||||
thepathandname<<path+namesHeaders[n]<<"-"<<i<<".png";
|
||||
Mat currentQuery, flippedHQuery, flippedVQuery;
|
||||
currentQuery=imread(thepathandname.str(), IMREAD_GRAYSCALE);
|
||||
Mat currentQueryBuf=currentQuery.clone();
|
||||
flip(currentQuery, flippedHQuery, 0);
|
||||
flip(currentQuery, flippedVQuery, 1);
|
||||
// compute border of the query and its flipped versions //
|
||||
@@ -184,8 +183,8 @@ void CV_ShapeEMDTest::mpegTest()
|
||||
counter++;
|
||||
if (nt==n && it==i)
|
||||
{
|
||||
distanceMat.at<float>(NSN*n+i-1,
|
||||
NSN*nt+it-1)=0;
|
||||
distanceMat.at<float>(NSN*(int)n+i-1,
|
||||
NSN*(int)nt+it-1)=0;
|
||||
continue;
|
||||
}
|
||||
// read testing image //
|
||||
@@ -200,9 +199,9 @@ void CV_ShapeEMDTest::mpegTest()
|
||||
std::cout<<std::endl<<"Progress: "<<counter<<"/"<<loops<<": "<<100*double(counter)/loops<<"% *******"<<std::endl;
|
||||
std::cout<<"Computing shape distance between "<<namesHeaders[n]<<i<<
|
||||
" and "<<namesHeaders[nt]<<it<<": ";
|
||||
distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)=
|
||||
distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)=
|
||||
computeShapeDistance(contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting);
|
||||
std::cout<<distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)<<std::endl;
|
||||
std::cout<<distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -75,13 +75,13 @@ CV_HaussTest::~CV_HaussTest()
|
||||
vector<Point2f> CV_HaussTest::normalizeContour(const vector<Point> &contour)
|
||||
{
|
||||
vector<Point2f> output(contour.size());
|
||||
Mat disMat(contour.size(),contour.size(),CV_32F);
|
||||
Mat disMat((int)contour.size(),(int)contour.size(),CV_32F);
|
||||
Point2f meanpt(0,0);
|
||||
float meanVal=1;
|
||||
|
||||
for (size_t ii=0; ii<contour.size(); ii++)
|
||||
for (int ii=0, end1 = (int)contour.size(); ii<end1; ii++)
|
||||
{
|
||||
for (size_t jj=0; jj<contour.size(); jj++)
|
||||
for (int jj=0, end2 = (int)contour.size(); end2; jj++)
|
||||
{
|
||||
if (ii==jj) disMat.at<float>(ii,jj)=0;
|
||||
else
|
||||
@@ -128,7 +128,7 @@ vector <Point> CV_HaussTest::convertContourType(const Mat& currentQuery, int n)
|
||||
}
|
||||
|
||||
// In case actual number of points is less than n
|
||||
for (int add=contoursQuery.size()-1; add<n; add++)
|
||||
for (int add=(int)contoursQuery.size()-1; add<n; add++)
|
||||
{
|
||||
contoursQuery.push_back(contoursQuery[contoursQuery.size()-add+1]); //adding dummy values
|
||||
}
|
||||
@@ -160,14 +160,14 @@ void CV_HaussTest::mpegTest()
|
||||
listShapeNames(namesHeaders);
|
||||
|
||||
// distance matrix //
|
||||
Mat distanceMat=Mat::zeros(NSN*namesHeaders.size(), NSN*namesHeaders.size(), CV_32F);
|
||||
Mat distanceMat=Mat::zeros(NSN*(int)namesHeaders.size(), NSN*(int)namesHeaders.size(), CV_32F);
|
||||
|
||||
// query contours (normal v flipped, h flipped) and testing contour //
|
||||
vector<Point> contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting;
|
||||
|
||||
// reading query and computing its properties //
|
||||
int counter=0;
|
||||
const int loops=NSN*namesHeaders.size()*NSN*namesHeaders.size();
|
||||
const int loops=NSN*(int)namesHeaders.size()*NSN*(int)namesHeaders.size();
|
||||
for (size_t n=0; n<namesHeaders.size(); n++)
|
||||
{
|
||||
for (int i=1; i<=NSN; i++)
|
||||
@@ -195,8 +195,8 @@ void CV_HaussTest::mpegTest()
|
||||
counter++;
|
||||
if (nt==n && it==i)
|
||||
{
|
||||
distanceMat.at<float>(NSN*n+i-1,
|
||||
NSN*nt+it-1)=0;
|
||||
distanceMat.at<float>(NSN*(int)n+i-1,
|
||||
NSN*(int)nt+it-1)=0;
|
||||
continue;
|
||||
}
|
||||
// read testing image //
|
||||
@@ -212,9 +212,9 @@ void CV_HaussTest::mpegTest()
|
||||
std::cout<<std::endl<<"Progress: "<<counter<<"/"<<loops<<": "<<100*double(counter)/loops<<"% *******"<<std::endl;
|
||||
std::cout<<"Computing shape distance between "<<namesHeaders[n]<<i<<
|
||||
" and "<<namesHeaders[nt]<<it<<": ";
|
||||
distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)=
|
||||
distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)=
|
||||
computeShapeDistance(contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting);
|
||||
std::cout<<distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)<<std::endl;
|
||||
std::cout<<distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -46,13 +46,13 @@ using namespace std;
|
||||
|
||||
const int angularBins=12;
|
||||
const int radialBins=4;
|
||||
const float minRad=0.2;
|
||||
const float minRad=0.2f;
|
||||
const float maxRad=2;
|
||||
const int NSN=5;//10;//20; //number of shapes per class
|
||||
const int NP=120; //number of points sympliying the contour
|
||||
const float outlierWeight=0.1;
|
||||
const float outlierWeight=0.1f;
|
||||
const int numOutliers=20;
|
||||
const float CURRENT_MAX_ACCUR=95.0; //99% and 100% reached in several tests, 95 is fixed as minimum boundary
|
||||
const float CURRENT_MAX_ACCUR=95; //99% and 100% reached in several tests, 95 is fixed as minimum boundary
|
||||
|
||||
class CV_ShapeTest : public cvtest::BaseTest
|
||||
{
|
||||
@@ -95,7 +95,7 @@ vector <Point2f> CV_ShapeTest::convertContourType(const Mat& currentQuery, int n
|
||||
}
|
||||
|
||||
// In case actual number of points is less than n
|
||||
for (int add=contoursQuery.size()-1; add<n; add++)
|
||||
for (int add=(int)contoursQuery.size()-1; add<n; add++)
|
||||
{
|
||||
contoursQuery.push_back(contoursQuery[contoursQuery.size()-add+1]); //adding dummy values
|
||||
}
|
||||
@@ -126,7 +126,7 @@ float CV_ShapeTest::computeShapeDistance(vector <Point2f>& query1, vector <Point
|
||||
//waitKey(0);
|
||||
Ptr <ShapeContextDistanceExtractor> mysc = createShapeContextDistanceExtractor(angularBins, radialBins, minRad, maxRad);
|
||||
//Ptr <HistogramCostExtractor> cost = createNormHistogramCostExtractor(cv::DIST_L1);
|
||||
Ptr <HistogramCostExtractor> cost = createChiHistogramCostExtractor(30,0.15);
|
||||
Ptr <HistogramCostExtractor> cost = createChiHistogramCostExtractor(30,0.15f);
|
||||
//Ptr <HistogramCostExtractor> cost = createEMDHistogramCostExtractor();
|
||||
//Ptr <HistogramCostExtractor> cost = createEMDL1HistogramCostExtractor();
|
||||
mysc->setIterations(1);
|
||||
@@ -148,14 +148,14 @@ void CV_ShapeTest::mpegTest()
|
||||
listShapeNames(namesHeaders);
|
||||
|
||||
// distance matrix //
|
||||
Mat distanceMat=Mat::zeros(NSN*namesHeaders.size(), NSN*namesHeaders.size(), CV_32F);
|
||||
Mat distanceMat=Mat::zeros(NSN*(int)namesHeaders.size(), NSN*(int)namesHeaders.size(), CV_32F);
|
||||
|
||||
// query contours (normal v flipped, h flipped) and testing contour //
|
||||
vector<Point2f> contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting;
|
||||
|
||||
// reading query and computing its properties //
|
||||
int counter=0;
|
||||
const int loops=NSN*namesHeaders.size()*NSN*namesHeaders.size();
|
||||
const int loops=NSN*(int)namesHeaders.size()*NSN*(int)namesHeaders.size();
|
||||
for (size_t n=0; n<namesHeaders.size(); n++)
|
||||
{
|
||||
for (int i=1; i<=NSN; i++)
|
||||
@@ -184,8 +184,8 @@ void CV_ShapeTest::mpegTest()
|
||||
counter++;
|
||||
if (nt==n && it==i)
|
||||
{
|
||||
distanceMat.at<float>(NSN*n+i-1,
|
||||
NSN*nt+it-1)=0;
|
||||
distanceMat.at<float>(NSN*(int)n+i-1,
|
||||
NSN*(int)nt+it-1)=0;
|
||||
continue;
|
||||
}
|
||||
// read testing image //
|
||||
@@ -200,9 +200,9 @@ void CV_ShapeTest::mpegTest()
|
||||
std::cout<<std::endl<<"Progress: "<<counter<<"/"<<loops<<": "<<100*double(counter)/loops<<"% *******"<<std::endl;
|
||||
std::cout<<"Computing shape distance between "<<namesHeaders[n]<<i<<
|
||||
" and "<<namesHeaders[nt]<<it<<": ";
|
||||
distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)=
|
||||
distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)=
|
||||
computeShapeDistance(contoursQuery1, contoursQuery2, contoursQuery3, contoursTesting);
|
||||
std::cout<<distanceMat.at<float>(NSN*n+i-1, NSN*nt+it-1)<<std::endl;
|
||||
std::cout<<distanceMat.at<float>(NSN*(int)n+i-1, NSN*(int)nt+it-1)<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user