Commit 62a71314d8d9553f063c134cd6a2e513bef6c71c

Authored by Josh Klontz
1 parent 771021df

msvc fixes

CMakeLists.txt
@@ -95,7 +95,7 @@ set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${QT_LIBRARIES}) @@ -95,7 +95,7 @@ set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${QT_LIBRARIES})
95 # Find OpenCV 95 # Find OpenCV
96 find_package(OpenCV REQUIRED) 96 find_package(OpenCV REQUIRED)
97 set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${OpenCV_LIBS}) 97 set(BR_THIRDPARTY_LIBS ${BR_THIRDPARTY_LIBS} ${OpenCV_LIBS})
98 -set(OPENCV_DEPENDENCIES calib3d contrib core features2d flann gpu highgui imgproc legacy ml nonfree objdetect photo stitching ts video videostab) 98 +set(OPENCV_DEPENDENCIES calib3d contrib core features2d flann gpu highgui imgproc legacy ml nonfree objdetect photo stitching video videostab)
99 99
100 # Enable Testing 100 # Enable Testing
101 include(CppcheckTargets) 101 include(CppcheckTargets)
app/openbr-gui/imageviewer.cpp
@@ -15,6 +15,7 @@ @@ -15,6 +15,7 @@
15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 16
17 #include <QFileDialog> 17 #include <QFileDialog>
  18 +#include <QMutexLocker>
18 #include <QSizePolicy> 19 #include <QSizePolicy>
19 #include <QTimer> 20 #include <QTimer>
20 21
@@ -28,22 +29,20 @@ br::ImageViewer::ImageViewer(QWidget *parent) @@ -28,22 +29,20 @@ br::ImageViewer::ImageViewer(QWidget *parent)
28 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); 29 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
29 } 30 }
30 31
31 -void br::ImageViewer::setDefaultText(const QString &text, bool async) 32 +void br::ImageViewer::setDefaultText(const QString &text)
32 { 33 {
33 defaultText = text; 34 defaultText = text;
34 - updatePixmap(async);  
35 } 35 }
36 36
37 void br::ImageViewer::setImage(const QString &file, bool async) 37 void br::ImageViewer::setImage(const QString &file, bool async)
38 { 38 {
39 src = QImage(file); 39 src = QImage(file);
40 updatePixmap(async); 40 updatePixmap(async);
41 -  
42 } 41 }
43 42
44 void br::ImageViewer::setImage(const QImage &image, bool async) 43 void br::ImageViewer::setImage(const QImage &image, bool async)
45 { 44 {
46 - src = image; 45 + src = image.copy();
47 updatePixmap(async); 46 updatePixmap(async);
48 } 47 }
49 48
@@ -61,10 +60,12 @@ void br::ImageViewer::updatePixmap(bool async) @@ -61,10 +60,12 @@ void br::ImageViewer::updatePixmap(bool async)
61 return; 60 return;
62 } 61 }
63 62
64 - if (src.isNull()) { 63 + QMutexLocker locker(&mutex);
  64 + if (src.isNull() || size().isNull()) {
65 QLabel::setPixmap(QPixmap()); 65 QLabel::setPixmap(QPixmap());
66 - setText(defaultText); 66 + QLabel::setText(defaultText);
67 } else { 67 } else {
  68 + QLabel::clear();
68 QLabel::setPixmap(QPixmap::fromImage(src.scaled(size(), Qt::KeepAspectRatio))); 69 QLabel::setPixmap(QPixmap::fromImage(src.scaled(size(), Qt::KeepAspectRatio)));
69 } 70 }
70 } 71 }
app/openbr-gui/imageviewer.h
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 #include <QKeyEvent> 21 #include <QKeyEvent>
22 #include <QLabel> 22 #include <QLabel>
23 #include <QMouseEvent> 23 #include <QMouseEvent>
  24 +#include <QMutex>
