Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile with Qt5 and OpenCV 3.x #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*-cmake-*-
PROJECT(CSIRO-FaceAnalysis-SDK)

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.1.0)

#set(CMAKE_VERBOSE_MAKEFILE true)

Expand All @@ -13,11 +13,17 @@ endif()
# Configurable options
OPTION(WITH_GUI "Build the GUI" OFF)

# Third party libraries
find_package(OpenCV REQUIRED core highgui imgproc objdetect
PATHS ${OpenCV_PREFIX}/lib/cmake/
${OpenCV_PREFIX}/share/OpenCV/
NO_DEFAULT_PATH) # For some reason CMake uses its defaults before the above paths.
# # Third party libraries
# find_package(OpenCV REQUIRED core highgui imgproc objdetect
# PATHS ${OpenCV_PREFIX}/lib/cmake/
# ${OpenCV_PREFIX}/share/OpenCV/
# NO_DEFAULT_PATH) # For some reason CMake uses its defaults before the above paths.

# opencv
set(OpenCV_DIR "" CACHE PATH "OpenCV root directory")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# message("OpenCV_INCLUDE_DIRS = ${OpenCV_INCLUDE_DIRS}")

IF(APPLE)
find_library(FOUNDATION Foundation)
Expand Down
2 changes: 1 addition & 1 deletion src/display-tracking/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "utils/command-line-arguments.hpp"
#include "utils/points.hpp"
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>

void
print_usage()
Expand Down
2 changes: 1 addition & 1 deletion src/expression-transfer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ run_program(int argc, char **argv)

if (image_exists_p && landmarks_exists_p) {
cv::Mat image_unknown = cv::imread(image_it->c_str());
if (image_unknown.type() != cv::DataType<cv::Vec<uint8_t,3> >::type)
if (image_unknown.type() != CV_8UC3)
throw make_runtime_error("This program only knows draw on 3 channel colour images. The file '%s' just doesn't satisfy this requirement. Sorry.", image_it->c_str());

cv::Mat_<cv::Vec<uint8_t,3> > image = image_unknown;
Expand Down
6 changes: 3 additions & 3 deletions src/face-fit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ run_video_mode(const Configuration &cfg,
}

cv::Mat_<uint8_t> gray_image;
if (image.type() == cv::DataType<cv::Vec<uint8_t,3> >::type)
if (image.type() == CV_8UC3)
cv::cvtColor(image, gray_image, CV_BGR2GRAY);
else if (image.type() == cv::DataType<uint8_t>::type)
gray_image = image;
Expand Down Expand Up @@ -414,13 +414,13 @@ display_data(const Configuration &cfg,
cv::Scalar colour;
if (image.type() == cv::DataType<uint8_t>::type)
colour = cv::Scalar(255);
else if (image.type() == cv::DataType<cv::Vec<uint8_t,3> >::type)
else if (image.type() == CV_8UC3)
colour = cv::Scalar(0,0,255);
else
colour = cv::Scalar(255);

cv::Mat displayed_image;
if (image.type() == cv::DataType<cv::Vec<uint8_t,3> >::type)
if (image.type() == CV_8UC3)
displayed_image = image.clone();
else if (image.type() == cv::DataType<uint8_t>::type)
cv::cvtColor(image, displayed_image, CV_GRAY2BGR);
Expand Down
109 changes: 81 additions & 28 deletions src/qt-gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,86 @@
# -*-cmake-*-
find_package(Qt4 REQUIRED)
# find_package(Qt4 REQUIRED)

INCLUDE( ${QT_USE_FILE} )
# INCLUDE( ${QT_USE_FILE} )

# qt
set(QTDIR "" CACHE PATH "Qt5 directory")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QTDIR})
find_package(Qt5Widgets CONFIG REQUIRED)
include_directories(${Qt5Widgets_INCLUDE_DIRS})

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# opencv
set(OpenCV_DIR "" CACHE PATH "OpenCV root directory")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# message("OpenCV_INCLUDE_DIRS = ${OpenCV_INCLUDE_DIRS}")

#set(CMAKE_VERBOSE_MAKEFILE true)

SET(BundleName "qt-gui")

