Skip to content

Commit

Permalink
removed opencv from macos
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Feb 12, 2025
1 parent 52ff0d8 commit 822f7b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion relightlab/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions relightlab/verifydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include <QLabel>
#include <QDialogButtonBox>

#ifdef WITH_OPENCV
#include <opencv2/opencv.hpp>
#endif

#include "assert.h"
#include <iostream>
Expand All @@ -28,10 +30,14 @@ VerifyDialog::VerifyDialog(std::vector<QImage> &_thumbs, std::vector<QPointF> &_
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);
Expand Down Expand Up @@ -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<uchar*>(gray.bits()), gray.bytesPerLine()).clone();
}
#endif

void VerifyDialog::alignSamples() {
#ifdef WITH_OPENCV
if (positions.empty()) return;

cv::Mat ref = qimg2mat(thumbs[0]);
Expand All @@ -90,6 +98,7 @@ void VerifyDialog::alignSamples() {
}
}
update();
#endif
}

void VerifyDialog::update() {
Expand Down

0 comments on commit 822f7b8

Please sign in to comment.