Skip to content
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
53 changes: 41 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,65 @@
cmake_minimum_required(VERSION 2.8)

PROJECT(gazetool)
PROJECT(gazetool_demo)

set(GAZETOOL_MAJOR_VERSION 0)
set(GAZETOOL_MINOR_VERSION 1)
set(GAZETOOL_PATCH_VERSION 0)
set(GAZETOOL_VERSION
${GAZETOOL_MAJOR_VERSION}.${GAZETOOL_MINOR_VERSION}.${GAZETOOL_PATCH_VERSION})

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

OPTION(ENABLE_YARP_SUPPORT "Enable yarp support" OFF)

add_subdirectory(src/lib)
add_subdirectory(data)

set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

FIND_PACKAGE(dlib REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(dlib REQUIRED)
FIND_PACKAGE(Boost COMPONENTS system chrono program_options REQUIRED)
FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5OpenGL REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
ADD_DEFINITIONS(-DENABLE_QT5)


IF(ENABLE_YARP_SUPPORT)
FIND_PACKAGE(YARP REQUIRED)
ENDIF()

INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${YARP_INCLUDE_DIRS} ${dlib_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(
${OpenCV_INCLUDE_DIRS}
${Boost_INCLUDE_DIR}
${YARP_INCLUDE_DIRS}
${dlib_INCLUDE_DIRS}
src/lib
src/ui)


QT5_WRAP_UI(UI_HEADERS src/ui/gazergui.ui)

SET(GAZETOOL_BIN
src/ui/main.cpp
src/ui/gazergui.cpp
src/ui/workerthread.cpp
src/ui/glimageview.cpp
${UI_HEADERS})

ADD_SUBDIRECTORY(src)
ADD_EXECUTABLE(gazetool_ui ${GAZETOOL_BIN})
ADD_DEPENDENCIES(gazetool_ui ${UI_HEADERS})
TARGET_LINK_LIBRARIES(gazetool_ui gazetool GL)
qt5_use_modules(gazetool_ui Core Widgets Gui OpenGL)

CONFIGURE_FILE(gazetool.sh.in gazetool.sh @ONLY)
CONFIGURE_FILE("src/ui/config/gazetool.sh.in" gazetool.sh @ONLY)

INSTALL(FILES
data/shape_predictor_68_face_landmarks.dat
data/gaze_est_deg.dat
data/lid_est.dat
data/vertgaze_est_deg.dat
DESTINATION share/gazetool)
INSTALL(TARGETS gazetool_ui
RUNTIME DESTINATION bin
)

INSTALL(PROGRAMS ${CMAKE_BINARY_DIR}/gazetool.sh DESTINATION bin)
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gazetool.sh DESTINATION bin)
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ This repository contains a calibration free gaze tracking system based on freely

Please cite the above paper when using this module for your research.

## Installation
## Out of the box demo installation

Make sure you have the following dependencies available / installed:
* QT5: http://www.qt.io/download/
* opencv 2.x.x: http://opencv.org/downloads.html
* opencv: http://opencv.org/downloads.html
* boost: http://www.boost.org/
* dlib: http://dlib.net/
* run `getFaceAlignmentModel.sh` in the `data` directory to download dlib's face alignment model which is required for running gazetool.
Expand All @@ -21,6 +21,28 @@ Compiling
## Running gazetool
* Run `gazetool.sh -c 0` to use the first webcam attached to your system

## Manual library installation (no QT is needed)

Make sure you have the following dependencies available / installed:
* opencv: http://opencv.org/downloads.html
* boost: http://www.boost.org/
* dlib: http://dlib.net/
* run `getFaceAlignmentModel.sh` in the `data` directory to download dlib's face alignment model which is required for running gazetool.

Compiling
* cmake is used, thus a standard cmake configure run is required in the data and the src/lib folder
* `cd data`
* `mkdir build && cd build && cmake ..`
* run `make`
* run `make install`
* `cd ../../src/lib`
* `mkdir build && cd build && cmake ..`
* run `make`
* run `make install`

This will install the library and all necessary configuration files to use it.
Furthermore a cmake module file is created in `${CMAKE_INSTALL_PREFIX}/lib/cmake/gazetool` which can be used to link against this library.

## Technical Notes

* Sync to vblank might negatively affect performance
Expand Down
19 changes: 19 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8)

PROJECT(gazetool_data)

OPTION(ENABLE_INSTALL_DLIB_FACE_MODEL "Install the dlib face landmarks model" ON)


INSTALL(FILES
gaze_est_deg.dat
lid_est.dat
vertgaze_est_deg.dat
DESTINATION share/gazetool)


IF(ENABLE_INSTALL_DLIB_FACE_MODEL)
INSTALL(FILES
shape_predictor_68_face_landmarks.dat
DESTINATION share/gazetool)
ENDIF()
3 changes: 0 additions & 3 deletions gazetool.sh.in

This file was deleted.

41 changes: 0 additions & 41 deletions src/CMakeLists.txt

This file was deleted.

84 changes: 84 additions & 0 deletions src/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
cmake_minimum_required(VERSION 2.8)

PROJECT(libgazetool)

set(GAZETOOL_LIB_MAJOR_VERSION 0)
set(GAZETOOL_LIB_MINOR_VERSION 1)
set(GAZETOOL_LIB_PATCH_VERSION 0)
set(GAZETOOL_LIB_VERSION
${GAZETOOL_LIB_MAJOR_VERSION}.${GAZETOOL_LIB_MINOR_VERSION}.${GAZETOOL_LIB_PATCH_VERSION})

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

OPTION(ENABLE_YARP_SUPPORT "Enable yarp support" OFF)

set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

