diff --git a/relightlab/CMakeLists.txt b/relightlab/CMakeLists.txt index 4e7c296..49557ec 100644 --- a/relightlab/CMakeLists.txt +++ b/relightlab/CMakeLists.txt @@ -18,10 +18,15 @@ if (APPLE) set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version" FORCE) SET(CMAKE_INSTALL_RPATH $ORIGIN/../Frameworks) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +else() + set(OPENCV_RELIGHT_LIBS opencv_core opencv_imgcodecs opencv_imgproc opencv_video) +# add_compile_definitions(WITH_OPENCV) endif() + + set (RELIGHT_HEADERS processqueue.h ../src/align.h @@ -188,7 +193,7 @@ target_link_libraries( ${JPEG_LIBRARIES} TIFF::TIFF OpenMP::OpenMP_CXX - opencv_core opencv_imgcodecs opencv_imgproc opencv_video + ${OPENCV_RELIGHT_LIBS} ${RELIGHT_QT}::Core ${RELIGHT_QT}::Gui ${RELIGHT_QT}::Widgets diff --git a/relightlab/verifydialog.cpp b/relightlab/verifydialog.cpp index e451a4c..8795112 100644 --- a/relightlab/verifydialog.cpp +++ b/relightlab/verifydialog.cpp @@ -11,7 +11,9 @@ #include #include +#ifdef WITH_OPENCV #include +#endif #include "assert.h" #include @@ -28,10 +30,14 @@ VerifyDialog::VerifyDialog(std::vector &_thumbs, std::vector &_ layout->addLayout(operations_layout); QPushButton *reset = new QPushButton("Reset"); operations_layout->addWidget(reset); + connect(reset, SIGNAL(clicked()), this, SLOT(resetAligns())); + +#ifdef WITH_OPENCV QPushButton *ecc = new QPushButton("Align"); operations_layout->addWidget(ecc); - connect(reset, SIGNAL(clicked()), this, SLOT(resetAligns())); + connect(ecc, SIGNAL(clicked()), this, SLOT(alignSamples())); +#endif } QScrollArea *area = new QScrollArea(this); layout->addWidget(area); @@ -65,14 +71,16 @@ void VerifyDialog::resetAligns() { p = QPointF(0, 0); update(); } - +#ifdef WITH_OPENCV cv::Mat qimg2mat(QImage img) { QImage gray = img.convertToFormat(QImage::Format_Grayscale8); return cv::Mat(gray.height(), gray.width(), CV_8UC1, const_cast(gray.bits()), gray.bytesPerLine()).clone(); } +#endif void VerifyDialog::alignSamples() { + #ifdef WITH_OPENCV if (positions.empty()) return; cv::Mat ref = qimg2mat(thumbs[0]); @@ -90,6 +98,7 @@ void VerifyDialog::alignSamples() { } } update(); +#endif } void VerifyDialog::update() {