Commit 92ac70dc authored by Davis King's avatar Davis King

Now the tool can modify the ground truth boxes.

parent 0a1069d0
...@@ -49,6 +49,9 @@ metadata_editor( ...@@ -49,6 +49,9 @@ metadata_editor(
overlay_label_name.set_text("Next Label: "); overlay_label_name.set_text("Next Label: ");
overlay_label.set_width(200); overlay_label.set_width(200);
display.set_overlay_rects_changed_handler(*this, &metadata_editor::on_overlay_rects_changed);
overlay_label.set_text_modified_handler(*this, &metadata_editor::on_overlay_label_changed);
mbar.set_number_of_menus(1); mbar.set_number_of_menus(1);
mbar.set_menu_name(0,"File",'F'); mbar.set_menu_name(0,"File",'F');
...@@ -350,4 +353,36 @@ load_image_and_set_size( ...@@ -350,4 +353,36 @@ load_image_and_set_size(
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
void metadata_editor::
on_overlay_rects_changed(
)
{
using namespace dlib::image_dataset_metadata;
if (image_pos < metadata.images.size())
{
const std::vector<image_display::overlay_rect>& rects = display.get_overlay_rects();
std::vector<box>& boxes = metadata.images[image_pos].boxes;
boxes.clear();
for (unsigned long i = 0; i < rects.size(); ++i)
{
box temp;
temp.label = rects[i].label;
temp.rect = rects[i].rect;
boxes.push_back(temp);
}
}
}
// ----------------------------------------------------------------------------------------
void metadata_editor::
on_overlay_label_changed(
)
{
display.set_default_overlay_rect_label(trim(overlay_label.text()));
}
// ----------------------------------------------------------------------------------------
...@@ -35,6 +35,8 @@ private: ...@@ -35,6 +35,8 @@ private:
void save_metadata_to_file (const std::string& file); void save_metadata_to_file (const std::string& file);
void load_image(unsigned long idx); void load_image(unsigned long idx);
void load_image_and_set_size(unsigned long idx); void load_image_and_set_size(unsigned long idx);
void on_overlay_rects_changed();
void on_overlay_label_changed();
std::string filename; std::string filename;
dlib::image_dataset_metadata::dataset metadata; dlib::image_dataset_metadata::dataset metadata;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment