|
14 | 14 | #include <QPushButton> |
15 | 15 | #include <QResizeEvent> |
16 | 16 | #include <iostream> |
| 17 | +#include <fstream> |
| 18 | +#include <filesystem> |
17 | 19 | #include "Common/Cpp/Json/JsonObject.h" |
18 | 20 | #include "Common/Cpp/Json/JsonValue.h" |
19 | 21 | #include "Common/Qt/CollapsibleGroupBox.h" |
|
24 | 26 | #include "ML_LabelImages.h" |
25 | 27 | #include "Pokemon/Pokemon_Strings.h" |
26 | 28 | #include "Common/Qt/Options/ConfigWidget.h" |
| 29 | +#include "ML/DataLabeling/SegmentAnythingEmbedding.h" |
27 | 30 |
|
28 | 31 |
|
29 | 32 | using std::cout; |
@@ -52,7 +55,7 @@ DrawnBoundingBox::~DrawnBoundingBox(){ |
52 | 55 | void DrawnBoundingBox::on_config_value_changed(void* object){ |
53 | 56 | std::lock_guard<std::mutex> lg(m_lock); |
54 | 57 | m_overlay_set.clear(); |
55 | | - m_overlay_set.add(COLOR_RED, {m_parent.X, m_parent.Y, m_parent.WIDTH, m_parent.HEIGHT}); |
| 58 | + m_overlay_set.add(COLOR_RED, {m_parent.X, m_parent.Y, m_parent.WIDTH, m_parent.HEIGHT}, "Unknown"); |
56 | 59 | } |
57 | 60 | void DrawnBoundingBox::on_mouse_press(double x, double y){ |
58 | 61 | m_parent.WIDTH.set(0); |
@@ -109,6 +112,7 @@ LabelImages_Descriptor::LabelImages_Descriptor() |
109 | 112 | {} |
110 | 113 |
|
111 | 114 |
|
| 115 | + |
112 | 116 | #define ADD_OPTION(x) m_options.add_option(x, #x) |
113 | 117 |
|
114 | 118 | LabelImages::LabelImages(const LabelImages_Descriptor& descriptor) |
@@ -177,20 +181,23 @@ LabelImages_Widget::LabelImages_Widget( |
177 | 181 | QPushButton* button = new QPushButton("This is a button", scroll_inner); |
178 | 182 | scroll_layout->addWidget(button); |
179 | 183 | connect(button, &QPushButton::clicked, this, [&instance](bool){ |
180 | | - const VideoSourceDescriptor* videoSource = instance.m_switch_control_option.m_video.descriptor().get(); |
181 | | - auto imageSource = dynamic_cast<const VideoSourceDescriptor_StillImage*>(videoSource); |
182 | | - if (imageSource != nullptr){ |
183 | | - cout << "Image source: " << imageSource->path() << endl; |
| 184 | + const VideoSourceDescriptor* video_source = instance.m_switch_control_option.m_video.descriptor().get(); |
| 185 | + auto image_source = dynamic_cast<const VideoSourceDescriptor_StillImage*>(video_source); |
| 186 | + if (image_source != nullptr){ |
| 187 | + cout << "Image source: " << image_source->path() << endl; |
184 | 188 | } |
185 | 189 | }); |
186 | 190 |
|
187 | 191 | m_option_widget = instance.m_options.make_QtWidget(*scroll_inner); |
188 | 192 | scroll_layout->addWidget(&m_option_widget->widget()); |
189 | 193 |
|
190 | | - const VideoSourceDescriptor* videoSource = instance.m_switch_control_option.m_video.descriptor().get(); |
191 | | - auto imageSource = dynamic_cast<const VideoSourceDescriptor_StillImage*>(videoSource); |
192 | | - if (imageSource != nullptr){ |
193 | | - cout << "Image source: " << imageSource->path() << endl; |
| 194 | + const VideoSourceDescriptor* video_source = instance.m_switch_control_option.m_video.descriptor().get(); |
| 195 | + auto image_source = dynamic_cast<const VideoSourceDescriptor_StillImage*>(video_source); |
| 196 | + if (image_source != nullptr){ |
| 197 | + std::string image_path = image_source->path(); |
| 198 | + cout << "Image source: " << image_path << endl; |
| 199 | + // if no such embedding file, m_iamge_embedding will be empty |
| 200 | + load_image_embedding(image_path, m_image_embedding); |
194 | 201 | } |
195 | 202 | cout << "LabelImages_Widget built" << endl; |
196 | 203 | } |
|
0 commit comments