Skip to content

Commit

Permalink
remove boost from gui demo
Browse files Browse the repository at this point in the history
  • Loading branch information
zddhub committed Apr 10, 2017
1 parent 607b226 commit 8d47b17
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
1 change: 0 additions & 1 deletion gui/SketchSearchDemo/SketchSearchDemo.pro
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ INCLUDEPATH += $$PWD \

LIBS += -L/usr/local/lib/ \
-lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_highgui -lopencv_features2d -lopencv_ml \
-lboost_thread -lboost_system \
-lopensse
}

Expand Down
4 changes: 1 addition & 3 deletions gui/SketchSearchDemo/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
PropertyTree_t config;

boost::property_tree::read_json("/tmp/SketchSearchDemo/config.json", config); //
Json config = Json("/tmp/SketchSearchDemo/config.json"); //
searchEngine = new SketchSearcher(config);

setupMenuBar();
Expand Down
14 changes: 7 additions & 7 deletions gui/SketchSearchDemo/sketchsearcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
#include "sketchsearcher.h"
using namespace sse;

SketchSearcher::SketchSearcher(const PropertyTree_t &parameters)
: _indexFile(parse<std::string>(parameters, "searcher.indexfile", "/tmp/SketchSearchDemo/data/model_indexfile"))
, _vocabularyFile(parse<std::string>(parameters, "searcher.vocabulary", "/tmp/SketchSearchDemo/data/vocabulary"))
, _rootdir(parse<std::string>(parameters, "searcher.rootdir", "/tmp/SketchSearchDemo/"))
, _fileList(parse<std::string>(parameters, "searcher.filelist", "/tmp/SketchSearchDemo/data/model_filelist"))
, _numOfResults(parse<uint>(parameters, "searcher.results_num", 25))
, _numOfViews(parse<uint>(parameters, "searcher.views_num", 1))
SketchSearcher::SketchSearcher(Json &config)
: _indexFile(config.getValue("searcher$indexfile", "/tmp/SketchSearchDemo/data/model_indexfile"))
, _vocabularyFile(config.getValue("searcher$vocabulary", "/tmp/SketchSearchDemo/data/vocabulary"))
, _rootdir(config.getValue("searcher$rootdir", "/tmp/SketchSearchDemo/"))
, _fileList(config.getValue("searcher$filelist", "/tmp/SketchSearchDemo/data/model_filelist"))
, _numOfResults(convert<uint>(config.getValue("searcher$results_num", "25"), UINT))
, _numOfViews(convert<uint>(config.getValue("searcher$views_num", "1"), UINT))
{
index = new InvertedIndex();
index->load(_indexFile);
Expand Down
12 changes: 1 addition & 11 deletions gui/SketchSearchDemo/sketchsearcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@

#include "opensse/opensse.h"

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
typedef boost::property_tree::ptree PropertyTree_t;
template<class T>
inline T parse(const PropertyTree_t &p, const std::string &path, const T &defaultValue)
{
T value = p.get(path, defaultValue);
return value;
}

class SketchSearcher : public SearchEngine
{
public:
SketchSearcher(const PropertyTree_t &parameters);
SketchSearcher(Json &config);
virtual ~SketchSearcher();

void query(const std::string &fileName, QueryResults &results);
Expand Down
3 changes: 2 additions & 1 deletion opensse.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include "sse/index/invertedindex.h"
#include "sse/io/filelist.h"
#include "sse/io/reader_writer.h"
#include "sse/io/json_parser.h"
#include "sse/quantize/quantizer.h"
#include "sse/vocabulary/kmeans_init.h"
#include "sse/vocabulary/kmeans.h"
// #include "sse/vocabulary/kmeans.h"

#endif
7 changes: 1 addition & 6 deletions opensse.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,5 @@ TEMPLATE = subdirs

SUBDIRS += \
#opensse.pri \
tests/test_galif \
tests/test_reader_and_writer \
gui/SketchSearchDemo \
tests/test_similarity \
tests/stat_vocab \
tests/test_search
gui/SketchSearchDemo

1 change: 1 addition & 0 deletions sse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(
SOURCES
io/filelist.cpp
io/reader_writer.cpp
io/json_parser.cpp
features/util.cpp
features/generator.cpp
features/detector.cpp
Expand Down
2 changes: 1 addition & 1 deletion sse/io/json_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ Json::Json(const string &filename)
const string& Json::getValue(const string &key, const string &defaultValue)
{
return values[key].empty() ? defaultValue : values[key];
}
}
14 changes: 14 additions & 0 deletions sse/io/json_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
#include <string>
using namespace std;

enum VALUE_TYPE {
UINT
};

template <class T>
T convert(const string &value, VALUE_TYPE type)
{
if (type == UINT) {
char *end;
return static_cast<T>(strtol(value.c_str(), &end, 10));
}
return T(0);
};

class Json {
public:
Json(const string &filename);
Expand Down
3 changes: 2 additions & 1 deletion sse/opensse.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include "opensse/index/invertedindex.h"
#include "opensse/io/filelist.h"
#include "opensse/io/reader_writer.h"
#include "opensse/io/json_parser.h"
#include "opensse/quantize/quantizer.h"
#include "opensse/vocabulary/kmeans_init.h"
#include "opensse/vocabulary/kmeans.h"
// #include "opensse/vocabulary/kmeans.h"

#endif
1 change: 1 addition & 0 deletions tools/vocabulary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using namespace std;

#include "opensse/opensse.h"
#include "vocabulary/kmeans.h"

using namespace sse;

Expand Down

0 comments on commit 8d47b17

Please sign in to comment.