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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tlog
34 changes: 19 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ project(clandmark)

# The version number
set(clandmark_VERSION_MAJOR 1)
set(clandmark_VERSION_MINOR 5)
set(clandmark_VERSION_MINOR 6)
set(clandmark_VERSION ${clandmark_VERSION_MAJOR}.${clandmark_VERSION_MINOR})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")

#option(BUILD_SHARED_LIBS "Check whether to build libraries dynamically or statically. On for dynamic, Off for static build." ON)
mark_as_advanced(CMAKE_INSTALL_PREFIX)
set(BUILD_SHARED_LIBS "TRUE" CACHE BOOL "Global flag to cause add_library to create shared libraries if on.")
set(CMAKE_SKIP_BUILD_RPATH "FALSE" CACHE BOOL "Do not include RPATHs in the build tree.")

# set(BUILD_SHARED_LIBS "TRUE" CACHE BOOL "Global flag to cause add_library to create shared libraries if on.")
# set(CMAKE_SKIP_BUILD_RPATH "FALSE" CACHE BOOL "Do not include RPATHs in the build tree.")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE
)
endif(NOT CMAKE_BUILD_TYPE)

option(BUILD_SHARED_LIBS "Check whether to build libraries dynamically or statically. On for dynamic, Off for static build." OFF)
option(DOUBLE_PRECISION "Set the default precision used in CLandmark." ON)
option(BUILD_MATLAB_BINDINGS "Check whether to build MATLAB interface." OFF)
option(BUILD_PYTHON_BINDINGS "Check whether to build Python interface." OFF)
option(BUILD_CPP_EXAMPLES "Check whether to build CPP examples." ON)
option(BUILD_CPP_EXAMPLES "Check whether to build CPP examples." OFF)
option(USE_OPENMP "Enable/Disable OpenMP." OFF)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic")
Expand All @@ -34,15 +35,12 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic")
# for configured header files:
include_directories(${PROJECT_BINARY_DIR})

# build clandmark
# build clandmark & flandmark
add_subdirectory (libclandmark)

## build flandmark
#add_subdirectory (libflandmark)

# build examples
if(BUILD_CPP_EXAMPLES)
add_subdirectory(examples)
add_subdirectory(examples)
# copy important files needed to run examples (opencv haarcascade for facial detector, flandmark_model file, example images and videos)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/flandmark_model.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/flandmark_model.xml COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/face.jpg ${CMAKE_CURRENT_BINARY_DIR}/examples/face.jpg COPYONLY)
Expand All @@ -60,30 +58,36 @@ if(BUILD_PYTHON_BINDINGS)
endif(BUILD_PYTHON_BINDINGS)

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfigVersion.cmake"
VERSION ${clandmark_VERSION}
COMPATIBILITY AnyNewerVersion
)

export(EXPORT CLandmarkTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkTargets.cmake"
NAMESPACE CLandmark::
)

configure_file(cmake/Templates/CLandmarkConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfig.cmake"
COPYONLY
)

install(EXPORT CLandmarkTargets
FILE CLandmarkTargets.cmake
NAMESPACE CLandmark::
DESTINATION lib/cmake/clandmark
)

install(
FILES
cmake/Templates/CLandmarkConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/clandmark/CLandmarkConfigVersion.cmake"
DESTINATION lib/cmake/clandmark
COMPONENT Devel
COMPONENT
Devel
)


#install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/Findclandmark.cmake" DESTINATION ./ COMPONENT Devel)
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,24 @@ Otherwise, the internal version will be used and its files will be installed alo
In case you use clandmark in an academic work, please cite the following paper:

```tex
@InProceedings{
author = {U{\v{r}}i{\v{c}}{\'{a}}{\v{r}}, Michal and Franc, Vojt{\v{e}}ch and Thomas, Diego and Sugimoto, Akihiro and Hlav{\'{a}}{\v{c}}, V{\'{a}}clav},
title = {{Real-time Multi-view Facial Landmark Detector Learned by the Structured Output SVM}},
year = {2015},
booktitle = {BWILD '15: Biometrics in the Wild 2015 (IEEE FG 2015 Workshop)},
venue = {Ljubljana, Slovenia}
www = {http://luks.fe.uni-lj.si/bwild15},
@article{Uricar-IMAVIS-2016,
author = {U{\v{r}}i{\v{c}}{\'{a}}{\v{r}}, Michal and
Franc, Vojt{\v{e}}ch and Thomas, Diego and Sugimoto, Akihiro and Hlav{\'{a}}{\v{c}}, V{\'{a}}clav },
title = {Multi-view facial landmark detector learned by the Structured Output {SVM}},
journal = {Image and Vision Computing},
volume = {47},
pages = {45--59},
year = {2016},
month = {March},
note = {300-W, the First Automatic Facial Landmark Detection in-the-Wild Challenge},
issn = {0262-8856},
doi = {http://dx.doi.org/10.1016/j.imavis.2016.02.004},
url = {http://www.sciencedirect.com/science/article/pii/S0262885616300105},
publisher = {Elsevier},
address = {Amsterdam, Netherlands},
keywords = {Deformable Part Models, Structured output SVM, Facial landmarks detection },
}

```