24 #include <QPixmap> 25 #include <QPixmap>
25 #include <QResizeEvent> 26 #include <QResizeEvent>
26 #include <QString> 27 #include <QString>
@@ -33,12 +34,13 @@ namespace br @@ -33,12 +34,13 @@ namespace br
33 class BR_EXPORT_GUI ImageViewer : public QLabel 34 class BR_EXPORT_GUI ImageViewer : public QLabel
34 { 35 {
35 Q_OBJECT 36 Q_OBJECT
  37 + QMutex mutex;
36 QString defaultText; 38 QString defaultText;
37 QImage src; 39 QImage src;
38 40
39 public: 41 public:
40 explicit ImageViewer(QWidget *parent = 0); 42 explicit ImageViewer(QWidget *parent = 0);
41 - void setDefaultText(const QString &text, bool async = false); 43 + void setDefaultText(const QString &text);
42 void setImage(const QString &file, bool async = false); 44 void setImage(const QString &file, bool async = false);
43 void setImage(const QImage &image, bool async = false); 45 void setImage(const QImage &image, bool async = false);
44 void setImage(const QPixmap &pixmap, bool async = false); 46 void setImage(const QPixmap &pixmap, bool async = false);
sdk/core/core.cpp
@@ -107,11 +107,13 @@ struct AlgorithmCore @@ -107,11 +107,13 @@ struct AlgorithmCore
107 107
108 FileList enroll(File input, File gallery = File()) 108 FileList enroll(File input, File gallery = File())
109 { 109 {
  110 + FileList fileList;
  111 + try {
110 if (gallery.isNull()) gallery = getMemoryGallery(input); 112 if (gallery.isNull()) gallery = getMemoryGallery(input);
111 113
112 QScopedPointer<Gallery> g(Gallery::make(gallery)); 114 QScopedPointer<Gallery> g(Gallery::make(gallery));
113 if (g.isNull()) return FileList(); 115 if (g.isNull()) return FileList();
114 - FileList fileList = g->files(); 116 + fileList = g->files();
115 if (!fileList.isEmpty() && gallery.contains("cache")) 117 if (!fileList.isEmpty() && gallery.contains("cache"))
116 return fileList; // Already enrolled 118 return fileList; // Already enrolled
117 119
@@ -165,7 +167,9 @@ struct AlgorithmCore @@ -165,7 +167,9 @@ struct AlgorithmCore
165 fprintf(stderr, "\rSPEED=%.1e SIZE=%.4g FAILURES=%d/%d \n", 167 fprintf(stderr, "\rSPEED=%.1e SIZE=%.4g FAILURES=%d/%d \n",
166 speed, totalBytes/totalCount, failureCount, totalCount); 168 speed, totalBytes/totalCount, failureCount, totalCount);
167 Globals->totalSteps = 0; 169 Globals->totalSteps = 0;
168 - 170 + } catch (...) {
  171 + qFatal("Exception triggered during enrollment!");
  172 + }
169 return fileList; 173 return fileList;
170 } 174 }
171 175
@@ -183,6 +187,7 @@ struct AlgorithmCore @@ -183,6 +187,7 @@ struct AlgorithmCore
183 187
184 void compare(File targetGallery, File queryGallery, File output) 188 void compare(File targetGallery, File queryGallery, File output)
185 { 189 {
  190 + try {
186 if (output.exists() && output.getBool("cache")) return; 191 if (output.exists() && output.getBool("cache")) return;
187 if (queryGallery == ".") queryGallery = targetGallery; 192 if (queryGallery == ".") queryGallery = targetGallery;
188 193
@@ -221,6 +226,9 @@ struct AlgorithmCore @@ -221,6 +226,9 @@ struct AlgorithmCore
221 const float speed = 1000 * Globals->totalSteps / Globals->startTime.elapsed() / std::max(1, abs(Globals->parallelism)); 226 const float speed = 1000 * Globals->totalSteps / Globals->startTime.elapsed() / std::max(1, abs(Globals->parallelism));
222 if (!Globals->quiet && (Globals->totalSteps > 1)) fprintf(stderr, "\rSPEED=%.1e \n", speed); 227 if (!Globals->quiet && (Globals->totalSteps > 1)) fprintf(stderr, "\rSPEED=%.1e \n", speed);
223 Globals->totalSteps = 0; 228 Globals->totalSteps = 0;
  229 + } catch (...) {
  230 + qFatal("Exception triggered during comparison!");
  231 + }
224 } 232 }
225 233
226 private: 234 private:
sdk/plugins/gallery.cpp
@@ -62,6 +62,7 @@ class galGallery : public Gallery @@ -62,6 +62,7 @@ class galGallery : public Gallery
62 while ((templates.size() < Globals->blockSize) && !stream.atEnd()) { 62 while ((templates.size() < Globals->blockSize) && !stream.atEnd()) {
63 Template m; 63 Template m;
64 stream >> m; 64 stream >> m;
  65 + //qWarning("?? %s\n", qPrintable(m.file.name));
65 templates.append(m); 66 templates.append(m);
66 } 67 }
67 68
@@ -71,6 +72,7 @@ class galGallery : public Gallery @@ -71,6 +72,7 @@ class galGallery : public Gallery
71 72
72 void write(const Template &t) 73 void write(const Template &t)
73 { 74 {
  75 + //qWarning("$$ %s\n", qPrintable(t.file.name));
74 stream << t; 76 stream << t;
75 } 77 }
76 }; 78 };
share/openbr/cmake/InstallDependencies.cmake
@@ -71,7 +71,7 @@ function(install_compiler_libraries) @@ -71,7 +71,7 @@ function(install_compiler_libraries)
71 set(MINGW_DIR "MINGW_DIR-NOTFOUND" CACHE PATH "MinGW Path") 71 set(MINGW_DIR "MINGW_DIR-NOTFOUND" CACHE PATH "MinGW Path")
72 get_filename_component(MINGW_DIR ${CMAKE_CXX_COMPILER} PATH) 72 get_filename_component(MINGW_DIR ${CMAKE_CXX_COMPILER} PATH)
73 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") 73 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
74 - install(FILES ${MINGW_DIR}/libgcc_s_sjlj-1.dll DESTINATION bin) 74 + install(FILES ${MINGW_DIR}/libgcc_s_sjlj-1.dll ${MINGW_DIR}/libstdc++-6.dll DESTINATION bin)
75 else() 75 else()
76 install(FILES ${MINGW_DIR}/libgcc_s_dw2-1.dll ${MINGW_DIR}/libstdc++-6.dll DESTINATION bin) 76 install(FILES ${MINGW_DIR}/libgcc_s_dw2-1.dll ${MINGW_DIR}/libstdc++-6.dll DESTINATION bin)
77 endif() 77 endif()
1 -Subproject commit 5bfe0988716f6e7b926910d74f9696f002cdbfb6 1 +Subproject commit b560a337e5b47770234d4ab554c563b5043e3595