FIND_PACKAGE(dlib REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(Boost COMPONENTS system chrono program_options REQUIRED)


IF(ENABLE_YARP_SUPPORT)
FIND_PACKAGE(YARP REQUIRED)
ENDIF()

INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${YARP_INCLUDE_DIRS} ${dlib_INCLUDE_DIRS})

SET(GAZETOOL_LIB_SRC
imageprovider.cpp
faceparts.cpp
pupilfinder.cpp
eyelidlearner.cpp
mutualgazelearner.cpp
relativeeyelidlearner.cpp
relativegazelearner.cpp
verticalgazelearner.cpp
facedetectionworker.cpp
shapedetectionworker.cpp
gazehyps.cpp
regressionworker.cpp
eyepatcher.cpp
featureextractor.cpp
abstractlearner.cpp
rlssmoother.cpp
blockingqueue.h
)

IF(ENABLE_YARP_SUPPORT)
ADD_DEFINITIONS(-DENABLE_YARP_SUPPORT)
SET(GAZETOOL_LIB_SRC ${GAZETOOL_LIB_SRC} yarpsupport.cpp)
ENDIF()


ADD_LIBRARY(gazetool SHARED ${GAZETOOL_LIB_SRC})
target_link_libraries(gazetool ${OpenCV_LIBS} ${dlib_LIBRARIES} ${Boost_LIBRARIES} ${YARP_LIBRARIES})


set(INSTALL_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/gazetool/")

configure_file("config/gazetoolConfig.cmake.in"
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gazetoolConfig.cmake" @ONLY)
configure_file("config/gazetoolConfigVersion.cmake.in"
"${PROJECT_BINARY_DIR}/gazetoolConfigVersion.cmake" @ONLY)

export(TARGETS gazetool
FILE "${PROJECT_BINARY_DIR}/gazetoolTargets.cmake")
export(PACKAGE gazetool)

INSTALL(TARGETS gazetool
LIBRARY DESTINATION lib
)

INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION "include/gazetool"
FILES_MATCHING
PATTERN "*.h")

install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/gazetoolConfig.cmake"
"${PROJECT_BINARY_DIR}/gazetoolConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/gazetoolTargets.cmake"
DESTINATION "lib/cmake/gazetool" COMPONENT dev)
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions src/lib/config/gazetoolConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# - Config file for the gazetool package
# It defines the following variables
# GAZETOOL_INCLUDE_DIRS - include directories for FooBar
# GAZETOOL_LIBRARIES - libraries to link against

# Compute paths
get_filename_component(gazetool_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)

set(gazetool_INCLUDE_DIRS "@INSTALL_INCLUDE_DIRS@")

# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET gazetool)
include("${gazetool_CMAKE_DIR}/gazetoolTargets.cmake")
endif()

set(gazetool_LIBRARIES gazetool)
11 changes: 11 additions & 0 deletions src/lib/config/gazetoolConfigVersion.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@gazetool_VERSION@")

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion src/gazehyps.h → src/lib/gazehyps.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
#include <chrono>
#include <dlib/image_processing.h>
#include <dlib/opencv.h>
#include <qt5/QtCore/QMetaType>
#include <boost/optional.hpp>

#include "pupilfinder.h"

class GazeHypList;
typedef std::shared_ptr<GazeHypList> GazeHypsPtr;
#ifdef ENABLE_QT5
#include <qt5/QtCore/QMetaType>
Q_DECLARE_METATYPE(GazeHypsPtr)
#endif


struct GazeHyp {
dlib::rectangle faceDetection;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 49 additions & 0 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 2.8)

PROJECT(gazetool_ui)

set(GAZETOOL_MAJOR_VERSION 0)
set(GAZETOOL_MINOR_VERSION 1)
set(GAZETOOL_PATCH_VERSION 0)
set(GAZETOOL_VERSION
${GAZETOOL_MAJOR_VERSION}.${GAZETOOL_MINOR_VERSION}.${GAZETOOL_PATCH_VERSION})

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

OPTION(ENABLE_YARP_SUPPORT "Enable yarp support" OFF)

set(CMAKE_AUTOMOC TRUE)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(gazetool REQUIRED)
FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5OpenGL REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
ADD_DEFINITIONS(-DENABLE_QT5)

INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS} ${gazetool_INCLUDE_DIRS})

QT5_WRAP_UI(UI_HEADERS gazergui.ui)

SET(GAZETOOL_BIN
main.cpp
gazergui.cpp
workerthread.cpp
glimageview.cpp
${UI_HEADERS})

ADD_EXECUTABLE(gazetool_ui ${GAZETOOL_BIN})
ADD_DEPENDENCIES(gazetool_ui ${UI_HEADERS})
TARGET_LINK_LIBRARIES(gazetool_ui ${gazetool_LIBRARIES} GL)
qt5_use_modules(gazetool_ui Core Widgets Gui OpenGL)

CONFIGURE_FILE("config/gazetool.sh.in" gazetool.sh @ONLY)

INSTALL(TARGETS gazetool_ui
RUNTIME DESTINATION bin
)

INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gazetool.sh DESTINATION bin)
3 changes: 3 additions & 0 deletions src/ui/config/gazetool.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
prefix="@CMAKE_INSTALL_PREFIX@"
exec "$prefix/bin/gazetool_ui" -m "$prefix/share/gazetool/shape_predictor_68_face_landmarks.dat" --estimate-gaze "$prefix/share/gazetool/gaze_est_deg.dat" --estimate-verticalgaze "$prefix/share/gazetool/vertgaze_est_deg.dat" --estimate-lid "$prefix/share/gazetool/lid_est.dat" "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.