Visit http://cmp.felk.cvut.cz/~uricamic/clandmark for further information.
28 changes: 28 additions & 0 deletions build_clandmark_libs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:: Builds and installs CLandmark libraries (both static and dynamic version)

call build_setup_variables.bat

set OLDDIR=%CD%

if NOT EXIST %BUILD_DIR% (
mkdir %BUILD_DIR%
)

cd %BUILD_DIR%

:: build static version of the libraries
cmake -G %CMAKE_GENERATOR% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DBUILD_CPP_EXAMPLES=OFF -DBUILD_MATLAB_BINDINGS=OFF -DBUILD_PYTHON_BINDINGS=OFF ..\
cmake --build . --target clandmark --config %CMAKE_CONFIGURATION%
cmake --build . --target flandmark --config %CMAKE_CONFIGURATION%

:: build dynamic version of the libraries
cmake -G %CMAKE_GENERATOR% -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DBUILD_CPP_EXAMPLES=OFF -DBUILD_MATLAB_BINDINGS=OFF -DBUILD_PYTHON_BINDINGS=OFF ..\
cmake --build . --target clandmark --config %CMAKE_CONFIGURATION%
cmake --build . --target flandmark --config %CMAKE_CONFIGURATION%

:: install
cmake --build . --target INSTALL --config %CMAKE_CONFIGURATION%

cd %OLDDIR%

pause
28 changes: 28 additions & 0 deletions build_examples.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:: Builds and installs C++ examples

call build_setup_variables.bat

set OLDDIR=%CD%

if NOT EXIST %BUILD_DIR% (
mkdir %BUILD_DIR%
)

cd %BUILD_DIR%

:: check if the library was compiled
IF NOT EXIST %INSTALL_PATH%\bin\clandmark.dll (
call %OLDDIR%\build_clandmark_libs.bat
)

:: build examples
cmake -G %CMAKE_GENERATOR% -DOPENCV_DIR=%OpenCV_DIR% -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DBUILD_CPP_EXAMPLES=ON -DBUILD_MATLAB_BINDINGS=OFF -DBUILD_PYTHON_BINDINGS=OFF ..\
cmake --build . --target static_input --config %CMAKE_CONFIGURATION%
cmake --build . --target video_input --config %CMAKE_CONFIGURATION%

:: install
cmake --build . --target INSTALL --config %CMAKE_CONFIGURATION%

cd %OLDDIR%

pause
28 changes: 28 additions & 0 deletions build_matlab_interface.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:: Builds and installs MATLAB interface

call build_setup_variables.bat

set OLDDIR=%CD%

if NOT EXIST %BUILD_DIR% (
mkdir %BUILD_DIR%
)

cd %BUILD_DIR%

:: check if the library was compiled
IF NOT EXIST %INSTALL_PATH%\lib\clandmark.lib (
call %OLDDIR%\build_clandmark_libs.bat
)

:: build MATLAB interface
cmake -G%CMAKE_GENERATOR% -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% -DBUILD_CPP_EXAMPLES=OFF -DBUILD_MATLAB_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF ..\
cmake --build . --target flandmark_interface --config %CMAKE_CONFIGURATION%
cmake --build . --target featuresPool_interface --config %CMAKE_CONFIGURATION%

:: install
cmake --build . --target INSTALL --config %CMAKE_CONFIGURATION%

cd %OLDDIR%

pause
39 changes: 39 additions & 0 deletions build_python_interface.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
:: Builds and installs Python interface

call build_setup_variables.bat

set OLDDIR=%CD%

if NOT EXIST %BUILD_DIR% (
mkdir %BUILD_DIR%
)

cd %BUILD_DIR%

:: check if the library was compiled
IF NOT EXIST %INSTALL_PATH%\bin\clandmark.dll (
call %OLDDIR%\build_clandmark_libs.bat
)

::python interface build
cmake -G %CMAKE_GENERATOR% \
-DPYTHON_LIBRARY=%PYTHON_LIBRARY% \
-DPYTHON_EXECUTABLE=%PYTHON_EXECUTABLE% \
-DPYTHON_INCLUDE_DIR=%PYTHON_INCLUDE_DIR% \
-DCYTHON_EXECUTABLE=%CYTHON_EXECUTABLE% \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=%INSTALL_PATH% \
-DBUILD_CPP_EXAMPLES=OFF \
-DBUILD_MATLAB_BINDINGS=OFF \
-DBUILD_PYTHON_BINDINGS=ON ..\

cmake --build . --target ReplicatePythonSourceTree %CMAKE_CONFIGURATION%
cmake --build . --target py_featurePool --config %CMAKE_CONFIGURATION%
cmake --build . --target py_flndmark --config %CMAKE_CONFIGURATION%

:: install
cmake --build . --target INSTALL --config %CMAKE_CONFIGURATION%

cd %OLDDIR%

