diff --git a/WORKSPACE b/WORKSPACE index 1929f9ff..ad55cfab 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -432,9 +432,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "symphony_lake_parser", - urls = ["https://github.com/cedricpradalier/SymphonyLakeDataset/archive/5366560263b660b0151844a297effa517480991a.zip"], - strip_prefix = "SymphonyLakeDataset-5366560263b660b0151844a297effa517480991a", + urls = ["https://github.com/pizzaroll04/SymphonyLakeDataset/archive/4b38c2519270a43f76858e6c97c1f1de1735e5d0.zip"], + strip_prefix = "SymphonyLakeDataset-4b38c2519270a43f76858e6c97c1f1de1735e5d0", build_file = "//third_party:BUILD.symphony_lake_parser", - sha256 = "ab80544a4a7d8554e92c49e9b43e5bdbce0d84654798262c36134cd1224070be", + sha256 = "d203e486507c7950ae9a346406fe2c42f8b2d204e8d25ba07a47c834f4ae8ede", ) diff --git a/experimental/learn_descriptors/symphony_lake_parser.cc b/experimental/learn_descriptors/symphony_lake_parser.cc index f0b48522..75c3b0fa 100644 --- a/experimental/learn_descriptors/symphony_lake_parser.cc +++ b/experimental/learn_descriptors/symphony_lake_parser.cc @@ -2,6 +2,11 @@ #include -namespace robot::experimental::learn_descriptors::symphony_lake_dataset { +namespace robot::experimental::learn_descriptors::symphony_lake_parser { void hello_world(const std::string &msg) { std::cout << msg << std::endl; } -} // namespace robot::experimental::learn_descriptors::symphony_lake_dataset \ No newline at end of file +DataParser::DataParser(const std::string &image_root_dir, + const std::vector &survey_list) { + _surveys.load(image_root_dir, survey_list); +} +DataParser::~DataParser() {} +} // namespace robot::experimental::learn_descriptors::symphony_lake_parser \ No newline at end of file diff --git a/experimental/learn_descriptors/symphony_lake_parser.hh b/experimental/learn_descriptors/symphony_lake_parser.hh index a148254c..1a837902 100644 --- a/experimental/learn_descriptors/symphony_lake_parser.hh +++ b/experimental/learn_descriptors/symphony_lake_parser.hh @@ -4,6 +4,16 @@ #include "symphony_lake_dataset/SurveyVector.h" -namespace robot::experimental::learn_descriptors::symphony_lake_dataset { +namespace robot::experimental::learn_descriptors::symphony_lake_parser { void hello_world(const std::string &msg); -} \ No newline at end of file +class DataParser { + public: + DataParser(const std::string &image_root_dir, const std::vector &survey_list); + ~DataParser(); + + const symphony_lake_dataset::SurveyVector &getSurveys() const { return _surveys; }; + + private: + symphony_lake_dataset::SurveyVector _surveys; +}; +} // namespace robot::experimental::learn_descriptors::symphony_lake_parser \ No newline at end of file diff --git a/experimental/learn_descriptors/symphony_lake_parser_test.cc b/experimental/learn_descriptors/symphony_lake_parser_test.cc index a31449f1..e4d58a7f 100644 --- a/experimental/learn_descriptors/symphony_lake_parser_test.cc +++ b/experimental/learn_descriptors/symphony_lake_parser_test.cc @@ -1,7 +1,56 @@ #include "experimental/learn_descriptors/symphony_lake_parser.hh" +#include +#include +#include +#include + #include "gtest/gtest.h" +#include "opencv2/opencv.hpp" + +namespace robot::experimental::learn_descriptors::symphony_lake_parser { +TEST(SymphonyLakeParserTest, hello_world) { + hello_world("hello from symphony lake dataset. includes working well."); +} + +TEST(SymphonyLakeParserTest, database_query) { + std::string image_root_dir = "/home/pizzaroll04/Documents/datasets/symphony_lake_full"; + std::string surveys = "140106"; + std::vector survey_list; + std::cout << "\nEnter root image directory: "; + // std::cin >> image_root_dir; + std::cout << "\nEnter surveys separated by spaces: "; + // std::getline(std::cin, surveys); + + std::string token; + std::stringstream ss(surveys); + while (std::getline(ss, token, ' ')) { + survey_list.push_back(token); + } + + DataParser data_parser = DataParser(image_root_dir, survey_list); + + const symphony_lake_dataset::SurveyVector &survey_vector = data_parser.getSurveys(); -namespace robot::experimental::learn_descriptors::symphony_lake_dataset { -TEST(SymphonyLakeParserTest, hello_world) { hello_world("womp womp"); } -} // namespace robot::experimental::learn_descriptors::symphony_lake_dataset \ No newline at end of file + cv::Mat image; + cv::namedWindow("Symphony Dataset Image", cv::WINDOW_AUTOSIZE); + printf("Press 'q' in graphic window to quit\n"); + for (int i = 0; i < static_cast(survey_vector.getNumSurveys()); i++) { + const symphony_lake_dataset::Survey &survey = survey_vector.get(i); + for (int j = 0; j < static_cast(survey.getNumImages()); j++) { + int key = cv::waitKey(1) & 0xFF; + switch (key) { + case 'q': + case 'Q': + case 0x27: + return; + break; + default: + break; + } + image = survey.loadImageByImageIndex(j); + cv::imshow("Symphony Dataset Image", image); + } + } +} +} // namespace robot::experimental::learn_descriptors::symphony_lake_parser \ No newline at end of file