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