SET(guiFILES "application-states.cpp"
"controllers.cpp"
"configuration.cpp"
"gui/avatar-selection.cpp"
"gui/main-window.cpp"
"gui/avatar.cpp"
"gui/mesh-drawer.cpp"
"gui/graphics-scrollbar.cpp"
"gui/windowed-gui-controller.cpp"
"gui/item-controllers.cpp"
"gui/worker-thread.cpp"
"gui/item-positions-calculator.cpp"
SET(guiFILES
# "application-states.cpp"
# "controllers.cpp"
# "configuration.cpp"
# "gui/avatar-selection.cpp"
# "gui/main-window.cpp"
# "gui/avatar.cpp"
# "gui/mesh-drawer.cpp"
# "gui/graphics-scrollbar.cpp"
# "gui/windowed-gui-controller.cpp"
# "gui/item-controllers.cpp"
# "gui/worker-thread.cpp"
# "gui/item-positions-calculator.cpp"

application-states.cpp
controllers.cpp
configuration.cpp
gui/main-window.cpp
gui/windowed-gui-controller.cpp
gui/item-controllers.cpp
gui/item-positions-calculator.cpp
gui/graphics-scrollbar.cpp
gui/avatar-selection.cpp
gui/avatar.cpp
gui/worker-thread.cpp
gui/mesh-drawer.cpp

../tracker/IO.cpp
../tracker/CLM.cpp
../tracker/FDet.cpp
../tracker/Patch.cpp
../tracker/ShapeModel.cpp
# ../tracker/PRA.cpp
# ../tracker/FacePredictor.cpp
../tracker/ShapePredictor.cpp
../tracker/ATM.cpp
../tracker/Warp.cpp
../tracker/FCheck.cpp
../tracker/FaceTracker.cpp
../tracker/myFaceTracker.cpp
../tracker/RegistrationCheck.cpp
../avatar/Avatar.cpp
../avatar/myAvatar.cpp
)

SET(MOC_HEADERS
"controllers.hpp"
"gui/avatar-selection.hpp"
"gui/main-window.hpp"
"gui/avatar.hpp"
# "gui/mesh-drawer.hpp"
"gui/graphics-scrollbar.hpp"
"gui/windowed-gui-controller.hpp"
"gui/item-controllers.hpp"
"gui/worker-thread.hpp")
# "gui/item-positions-calculator.hpp")
# SET(MOC_HEADERS
# "controllers.hpp"
# "gui/avatar-selection.hpp"
# "gui/main-window.hpp"
# "gui/avatar.hpp"
# # "gui/mesh-drawer.hpp"
# "gui/graphics-scrollbar.hpp"
# "gui/windowed-gui-controller.hpp"
# "gui/item-controllers.hpp"
# "gui/worker-thread.hpp")
# # "gui/item-positions-calculator.hpp")

QT4_WRAP_CPP(MOC_SRCS ${MOC_HEADERS})
# QT4_WRAP_CPP(MOC_SRCS ${MOC_HEADERS})

INCLUDE_DIRECTORIES(".")
set_source_files_properties(osx-configuration.mm PROPERTIES COMPILE_FLAGS -ObjC++)
Expand All @@ -45,7 +92,10 @@ add_executable(demo-application
${guiFILES}
${MOC_SRCS}
${EXTRA_SRC})
target_link_libraries(demo-application ${LIBS} ${QT_LIBRARIES} clmTracker avatarAnim utilities ${EXTRA_LIBS})
target_link_libraries(demo-application ${LIBS}
# ${QT_LIBRARIES}
Qt5::Widgets
clmTracker avatarAnim utilities ${EXTRA_LIBS})

# Apple Specific Targets

Expand All @@ -65,7 +115,10 @@ ADD_EXECUTABLE(${BundleName} MACOSX_BUNDLE
${MOC_SRCS}
${EXTRA_SRC}
)
TARGET_LINK_LIBRARIES(${BundleName} ${LIBS} ${QT_LIBRARIES} clmTracker avatarAnim ${EXTRA_LIBS})
TARGET_LINK_LIBRARIES(${BundleName} ${LIBS}
# ${QT_LIBRARIES}
Qt5::Widgets
clmTracker avatarAnim ${EXTRA_LIBS})


# IF(APPLE)
Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/controllers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#define _CI2CV_GUI_GUI_CONTROLLER_HPP_

#include <QtCore/QObject>
#include <QtGui/QImage>
#include <QImage>
#include <opencv2/core/core.hpp>

namespace CI2CVGui
Expand Down
4 changes: 2 additions & 2 deletions src/qt-gui/gui/avatar-selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "gui/avatar-selection.hpp"
#include "controllers.hpp"

#include <QtCore/QDebug>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QGraphicsSceneMouseEvent>

using namespace CI2CVGui;

Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/avatar-selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <QtCore/QObject>
#include <QtCore/QRectF>
#include <QtGui/QGraphicsItemGroup>
#include <QGraphicsItemGroup>
#include <QtCore/QScopedArrayPointer>

#include "gui/graphics-scrollbar.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "gui/avatar.hpp"

#include <stdexcept>
#include <QtCore/QDebug>
#include <QDebug>
#include "gui/worker-thread.hpp"
#include "configuration.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/qt-gui/gui/graphics-scrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

#include "gui/graphics-scrollbar.hpp"
#include <QtGui/QPainterPath>
#include <QtCore/QDebug>
#include <QtGui/QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QGraphicsSceneMouseEvent>

using namespace CI2CVGui;

Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/graphics-scrollbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <QtCore/QObject>
#include <QtCore/QRectF>
#include <QtGui/QGraphicsItemGroup>
#include <QGraphicsItemGroup>
#include <QtGui/QBrush>
#include <QtGui/QPen>

Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/item-controllers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "gui/item-controllers.hpp"
#include <QtCore/QPropertyAnimation>
#include <QtCore/QDebug>
#include <QDebug>
#include "gui/avatar-selection.hpp"
#include "gui/mesh-drawer.hpp"
#include "controllers.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/qt-gui/gui/item-controllers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define _CI2CV_GUI_GUI_ITEM_POSITIONERS_HPP_

#include <QtCore/QObject>
#include <QtGui/QGraphicsRectItem>
#include <QtGui/QGraphicsPixmapItem>
#include <QGraphicsRectItem>
#include <QGraphicsPixmapItem>

#include <opencv2/core/core.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/item-positions-calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "gui/item-positions-calculator.hpp"
#include "gui/windowed-gui-controller.hpp"

#include <QtCore/QDebug>
#include <QDebug>

using namespace CI2CVGui;

Expand Down
10 changes: 5 additions & 5 deletions src/qt-gui/gui/main-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
#include "gui/mesh-drawer.hpp"
#include "configuration.hpp"

#include <QtGui/QStyle>
#include <QStyle>
#include <QtGui/QFont>
#include <QtGui/QVBoxLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QApplication>
#include <QtCore/QDebug>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QApplication>
#include <QDebug>

using namespace CI2CVGui;

Expand Down
14 changes: 7 additions & 7 deletions src/qt-gui/gui/main-window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
#ifndef _CI2CV_GUI_GUI_MAIN_WINDOW_HPP_
#define _CI2CV_GUI_GUI_MAIN_WINDOW_HPP_

#include <QtGui/QMainWindow>
#include <QtGui/QGraphicsView>
#include <QtGui/QGraphicsScene>
#include <QtGui/QPushButton>
#include <QtGui/QCheckBox>
#include <QtGui/QLabel>
#include <QtGui/QProgressBar>
#include <QMainWindow>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QPushButton>
#include <QCheckBox>
#include <QLabel>
#include <QProgressBar>

#include "gui/item-controllers.hpp"

Expand Down
4 changes: 2 additions & 2 deletions src/qt-gui/gui/mesh-drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "gui/mesh-drawer.hpp"
#include "controllers.hpp"

#include <QtGui/QGraphicsLineItem>
#include <QtGui/QGraphicsEllipseItem>
#include <QGraphicsLineItem>
#include <QGraphicsEllipseItem>

using namespace CI2CVGui;

Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/mesh-drawer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifndef _CI2CV_GUI_GUI_MESH_DRAWER_HPP_
#define _CI2CV_GUI_GUI_MESH_DRAWER_HPP_

#include <QtGui/QGraphicsItemGroup>
#include <QGraphicsItemGroup>
#include <QtGui/QColor>
#include <QtGui/QBrush>
#include <QtGui/QPen>
Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/windowed-gui-controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "gui/windowed-gui-controller.hpp"

#include <QtCore/QDebug>
#include <QDebug>
#include <stdexcept>
#include "gui/worker-thread.hpp"
#include "configuration.hpp"
Expand Down
10 changes: 5 additions & 5 deletions src/qt-gui/gui/windowed-gui-controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#ifndef _CI2CV_GUI_GUI_WINDOWED_GUI_CONTROLLER_HPP_
#define _CI2CV_GUI_GUI_WINDOWED_GUI_CONTROLLER_HPP_

#include <QtGui/QWidget>
#include <QtGui/QAbstractButton>
#include <QtCore/QTimer>
#include <QtGui/QLabel>
#include <QtGui/QProgressBar>
#include <QWidget>
#include <QAbstractButton>
#include <QTimer>
#include <QLabel>
#include <QProgressBar>

#include "controllers.hpp"
#include "gui/item-controllers.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/qt-gui/gui/worker-thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "gui/worker-thread.hpp"

#include <opencv/highgui.h>
#include <QtCore/QDebug>
#include <QDebug>
#include <stdexcept>
#include <numeric>

Expand Down
Loading