From a6d149d8456e4be1531af05391c018b9b7f59121 Mon Sep 17 00:00:00 2001 From: rmsalinas Date: Thu, 4 Oct 2018 14:21:28 +0200 Subject: [PATCH] removed to warnings --- src/fbow.cpp | 4 ++-- src/fbow.h | 11 ++++++----- src/vocabulary_creator.h | 4 ++-- tests/dbow2/TemplatedVocabulary.h | 4 ++-- tests/test_dbow2VSfbow.cpp | 2 +- utils/fbow_create_voc_step0.cpp | 4 ++-- utils/fbow_create_voc_step0_list.cpp | 4 ++-- utils/fbow_transform.cpp | 6 ++++-- utils/image_matching.cpp | 10 +++++----- 9 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/fbow.cpp b/src/fbow.cpp index c0bbabd..19cd4d4 100644 --- a/src/fbow.cpp +++ b/src/fbow.cpp @@ -9,11 +9,11 @@ namespace fbow{ Vocabulary::~Vocabulary(){ - if (_data!=0) AlignedFree( _data); + if (_data!=nullptr) AlignedFree( _data); } -void Vocabulary::setParams(int aligment, int k, int desc_type, int desc_size, int nblocks, std::string desc_name)throw(std::runtime_error){ +void Vocabulary::setParams(int aligment, int k, int desc_type, int desc_size, int nblocks, std::string desc_name) { auto ns= desc_name.size()(49)?desc_name.size():128; desc_name.resize(ns); diff --git a/src/fbow.h b/src/fbow.h index bccbc62..932d503 100644 --- a/src/fbow.h +++ b/src/fbow.h @@ -112,7 +112,7 @@ class FBOW_API Vocabulary uint64_t hash()const; private: - void setParams( int aligment,int k,int desc_type,int desc_size, int nblocks,std::string desc_name)throw(std::runtime_error); + void setParams( int aligment,int k,int desc_type,int desc_size, int nblocks,std::string desc_name) ; struct params{ char _desc_name_[50];//descriptor name. May be empty uint32_t _aligment=0,_nblocks=0 ;//memory aligment and total number of blocks @@ -125,7 +125,7 @@ class FBOW_API Vocabulary uint32_t _m_k=0;//number of children per node }; params _params; - char * _data=0;//pointer to data + char * _data=nullptr;//pointer to data //structure represeting a information about node in a block struct block_node_info{ @@ -211,14 +211,14 @@ class FBOW_API Vocabulary int _block_desc_size_bytes_wp; register_type *feature=0; public: - ~Lx(){if (feature!=0)AlignedFree(feature);} + virtual ~Lx(){if (feature!=0)AlignedFree(feature);} void setParams(int desc_size, int block_desc_size_bytes_wp){ assert(block_desc_size_bytes_wp%aligment==0); _desc_size=desc_size; _block_desc_size_bytes_wp=block_desc_size_bytes_wp; assert(_block_desc_size_bytes_wp%sizeof(register_type )==0); _nwords=_block_desc_size_bytes_wp/sizeof(register_type );//number of aligned words - feature=(register_type*)AlignedAlloc(aligment,_nwords*sizeof(register_type )); + feature=static_cast (AlignedAlloc(aligment,_nwords*sizeof(register_type ))); memset(feature,0,_nwords*sizeof(register_type )); } inline void startwithfeature(const register_type *feat_ptr){memcpy(feature,feat_ptr,_desc_size);} @@ -228,7 +228,7 @@ class FBOW_API Vocabulary struct L2_generic:public Lx{ - ~L2_generic(){ } + virtual ~L2_generic(){ } inline float computeDist(float *fptr){ float d=0; for(int f=0;f<_nwords;f++) d+= (feature[f]-fptr[f])*(feature[f]-fptr[f]); @@ -247,6 +247,7 @@ class FBOW_API Vocabulary #else struct L2_avx_generic:public Lx<__m256,float,32>{ + virtual ~L2_avx_generic(){} inline float computeDist(__m256 *ptr){ __m256 sum=_mm256_setzero_ps(), sub_mult; //substract, multiply and accumulate diff --git a/src/vocabulary_creator.h b/src/vocabulary_creator.h index e71060c..e8a24b0 100644 --- a/src/vocabulary_creator.h +++ b/src/vocabulary_creator.h @@ -151,8 +151,8 @@ class FBOW_API VocabularyCreator } - uint32_t id;//id of this node in the tree - uint32_t parent;//id of the parent node + uint32_t id=std::numeric_limits::max();//id of this node in the tree + uint32_t parent=std::numeric_limits::max();//id of the parent node cv::Mat feature;//feature of this node //index of the feature this node represent(only if leaf and it stop because not enough points to create a new leave. //In case the node is a terminal point, but has many points beloging to its cluster, then, this is not set. diff --git a/tests/dbow2/TemplatedVocabulary.h b/tests/dbow2/TemplatedVocabulary.h index 6e70a00..0654bf3 100644 --- a/tests/dbow2/TemplatedVocabulary.h +++ b/tests/dbow2/TemplatedVocabulary.h @@ -565,8 +565,8 @@ void TemplatedVocabulary::create( m_words.clear(); // expected_nodes = Sum_{i=0..L} ( k^i ) - int expected_nodes = - (int)((pow((double)m_k, (double)m_L + 1) - 1)/(m_k - 1)); +// int expected_nodes = +// (int)((pow((double)m_k, (double)m_L + 1) - 1)/(m_k - 1)); // m_nodes.reserve(expected_nodes); // avoid allocations when creating the tree diff --git a/tests/test_dbow2VSfbow.cpp b/tests/test_dbow2VSfbow.cpp index 3ae54ce..860f210 100644 --- a/tests/test_dbow2VSfbow.cpp +++ b/tests/test_dbow2VSfbow.cpp @@ -25,7 +25,7 @@ std::vector toDescriptorVector(const cv::Mat &Descriptors) return vDesc; } -std::vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ +std::vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") { //select detector cv::Ptr fdetector; if (descriptor=="orb") fdetector=cv::ORB::create(2000); diff --git a/utils/fbow_create_voc_step0.cpp b/utils/fbow_create_voc_step0.cpp index 879dc40..9b1554b 100644 --- a/utils/fbow_create_voc_step0.cpp +++ b/utils/fbow_create_voc_step0.cpp @@ -33,7 +33,7 @@ void wait() -vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ +vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") { //select detector cv::Ptr fdetector; if (descriptor=="orb") fdetector=cv::ORB::create(2000); @@ -70,7 +70,7 @@ vector< cv::Mat > loadFeatures( std::vector path_to_images,string desc } // ---------------------------------------------------------------------------- -void saveToFile(string filename,const vector &features, std::string desc_name,bool rewrite =true)throw (std::exception){ +void saveToFile(string filename,const vector &features, std::string desc_name,bool rewrite =true){ //test it is not created if (!rewrite){ diff --git a/utils/fbow_create_voc_step0_list.cpp b/utils/fbow_create_voc_step0_list.cpp index bb79989..9307aea 100644 --- a/utils/fbow_create_voc_step0_list.cpp +++ b/utils/fbow_create_voc_step0_list.cpp @@ -51,7 +51,7 @@ vector readImagePathsFromFile(char * txtlist){ return paths; } -vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ +vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") { //select detector cv::Ptr fdetector; if (descriptor=="orb") fdetector=cv::ORB::create(2000); @@ -85,7 +85,7 @@ vector< cv::Mat > loadFeatures( std::vector path_to_images,string desc } // ---------------------------------------------------------------------------- -void saveToFile(string filename,const vector &features, std::string desc_name,bool rewrite =true)throw (std::exception){ +void saveToFile(string filename,const vector &features, std::string desc_name,bool rewrite =true){ //test it is not created if (!rewrite){ diff --git a/utils/fbow_transform.cpp b/utils/fbow_transform.cpp index 179aec1..02843bb 100644 --- a/utils/fbow_transform.cpp +++ b/utils/fbow_transform.cpp @@ -16,7 +16,7 @@ using namespace std; #include class CmdLineParser{int argc; char **argv; public: CmdLineParser(int _argc,char **_argv):argc(_argc),argv(_argv){} bool operator[] ( string param ) {int idx=-1; for ( int i=0; i loadFeatures( std::vector path_to_images,string descriptor="") throw (std::exception){ + vector< cv::Mat > loadFeatures( std::vector path_to_images,string descriptor="") { //select detector cv::Ptr fdetector; if (descriptor=="orb") fdetector=cv::ORB::create(2000); @@ -73,7 +73,9 @@ int main(int argc,char **argv){ cout<<"time="<(t_end-t_start).count())<<" ms"<first<<" "<second<first<<" "<second< class CmdLineParser { int argc; char **argv; public: CmdLineParser(int _argc, char **_argv) :argc(_argc), argv(_argv) {} bool operator[] (string param) { int idx = -1; for (int i = 0; i loadFeatures(std::vector path_to_images, string descriptor = "") throw (std::exception) { +vector< cv::Mat > loadFeatures(std::vector path_to_images, string descriptor = "") { //select detector cv::Ptr fdetector; if (descriptor == "orb") fdetector = cv::ORB::create(2000); @@ -67,18 +67,18 @@ int main(int argc, char **argv) { { filenames[i - 3] = { argv[i] }; } - for (int i = 0; i score; - for (int j = 0; j