pause
21 changes: 21 additions & 0 deletions build_setup_variables.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:: Change these variables to fit your settings

set BUILD_DIR=D:\GitHub\clandmark\build_win10
:: set CMAKE_GENERATOR="Visual Studio 14 2015 Win64"
set CMAKE_GENERATOR="Visual Studio 15 2017 Win64"
set CMAKE_CONFIGURATION=Release

set INSTALL_PATH=D:\GitHub\clandmark\build_win10\install

:: set OpenCV_DIR=D:\opencv\opencv-2.4.13\build\

:: set PYTHON_EXECUTABLE=D:\ProgramFiles\Anaconda2\python.exe
:: set PYTHON_INCLUDE_DIR=D:\ProgramFiles\Anaconda2\include
:: set PYTHON_LIBRARY=D:\ProgramFiles\Anaconda2\python27.dll
:: set PYTHON_LIBRARY=D:\ProgramFiles\Anaconda2\libs\python27.lib
:: set CYTHON_EXECUTABLE=D:\ProgramFiles\Anaconda2\Scripts\cython.exe
set CYTHON_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/Scripts/cython.exe"
set PYTHON_EXECUTABLE="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/python.exe"
set PYTHON_INCLUDE_DIR="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/include"
::set PYTHON_LIBRARY="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/python3.dll"
set PYTHON_LIBRARY="C:/Program Files (x86)/Microsoft Visual Studio/Shared/Anaconda3_64/pkgs/python-3.6.5-h0c2934d_0/libs/python36.lib"
74 changes: 74 additions & 0 deletions cmake/Modules/Findclandmark.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# - Try to find the clandmark landmark detector library
#
# =============================================================================
# Once done this will define:
#
# CLANDMARK_FOUND TRUE if found; FALSE otherwise
# CLANDMARK_INCLUDE_DIRS where to find flandmark_detector.h
# CLANDMARK_LIBRARIES the libraries to link against
#
# =============================================================================
# Variables used by this module:
#
# CLANDMARK_PREFER_STATIC If TRUE and available, link against the static
# flandmark library. Otherwise select the shared
# version
#
# =============================================================================
# To use this from another project:
#
# create a directory named cmake/Modules under the project root, copy this file
# (FindCLANDMARK.cmake) there, and in the top-level CMakeLists.txt include:
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
# "${CMAKE_SOURCE_DIR}/cmake/Modules/")
#
# =============================================================================

find_path(CLANDMARK_INCLUDE_DIR CLandmark.h HINTS ${CLANDMARK_INSTALL_DIR} ${CLANDMARK_INSTALL_DIR}/include )
find_path(FLANDMARK_INCLUDE_DIR Flandmark.h HINTS ${CLANDMARK_INSTALL_DIR} ${CLANDMARK_INSTALL_DIR}/include )

set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".dll" ".dylib")
find_library(CLANDMARK_LIBRARY_SHARED NAMES clandmark)
find_library(FLANDMARK_LIBRARY_SHARED NAMES flandmark)

#
if (UNIX)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
endif(UNIX)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib")
find_library(CLANDMARK_LIBRARY_STATIC NAMES clandmark)
find_library(FLANDMARK_LIBRARY_STATIC NAMES flandmark)


# set(CLANDMARK_LIBRARY ${CLANDMARK_LIBRARY_STATIC})
set(CLANDMARK_LIBRARY ${CLANDMARK_LIBRARY_SHARED})
# set(CLANDMARK_LIBRARY ${CLANDMARK_LIBRARY_STATIC} ${CLANDMARK_LIBRARY_SHARED})
set(CLANDMARK_LIBRARIES ${CLANDMARK_LIBRARY})
set(CLANDMARK_INCLUDE_DIRS ${CLANDMARK_INCLUDE_DIR})

set(FLANDMARK_LIBRARY ${FLANDMARK_LIBRARY_SHARED})
# set(FLANDMARK_LIBRARY ${FLANDMARK_LIBRARY_STATIC} ${FLANDMARK_LIBRARY_SHARED})
set(FLANDMARK_LIBRARIES ${FLANDMARK_LIBRARY})
set(FLANDMARK_INCLUDE_DIRS ${FLANDMARK_INCLUDE_DIR})

# Temporary DEBUG message
message(STATUS "CLANDMARK: ${CLANDMARK_INCLUDE_DIR}, ${CLANDMARK_LIBRARIES}")
message(STATUS "FLANDMARK: ${FLANDMARK_INCLUDE_DIR}, ${FLANDMARK_LIBRARIES}")

include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set CLANDMARK_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(
CLANDMARK
DEFAULT_MSG
CLANDMARK_LIBRARY CLANDMARK_INCLUDE_DIR
)

find_package_handle_standard_args(
FLANDMARK
DEFAULT_MSG
FLANDMARK_LIBRARY FLANDMARK_INCLUDE_DIR
)

mark_as_advanced(CLANDMARK_INCLUDE_DIR CLANDMARK_LIBRARY)
mark_as_advanced(FLANDMARK_INCLUDE_DIR FLANDMARK_LIBRARY)
Loading