mirror of https://github.com/CGAL/cgal
Fix clang warnings
This commit is contained in:
parent
aac29a8949
commit
0880106e1f
|
|
@ -52,13 +52,14 @@ include_directories( BEFORE ../../include )
|
||||||
|
|
||||||
include( CGAL_CreateSingleSourceCGALProgram )
|
include( CGAL_CreateSingleSourceCGALProgram )
|
||||||
|
|
||||||
create_single_source_cgal_program( "example_classification.cpp" )
|
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
|
||||||
create_single_source_cgal_program( "example_generation_and_training.cpp" )
|
create_single_source_cgal_program( "example_classification.cpp" CXX_FEATURES ${needed_cxx_features} )
|
||||||
create_single_source_cgal_program( "example_feature.cpp" )
|
create_single_source_cgal_program( "example_generation_and_training.cpp" CXX_FEATURES ${needed_cxx_features} )
|
||||||
|
create_single_source_cgal_program( "example_feature.cpp" CXX_FEATURES ${needed_cxx_features} )
|
||||||
|
|
||||||
if( OpenCV_FOUND )
|
if( OpenCV_FOUND )
|
||||||
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||||
create_single_source_cgal_program( "example_random_forest.cpp" )
|
create_single_source_cgal_program( "example_random_forest.cpp" CXX_FEATURES ${needed_cxx_features} )
|
||||||
target_link_libraries( example_random_forest ${OpenCV_LIBS} )
|
target_link_libraries( example_random_forest ${OpenCV_LIBS} )
|
||||||
else()
|
else()
|
||||||
message(STATUS "OpenCV not found, random forest example won't be compiled.")
|
message(STATUS "OpenCV not found, random forest example won't be compiled.")
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,15 @@
|
||||||
#ifndef CGAL_CLASSIFICATION_H
|
#ifndef CGAL_CLASSIFICATION_H
|
||||||
#define CGAL_CLASSIFICATION_H
|
#define CGAL_CLASSIFICATION_H
|
||||||
|
|
||||||
|
#if defined(CGAL_CLASSIFICATION_VERBOSE)
|
||||||
|
#define CGAL_CLASSIFICATION_SILENT false
|
||||||
|
#else
|
||||||
|
#define CGAL_CLASSIFICATION_SILENT true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CGAL_CLASSIFICATION_CERR \
|
||||||
|
if(CGAL_CLASSIFICATION_SILENT) {} else std::cerr
|
||||||
|
|
||||||
#include <CGAL/Classification/classify.h>
|
#include <CGAL/Classification/classify.h>
|
||||||
#include <CGAL/Classification/Sum_of_weighted_features_classifier.h>
|
#include <CGAL/Classification/Sum_of_weighted_features_classifier.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ public:
|
||||||
|
|
||||||
\return a handle to the newly added feature.
|
\return a handle to the newly added feature.
|
||||||
*/
|
*/
|
||||||
#if (!defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)) || DOXYGEN_RUNNING
|
|
||||||
template <typename Feature, typename ... T>
|
template <typename Feature, typename ... T>
|
||||||
Feature_handle add (T&& ... t)
|
Feature_handle add (T&& ... t)
|
||||||
{
|
{
|
||||||
|
|
@ -84,53 +83,6 @@ public:
|
||||||
mutex_unlock();
|
mutex_unlock();
|
||||||
return fh;
|
return fh;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
template <typename Feature, typename T1>
|
|
||||||
Feature_handle add (T1& t1)
|
|
||||||
{
|
|
||||||
Feature_handle fh (new Feature(t1));
|
|
||||||
mutex_lock();
|
|
||||||
m_features.push_back (fh);
|
|
||||||
mutex_unlock();
|
|
||||||
return fh;
|
|
||||||
}
|
|
||||||
template <typename Feature, typename T1, typename T2>
|
|
||||||
Feature_handle add (T1& t1, T2& t2)
|
|
||||||
{
|
|
||||||
Feature_handle fh (new Feature(t1, t2));
|
|
||||||
mutex_lock();
|
|
||||||
m_features.push_back (fh);
|
|
||||||
mutex_unlock();
|
|
||||||
return fh;
|
|
||||||
}
|
|
||||||
template <typename Feature, typename T1, typename T2, typename T3>
|
|
||||||
Feature_handle add (T1& t1, T2& t2, T3& t3)
|
|
||||||
{
|
|
||||||
Feature_handle fh (new Feature(t1, t2, t3));
|
|
||||||
mutex_lock();
|
|
||||||
m_features.push_back (fh);
|
|
||||||
mutex_unlock();
|
|
||||||
return fh;
|
|
||||||
}
|
|
||||||
template <typename Feature, typename T1, typename T2, typename T3, typename T4>
|
|
||||||
Feature_handle add (T1& t1, T2& t2, T3& t3, T4& t4)
|
|
||||||
{
|
|
||||||
Feature_handle fh (new Feature(t1, t2, t3, t4));
|
|
||||||
mutex_lock();
|
|
||||||
m_features.push_back (fh);
|
|
||||||
mutex_unlock();
|
|
||||||
return fh;
|
|
||||||
}
|
|
||||||
template <typename Feature, typename T1, typename T2, typename T3, typename T4, typename T5>
|
|
||||||
Feature_handle add (T1& t1, T2& t2, T3& t3, T4& t4, T5& t5)
|
|
||||||
{
|
|
||||||
Feature_handle fh (new Feature(t1, t2, t3, t4, t5));
|
|
||||||
mutex_lock();
|
|
||||||
m_features.push_back (fh);
|
|
||||||
mutex_unlock();
|
|
||||||
return fh;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Removes a feature.
|
\brief Removes a feature.
|
||||||
|
|
|
||||||
|
|
@ -38,19 +38,15 @@
|
||||||
#include <tbb/mutex.h>
|
#include <tbb/mutex.h>
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
|
|
||||||
//#define CGAL_CLASSIFICATION_VERBOSE
|
#if defined(CGAL_CLASSTRAINING_VERBOSE)
|
||||||
#if defined(CGAL_CLASSIFICATION_VERBOSE)
|
#define CGAL_CLASSTRAINING_SILENT false
|
||||||
#define CGAL_CLASSIFICATION_CERR std::cerr
|
|
||||||
#else
|
#else
|
||||||
#define CGAL_CLASSIFICATION_CERR std::ostream(0)
|
#define CGAL_CLASSTRAINING_SILENT true
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define CGAL_CLASSTRAINING_VERBOSE
|
#define CGAL_CLASSTRAINING_CERR \
|
||||||
#if defined(CGAL_CLASSTRAINING_VERBOSE)
|
if(CGAL_CLASSIFICATION_SILENT) {} else std::cerr
|
||||||
#define CGAL_CLASSTRAINING_CERR std::cerr
|
|
||||||
#else
|
|
||||||
#define CGAL_CLASSTRAINING_CERR std::ostream(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
@ -150,6 +146,18 @@ private:
|
||||||
};
|
};
|
||||||
#endif // CGAL_LINKED_WITH_TBB
|
#endif // CGAL_LINKED_WITH_TBB
|
||||||
|
|
||||||
|
struct Feature_training
|
||||||
|
{
|
||||||
|
std::size_t i;
|
||||||
|
float wmin;
|
||||||
|
float wmax;
|
||||||
|
float factor;
|
||||||
|
|
||||||
|
bool operator<(const Feature_training& other) const
|
||||||
|
{
|
||||||
|
return (wmin / wmax) < (other.wmin / other.wmax);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const Label_set& m_labels;
|
const Label_set& m_labels;
|
||||||
const Feature_set& m_features;
|
const Feature_set& m_features;
|
||||||
|
|
@ -316,18 +324,6 @@ public:
|
||||||
|
|
||||||
std::vector<float> best_weights (m_features.size(), 1.);
|
std::vector<float> best_weights (m_features.size(), 1.);
|
||||||
|
|
||||||
struct Feature_training
|
|
||||||
{
|
|
||||||
std::size_t i;
|
|
||||||
float wmin;
|
|
||||||
float wmax;
|
|
||||||
float factor;
|
|
||||||
|
|
||||||
bool operator<(const Feature_training& other) const
|
|
||||||
{
|
|
||||||
return (wmin / wmax) < (other.wmin / other.wmax);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
std::vector<Feature_training> feature_train;
|
std::vector<Feature_training> feature_train;
|
||||||
std::size_t nb_trials = 100;
|
std::size_t nb_trials = 100;
|
||||||
float wmin = 1e-5f, wmax = 1e5f;
|
float wmin = 1e-5f, wmax = 1e5f;
|
||||||
|
|
@ -507,18 +503,6 @@ public:
|
||||||
|
|
||||||
std::vector<float> best_weights (m_features.size(), 1.);
|
std::vector<float> best_weights (m_features.size(), 1.);
|
||||||
|
|
||||||
struct Feature_training
|
|
||||||
{
|
|
||||||
std::size_t i;
|
|
||||||
float wmin;
|
|
||||||
float wmax;
|
|
||||||
float factor;
|
|
||||||
|
|
||||||
bool operator<(const Feature_training& other) const
|
|
||||||
{
|
|
||||||
return (wmin / wmax) < (other.wmin / other.wmax);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
std::vector<Feature_training> feature_train;
|
std::vector<Feature_training> feature_train;
|
||||||
std::size_t nb_trials = 100;
|
std::size_t nb_trials = 100;
|
||||||
float wmin = 1e-5, wmax = 1e5;
|
float wmin = 1e-5, wmax = 1e5;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue