Skip to content

Commit 302fc86

Browse files
committed
2 parents 701956a + 766bdad commit 302fc86

File tree

12 files changed

+479
-104
lines changed

12 files changed

+479
-104
lines changed

SerialPrograms/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,8 @@ file(GLOB MAIN_SOURCES
871871
Source/Kernels/Waterfill/Kernels_Waterfill_Session.h
872872
Source/Kernels/Waterfill/Kernels_Waterfill_Session.tpp
873873
Source/Kernels/Waterfill/Kernels_Waterfill_Types.h
874-
Source/ML/DataLabeling/SegmentAnythingEmbedding.cpp
875-
Source/ML/DataLabeling/SegmentAnythingEmbedding.h
874+
Source/ML/DataLabeling/SegmentAnythingModel.cpp
875+
Source/ML/DataLabeling/SegmentAnythingModel.h
876876
Source/ML/ML_Panels.cpp
877877
Source/ML/ML_Panels.h
878878
Source/ML/Programs/ML_LabelImages.cpp

SerialPrograms/Source/CommonFramework/Globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const std::string& USER_FILE_PATH();
5757
// Resource folder path. Resources include JSON files, images, sound files and others required by
5858
// various automation programs.
5959
const std::string& RESOURCE_PATH();
60-
// Hold ML trainign data.
60+
// Hold ML training data.
6161
const std::string& TRAINING_PATH();
6262

6363

SerialPrograms/Source/CommonFramework/VideoPipeline/UI/VideoOverlayWidget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ void VideoOverlayWidget::resizeEvent(QResizeEvent* event){}
9797

9898
void VideoOverlayWidget::paintEvent(QPaintEvent*){
9999
QPainter painter(this);
100-
101100
{
102101
WriteSpinLock lg(m_lock, "VideoOverlay::paintEvent()");
103102

SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSources/VideoSource_StillImage.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ std::string VideoSourceDescriptor_StillImage::path() const{
3535
void VideoSourceDescriptor_StillImage::set_path(std::string path){
3636
WriteSpinLock lg(m_lock);
3737
m_path = std::move(path);
38+
m_source_image_height = m_source_image_width = 0;
3839
}
3940

4041
void VideoSourceDescriptor_StillImage::run_post_select(){
@@ -52,6 +53,7 @@ void VideoSourceDescriptor_StillImage::load_json(const JsonValue& json){
5253
if (name != nullptr){
5354
WriteSpinLock lg(m_lock);
5455
m_path = *name;
56+
m_source_image_height = m_source_image_width = 0;
5557
}
5658
}
5759
JsonValue VideoSourceDescriptor_StillImage::to_json() const{
@@ -61,8 +63,12 @@ JsonValue VideoSourceDescriptor_StillImage::to_json() const{
6163

6264
std::unique_ptr<VideoSource> VideoSourceDescriptor_StillImage::make_VideoSource(Logger& logger, Resolution resolution) const{
6365
// cout << "make_VideoSource: " << m_path << endl;
64-
// Intentionally copy the path so we release the lock.
65-
return std::make_unique<VideoSource_StillImage>(path(), resolution);
66+
auto video_source = std::make_unique<VideoSource_StillImage>(path(), resolution);
67+
68+
ReadSpinLock lg(m_lock);
69+
m_source_image_width = video_source->original_image().width();
70+
m_source_image_height = video_source->original_image().height();
71+
return video_source;
6672
}
6773

6874

SerialPrograms/Source/CommonFramework/VideoPipeline/VideoSources/VideoSource_StillImage.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ class VideoSourceDescriptor_StillImage : public VideoSourceDescriptor{
2424
, m_path(std::move(path))
2525
{}
2626

27-
2827
public:
28+
// get the image source path
2929
std::string path() const;
30+
// set the image source path
3031
void set_path(std::string path);
32+
// Get the source image width. Its value is only loaded after `make_VideoSource()` is called.
33+
// Otherwise, return 0.
34+
size_t source_image_width() const{return m_source_image_width;}
35+
// Get the source image height. Its value is only loaded after `make_VideoSource()` is called.
36+
// Otherwise, return 0.
37+
size_t source_image_height() const{return m_source_image_height;}
3138

3239
virtual bool operator==(const VideoSourceDescriptor& x) const override;
3340
virtual std::string display_name() const override{
@@ -44,6 +51,8 @@ class VideoSourceDescriptor_StillImage : public VideoSourceDescriptor{
4451
private:
4552
mutable SpinLock m_lock;
4653
std::string m_path;
54+
mutable size_t m_source_image_width = 0;
55+
mutable size_t m_source_image_height = 0;
4756
};
4857

4958

@@ -69,7 +78,7 @@ class VideoSource_StillImage : public VideoSource{
6978

7079
virtual QWidget* make_display_QtWidget(QWidget* parent) override;
7180

72-
81+
const QImage& original_image() const { return m_original_image;}
7382
private:
7483
friend class VideoWidget_StillImage;
7584

SerialPrograms/Source/ML/DataLabeling/SegmentAnythingEmbedding.cpp

Lines changed: 0 additions & 39 deletions
This file was deleted.

SerialPrograms/Source/ML/DataLabeling/SegmentAnythingEmbedding.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)