Skip to content

Commit

Permalink
MVP for database querying works. The test needs some work though.
Browse files Browse the repository at this point in the history
  • Loading branch information
PizzaRoll04 committed Nov 4, 2024
1 parent 56ea351 commit f526d2d
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 10 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

9 changes: 7 additions & 2 deletions experimental/learn_descriptors/symphony_lake_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

#include <iostream>

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
DataParser::DataParser(const std::string &image_root_dir,
const std::vector<std::string> &survey_list) {
_surveys.load(image_root_dir, survey_list);
}
DataParser::~DataParser() {}
} // namespace robot::experimental::learn_descriptors::symphony_lake_parser
14 changes: 12 additions & 2 deletions experimental/learn_descriptors/symphony_lake_parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
class DataParser {
public:
DataParser(const std::string &image_root_dir, const std::vector<std::string> &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
55 changes: 52 additions & 3 deletions experimental/learn_descriptors/symphony_lake_parser_test.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,56 @@
#include "experimental/learn_descriptors/symphony_lake_parser.hh"

#include <iostream>
#include <sstream>
#include <string>
#include <vector>

#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<std::string> 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
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<int>(survey_vector.getNumSurveys()); i++) {
const symphony_lake_dataset::Survey &survey = survey_vector.get(i);
for (int j = 0; j < static_cast<int>(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

0 comments on commit f526d2d

Please sign in to comment.