fixed warnings under win32

This commit is contained in:
Maria Dimashova 2010-11-26 10:35:48 +00:00
parent 337f1dd2fa
commit dfe4af9e1d
6 changed files with 32 additions and 32 deletions

View File

@ -961,7 +961,7 @@ float RTreeClassifier::countZeroElements()
float *p = trees_[i].getPosteriorByIndex(k);
uchar *p2 = trees_[i].getPosteriorByIndex2(k);
assert(p); assert(p2);
for (int j=0; j<num_elem; ++j, ++p, ++p2) {
for (int j=0; j<(int)num_elem; ++j, ++p, ++p2) {
if (*p == 0.f) flt_zeros++;
if (*p2 == 0) ui8_zeros++;
}

View File

@ -861,7 +861,7 @@ void VocData::calcPrecRecall_impl(const vector<char>& ground_truth, const vector
recall[0] = 0;
for (size_t idx = 0; idx < ground_truth.size(); ++idx)
{
if (ground_truth[ranking[idx]] == true) ++retrieved_hits;
if (ground_truth[ranking[idx]] != 0) ++retrieved_hits;
precision[idx+1] = static_cast<float>(retrieved_hits)/static_cast<float>(idx+1);
recall[idx+1] = static_cast<float>(retrieved_hits)/static_cast<float>(recall_norm);
@ -897,12 +897,12 @@ void VocData::calcPrecRecall_impl(const vector<char>& ground_truth, const vector
for (size_t idx = 0; idx < (recall.size()-1); ++idx)
{
ap += (recall[idx+1] - recall[idx])*precision_monot[idx+1] + //no need to take min of prec - is monotonically decreasing
0.5*(recall[idx+1] - recall[idx])*std::abs(precision_monot[idx+1] - precision_monot[idx]);
0.5f*(recall[idx+1] - recall[idx])*std::abs(precision_monot[idx+1] - precision_monot[idx]);
}
} else {
// FOR BEFORE VOC2010 AP IS CALCULATED BY SAMPLING PRECISION AT RECALL 0.0,0.1,..,1.0
for (float recall_pos = 0.0; recall_pos <= 1.0; recall_pos += 0.1)
for (float recall_pos = 0.f; recall_pos <= 1.f; recall_pos += 0.1f)
{
//find iterator of the precision corresponding to the first recall >= recall_pos
vector<float>::iterator recall_it = recall.begin();
@ -1037,7 +1037,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector<Obd
/* convert iterator to index */
int class_idx = std::distance(output_headers.begin(),class_idx_it);
//add to confusion matrix row in proportion
output_values[class_idx] += 1.0/static_cast<float>(img_objects.size());
output_values[class_idx] += 1.f/static_cast<float>(img_objects.size());
}
}
//check break conditions if breaking on certain level of recall
@ -1154,16 +1154,16 @@ void VocData::calcDetectorConfMatRow(const string& obj_class, const ObdDatasetTy
//find the ground truth object which has the highest overlap score with the detected object
float maxov = -1.0;
size_t max_gt_obj_idx = -1;
int max_gt_obj_idx = -1;
//-- for each detected object iterate through objects present in ground truth --
for (size_t gt_obj_idx = 0; gt_obj_idx < img_objects.size(); ++gt_obj_idx)
{
//check difficulty flag
if (ignore_difficult || (img_object_data[gt_obj_idx].difficult = false))
if (ignore_difficult || (img_object_data[gt_obj_idx].difficult == false))
{
//if the class matches, then check if the detected object and ground truth object overlap by a sufficient margin
int ov = testBoundingBoxesForOverlap(bounding_boxes_flat[ranking[image_idx]], img_objects[gt_obj_idx].boundingBox);
if (ov != -1.0)
float ov = testBoundingBoxesForOverlap(bounding_boxes_flat[ranking[image_idx]], img_objects[gt_obj_idx].boundingBox);
if (ov != -1.f)
{
//if all conditions are met store the overlap score and index (as objects are assigned to the highest scoring match)
if (ov > maxov)
@ -1773,7 +1773,7 @@ bool VocData::getClassifierGroundTruthImage(const string& obj_class, const strin
if (it != m_classifier_gt_all_ids.end())
{
//image found, so return corresponding ground truth
return m_classifier_gt_all_present[std::distance(m_classifier_gt_all_ids.begin(),it)];
return m_classifier_gt_all_present[std::distance(m_classifier_gt_all_ids.begin(),it)] != 0;
} else {
string err_msg = "could not find classifier ground truth for image '" + id + "' and class '" + obj_class + "'";
CV_Error(CV_StsError,err_msg.c_str());
@ -2015,9 +2015,7 @@ struct VocabTrainParams
struct SVMTrainParamsExt
{
SVMTrainParamsExt() : descPercent(0.5f), targetRatio(0.4f), balanceClasses(true) {}
SVMTrainParamsExt( float _descPercent, float _targetRatio, bool _balanceClasses,
int _svmType, int _kernelType, double _degree, double _gamma, double _coef0,
double _C, double _nu, double _p, Mat& _class_weights, TermCriteria _termCrit ) :
SVMTrainParamsExt( float _descPercent, float _targetRatio, bool _balanceClasses ) :
descPercent(_descPercent), targetRatio(_targetRatio), balanceClasses(_balanceClasses) {}
void read( const FileNode& fn )
{

View File

@ -45,7 +45,7 @@ float match(const vector<KeyPoint>& kpts_train, const vector<KeyPoint>& kpts_que
const Mat& train, const Mat& query, vector<DMatch>& matches)
{
float t = (double)getTickCount();
double t = (double)getTickCount();
matcher.match(query, train, matches); //Using features2d
return ((double)getTickCount() - t) / getTickFrequency();
}

View File

@ -58,7 +58,8 @@ static inline Point2f applyHomography( const Mat_<double>& H, const Point2f& pt
if( z )
{
double w = 1./z;
return Point2f( (H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w, (H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w );
return Point2f( (float)((H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w),
(float)((H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w) );
}
return Point2f( numeric_limits<float>::max(), numeric_limits<float>::max() );
}
@ -103,13 +104,13 @@ static void calcKeyPointProjections( const vector<KeyPoint>& src, const Mat_<dou
Mat_<double> dstM; invert(Aff*invM*Aff.t(), dstM);
Mat_<double> eval; eigen( dstM, eval );
assert( eval(0,0) && eval(1,0) );
float dstSize = pow(1./(eval(0,0)*eval(1,0)), 0.25);
float dstSize = (float)pow(1./(eval(0,0)*eval(1,0)), 0.25);
// TODO: check angle projection
float srcAngleRad = srcIt->angle*CV_PI/180;
float srcAngleRad = (float)(srcIt->angle*CV_PI/180);
Point2f vec1(cos(srcAngleRad), sin(srcAngleRad)), vec2;
vec2.x = Aff(0,0)*vec1.x + Aff(0,1)*vec1.y;
vec2.y = Aff(1,0)*vec1.x + Aff(0,1)*vec1.y;
vec2.x = (float)(Aff(0,0)*vec1.x + Aff(0,1)*vec1.y);
vec2.y = (float)(Aff(1,0)*vec1.x + Aff(0,1)*vec1.y);
float dstAngleGrad = fastAtan2(vec2.y, vec2.x);
*dstIt = KeyPoint( dstPt, dstSize, dstAngleGrad, srcIt->response, srcIt->octave, srcIt->class_id );
@ -184,8 +185,8 @@ protected:
virtual void writeDatasetRunParams( FileStorage& fs, int datasetIdx ) const = 0;
void setDefaultAllDatasetsRunParams();
virtual void setDefaultDatasetRunParams( int datasetIdx ) = 0;
virtual void readDefaultRunParams( FileNode &fn ) {};
virtual void writeDefaultRunParams( FileStorage &fs ) const {};
virtual void readDefaultRunParams( FileNode& /*fn*/ ) {}
virtual void writeDefaultRunParams( FileStorage& /*fs*/ ) const {}
virtual void readResults();
virtual void readResults( FileNode& fn, int datasetIdx, int caseIdx ) = 0;
@ -196,13 +197,13 @@ protected:
virtual void readAlgorithm( ) {};
virtual void processRunParamsFile () {};
virtual void runDatasetTest( const vector<Mat> &imgs, const vector<Mat> &Hs, int di, int &progress ) {};
virtual void runDatasetTest( const vector<Mat>& /*imgs*/, const vector<Mat>& /*Hs*/, int /*di*/, int& /*progress*/ ) {}
void run( int );
virtual void processResults( int datasetIdx );
virtual int processResults( int datasetIdx, int caseIdx ) = 0;
virtual void processResults();
virtual void writePlotData( int datasetIdx ) const {};
virtual void writePlotData( int /*datasetIdx*/ ) const {}
virtual void writeAveragePlotData() const {};
string algName;
@ -915,7 +916,7 @@ void DescriptorQualityTest::writeDefaultRunParams (FileStorage &fs) const
void DescriptorQualityTest::readDatasetRunParams( FileNode& fn, int datasetIdx )
{
commRunParams[datasetIdx].isActiveParams = (int)fn[IS_ACTIVE_PARAMS];
commRunParams[datasetIdx].isActiveParams = (int)fn[IS_ACTIVE_PARAMS] != 0;
if (commRunParams[datasetIdx].isActiveParams)
{
commRunParams[datasetIdx].keypontsFilename = (string)fn[KEYPOINTS_FILENAME];

View File

@ -296,6 +296,7 @@ public:
maxDistDif(_maxDistDif), prevTime(_prevTime), dextractor(_dextractor), distance(d) {}
protected:
virtual void createDescriptorExtractor() {}
CV_DescriptorExtractorTest& operator=(const CV_DescriptorExtractorTest&) {}
void compareDescriptors( const Mat& validDescriptors, const Mat& calcDescriptors )
{
@ -508,14 +509,14 @@ class CV_DescriptorMatcherTest : public CvTest
public:
CV_DescriptorMatcherTest( const char* testName, const Ptr<DescriptorMatcher>& _dmatcher, float _badPart ) :
CvTest( testName, "cv::DescritorMatcher::[,knn,radius]match()"), badPart(_badPart), dmatcher(_dmatcher)
{ CV_Assert( queryDescCount % 2 == 0 ); // because we split train data in same cases in two
CV_Assert( countFactor == 4); }
{}
protected:
static const int dim = 500;
static const int queryDescCount = 300;
static const int countFactor = 4;
static const int queryDescCount = 300; // must be even number because we split train data in same cases in two
static const int countFactor = 4; // do not change it
const float badPart;
CV_DescriptorMatcherTest& operator=(const CV_DescriptorMatcherTest&) {}
virtual void run( int );
void generateData( Mat& query, Mat& train );
@ -788,7 +789,7 @@ void CV_DescriptorMatcherTest::radiusMatchTest( const Mat& query, const Mat& tra
}
if( (float)badCount > (float)queryDescCount*badPart )
{
ts->printf( CvTS::LOG, "%f - too large bad matches part while test radiusMatch() function (1)\.n",
ts->printf( CvTS::LOG, "%f - too large bad matches part while test radiusMatch() function (1).\n",
(float)badCount/(float)queryDescCount );
ts->set_failed_test_info( CvTS::FAIL_INVALID_OUTPUT );
}
@ -900,8 +901,8 @@ CV_DescriptorExtractorTest<L2<float> > siftDescriptorTest( "descriptor-sift", 0.
DescriptorExtractor::create("SIFT"), 8.06652f );
CV_DescriptorExtractorTest<L2<float> > surfDescriptorTest( "descriptor-surf", 0.035f,
DescriptorExtractor::create("SURF"), 0.147372f );
CV_DescriptorExtractorTest<Hamming> briefDescriptorTest( "descriptor-brief", std::numeric_limits<float>::epsilon() + 1,
DescriptorExtractor::create("BRIEF"), 0.00527548 );
CV_DescriptorExtractorTest<Hamming> briefDescriptorTest( "descriptor-brief", 1,
DescriptorExtractor::create("BRIEF"), 0.00527548f );
CV_DescriptorExtractorTest<L2<float> > oppSiftDescriptorTest( "descriptor-opponent-sift", 0.008f,
DescriptorExtractor::create("OpponentSIFT"), 8.06652f );

View File

@ -68,7 +68,7 @@ void BruteForceMatcherTest::run( int )
ts->set_failed_test_info( CvTS::FAIL_INVALID_OUTPUT );
for( int i=0;i<descriptorsNumber;i++ )
{
float epsilon = 1e-2;
float epsilon = 0.01f;
bool isEquiv = fabs( specMatches[i].distance - genericMatches[i].distance ) < epsilon &&
specMatches[i].queryIdx == genericMatches[i].queryIdx &&
specMatches[i].trainIdx == genericMatches[i].trainIdx;