Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add colourlist feature #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src-darkmark/DMContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ void dm::DMContent::start_darknet()
empty_image_name_index = names.size();
names.push_back("* empty image *");

annotation_colours = DarkHelp::get_default_annotation_colours();
const std::string colorlist_filename = cfg().get_str(cfg_prefix + "markup_colours");
DarkHelp::load_custom_annotation_colours(colorlist_filename);
annotation_colours = DarkHelp::get_default_annotation_colours();
if (annotation_colours.empty() == false)
{
Expand Down Expand Up @@ -1231,7 +1234,7 @@ dm::DMContent & dm::DMContent::load_image(const size_t new_idx, const bool full_
}
}

// Sort the marks based on a gross (rounded) X and Y position of the midpoint. This way when
// Sort the marks based on a gross (rounded) X and Y position of the midpoint. This way when
// the user presses TAB or SHIFT+TAB the marks appear in a consistent and predictable order.
task = "sorting marks";
std::sort(marks.begin(), marks.end(),
Expand Down
6 changes: 5 additions & 1 deletion src-launcher/StartupCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ dm::StartupCanvas::StartupCanvas(const std::string & key, const std::string & di
darknet_configuration_filename .addListener(this);
darknet_weights_filename .addListener(this);
darknet_names_filename .addListener(this);
colourlist_filename .addListener(this);

Array<PropertyComponent *> properties;

Expand Down Expand Up @@ -145,6 +146,7 @@ dm::StartupCanvas::StartupCanvas(const std::string & key, const std::string & di
properties.add(new TextPropertyComponent(darknet_configuration_filename , "darknet configuration" , 1000, false, true));
properties.add(new TextPropertyComponent(darknet_weights_filename , "darknet weights" , 1000, false, true));
properties.add(new TextPropertyComponent(darknet_names_filename , "classes/names" , 1000, false, true));
properties.add(new TextPropertyComponent(colourlist_filename , "markup colours" , 1000, false, true));

pp.addProperties(properties);
properties.clear();
Expand All @@ -170,7 +172,7 @@ dm::StartupCanvas::~StartupCanvas()
void dm::StartupCanvas::resized()
{
const int margin_size = 5;
const int number_of_lines = 17;
const int number_of_lines = 18;
const int height_per_line = 25;
const int total_pp_height = number_of_lines * height_per_line;

Expand Down Expand Up @@ -505,6 +507,7 @@ void dm::StartupCanvas::refresh()
darknet_configuration_filename = cfg().getValue("project_" + cfg_key + "_cfg" );
darknet_weights_filename = cfg().getValue("project_" + cfg_key + "_weights" );
darknet_names_filename = cfg().getValue("project_" + cfg_key + "_names" );
colourlist_filename = cfg().getValue("project_" + cfg_key + "_markup_colours" );

done = false;
t = std::thread(&StartupCanvas::initialize_on_thread, this);
Expand Down Expand Up @@ -842,3 +845,4 @@ void dm::StartupCanvas::calculate_size_of_directory()

return;
}

1 change: 1 addition & 0 deletions src-launcher/StartupCanvas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace dm
Value darknet_configuration_filename;
Value darknet_weights_filename;
Value darknet_names_filename;
Value colourlist_filename;

TableListBox table;

Expand Down
1 change: 1 addition & 0 deletions src-launcher/StartupWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ void dm::StartupWnd::buttonClicked(Button * button)
cfg().setValue(prefix + "names" , notebook_canvas->darknet_names_filename );
cfg().setValue(prefix + "darknet_cfg_template" , notebook_canvas->darknet_configuration_template );
cfg().setValue(prefix + "timestamp" , static_cast<int>(std::time(nullptr)) );
cfg().setValue(prefix + "markup_colours" , notebook_canvas->colourlist_filename );

// Prior to 2020-05-30, there were many settings in configuration that were "global". Every time a project
// was loaded, the settings were copied over to the global name. This mess is because when it was first
Expand Down