diff --git a/modules/features2d/src/calonder.cpp b/modules/features2d/src/calonder.cpp index a49887d33382477e5f21c034f214986a95467d40..bf3193abdb8fb1ddc56133736ee89ec58e91a36c 100644 --- a/modules/features2d/src/calonder.cpp +++ b/modules/features2d/src/calonder.cpp @@ -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& 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(retrieved_hits)/static_cast(idx+1); recall[idx+1] = static_cast(retrieved_hits)/static_cast(recall_norm); @@ -897,12 +897,12 @@ void VocData::calcPrecRecall_impl(const vector& 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::iterator recall_it = recall.begin(); @@ -1037,7 +1037,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector(img_objects.size()); + output_values[class_idx] += 1.f/static_cast(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 ) { diff --git a/samples/cpp/brief_match_test.cpp b/samples/cpp/brief_match_test.cpp index 68013f4eff73a31f573a115779396df7c84153e3..55cb86c42ce0e596a5c9ce2e2db88d3bbade1dd9 100644 --- a/samples/cpp/brief_match_test.cpp +++ b/samples/cpp/brief_match_test.cpp @@ -45,7 +45,7 @@ float match(const vector& kpts_train, const vector& kpts_que const Mat& train, const Mat& query, vector& matches) { - float t = (double)getTickCount(); + double t = (double)getTickCount(); matcher.match(query, train, matches); //Using features2d return ((double)getTickCount() - t) / getTickFrequency(); } diff --git a/tests/cv/src/adetectordescriptor_evaluation.cpp b/tests/cv/src/adetectordescriptor_evaluation.cpp index 071114ee8942ab91d4c08afaf63b6ab06ae30140..fb6f2c451e43f0886b9aed02bc1d53a7ed58047f 100644 --- a/tests/cv/src/adetectordescriptor_evaluation.cpp +++ b/tests/cv/src/adetectordescriptor_evaluation.cpp @@ -58,7 +58,8 @@ static inline Point2f applyHomography( const Mat_& 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::max(), numeric_limits::max() ); } @@ -103,13 +104,13 @@ static void calcKeyPointProjections( const vector& src, const Mat_ dstM; invert(Aff*invM*Aff.t(), dstM); Mat_ 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 &imgs, const vector &Hs, int di, int &progress ) {}; + virtual void runDatasetTest( const vector& /*imgs*/, const vector& /*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]; diff --git a/tests/cv/src/afeatures2d.cpp b/tests/cv/src/afeatures2d.cpp index a87f84cf47cf7f3f8f0193316160665f16112f94..99f64e509a4794d2c439c16496eee03772c7864a 100644 --- a/tests/cv/src/afeatures2d.cpp +++ b/tests/cv/src/afeatures2d.cpp @@ -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& _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 > siftDescriptorTest( "descriptor-sift", 0. DescriptorExtractor::create("SIFT"), 8.06652f ); CV_DescriptorExtractorTest > surfDescriptorTest( "descriptor-surf", 0.035f, DescriptorExtractor::create("SURF"), 0.147372f ); -CV_DescriptorExtractorTest briefDescriptorTest( "descriptor-brief", std::numeric_limits::epsilon() + 1, - DescriptorExtractor::create("BRIEF"), 0.00527548 ); +CV_DescriptorExtractorTest briefDescriptorTest( "descriptor-brief", 1, + DescriptorExtractor::create("BRIEF"), 0.00527548f ); CV_DescriptorExtractorTest > oppSiftDescriptorTest( "descriptor-opponent-sift", 0.008f, DescriptorExtractor::create("OpponentSIFT"), 8.06652f ); diff --git a/tests/cv/src/tabruteforcematcher.cpp b/tests/cv/src/tabruteforcematcher.cpp index d6308691764cf72811e5d824ae23dbe53de029ed..f43ee33b7c96799bdd44db5d2a62892101362882 100644 --- a/tests/cv/src/tabruteforcematcher.cpp +++ b/tests/cv/src/tabruteforcematcher.cpp @@ -68,7 +68,7 @@ void BruteForceMatcherTest::run( int ) ts->set_failed_test_info( CvTS::FAIL_INVALID_OUTPUT ); for( int i=0;i