Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
6d5f252b
Commit
6d5f252b
authored
Nov 08, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'python-bindings' into devel
parents
66a712dd
cb6dd354
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
2 deletions
+60
-2
.gitmodules
.gitmodules
+3
-0
3rdparty/pybind11
3rdparty/pybind11
+1
-0
CMakeLists.txt
CMakeLists.txt
+10
-1
initial_cache.cmake.template
initial_cache.cmake.template
+1
-0
utils/CMakeLists.txt
utils/CMakeLists.txt
+8
-1
utils/create-python-bindings.cpp
utils/create-python-bindings.cpp
+37
-0
No files found.
.gitmodules
0 → 100644
View file @
6d5f252b
[submodule "3rdparty/pybind11"]
path = 3rdparty/pybind11
url = https://github.com/pybind/pybind11.git
pybind11
@
29b5064e
Subproject commit 29b5064e9c80be7034fc9d6ac15dbb7ebe304fc5
CMakeLists.txt
View file @
6d5f252b
project
(
eos
)
cmake_minimum_required
(
VERSION 2.8.1
0
)
cmake_minimum_required
(
VERSION 2.8.1
2
)
set
(
eos_VERSION_MAJOR 0
)
set
(
eos_VERSION_MINOR 7
)
set
(
eos_VERSION_PATCH 1
)
...
...
@@ -60,6 +60,8 @@ option(BUILD_UTILS "Build utility applications." OFF)
message
(
STATUS
"BUILD_UTILS:
${
BUILD_UTILS
}
"
)
option
(
BUILD_DOCUMENTATION
"Build the library documentation."
OFF
)
message
(
STATUS
"BUILD_DOCUMENTATION:
${
BUILD_DOCUMENTATION
}
"
)
option
(
GENERATE_PYTHON_BINDINGS
"Build python bindings. Needs BUILD_UTILS enabled too."
OFF
)
message
(
STATUS
"GENERATE_PYTHON_BINDINGS:
${
GENERATE_PYTHON_BINDINGS
}
"
)
# Build a CPack driven installer package:
include
(
InstallRequiredSystemLibraries
)
# This module will include any runtime libraries that are needed by the project for the current platform
...
...
@@ -145,6 +147,13 @@ source_group(fitting\\detail include/eos/fitting/detail/*)
source_group
(
render include/eos/render/*
)
source_group
(
render\\detail include/eos/render/detail/*
)
# Generate python bindings using pybind11:
if
(
GENERATE_PYTHON_BINDINGS
)
set
(
PYBIND11_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/3rdparty/pybind11"
)
add_subdirectory
(
${
PYBIND11_PATH
}
)
# If this fails, the repo has probably not been cloned with submodules. Run: git submodule update --init
endif
()
# The install target:
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/include/ DESTINATION include
)
# our library headers
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/share/ DESTINATION share
)
# the model and metadata
...
...
initial_cache.cmake.template
View file @
6d5f252b
...
...
@@ -26,3 +26,4 @@ set(BUILD_EXAMPLES ON CACHE BOOL "Build the example applications." FORCE)
set(BUILD_CERES_EXAMPLE OFF CACHE BOOL "Build the fit-model-ceres example (requires Ceres)." FORCE)
set(BUILD_UTILS OFF CACHE BOOL "Build utility applications." FORCE)
set(BUILD_DOCUMENTATION OFF CACHE BOOL "Build the library documentation." FORCE)
set(GENERATE_PYTHON_BINDINGS OFF CACHE BOOL "Build python bindings. Needs BUILD_UTILS enabled too." FORCE)
utils/CMakeLists.txt
View file @
6d5f252b
project
(
utils
)
cmake_minimum_required
(
VERSION 2.8.1
0
)
cmake_minimum_required
(
VERSION 2.8.1
2
)
# The utils need a few additional dependencies (e.g. boost filesystem and OpenCV highgui):
...
...
@@ -41,6 +41,13 @@ target_link_libraries(scm-to-cereal ${OpenCV_LIBS} ${Boost_LIBRARIES})
# Store a json file as cereal .bin:
add_executable
(
json-to-cereal-binary json-to-cereal-binary.cpp
)
target_link_libraries
(
json-to-cereal-binary
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
# Generate python bindings using pybind11:
if
(
GENERATE_PYTHON_BINDINGS
)
pybind11_add_module
(
eos_py create-python-bindings.cpp
)
target_link_libraries
(
eos_py PRIVATE
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
install
(
TARGETS eos_py DESTINATION bin
)
endif
()
# install target:
install
(
TARGETS scm-to-cereal DESTINATION bin
)
install
(
TARGETS json-to-cereal-binary DESTINATION bin
)
utils/create-python-bindings.cpp
0 → 100644
View file @
6d5f252b
/*
* eos - A 3D Morphable Model fitting library written in modern C++11/14.
*
* File: utils/create-python-bindings.cpp
*
* Copyright 2016 Patrik Huber
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "eos/morphablemodel/PcaModel.hpp"
#include "pybind11/pybind11.h"
namespace
py
=
pybind11
;
/**
* Create python bindings for the eos library using pybind11.
*/
PYBIND11_PLUGIN
(
eos_py
)
{
py
::
module
m
(
"eos_py"
,
"Python bindings to the 3D Morphable Face Model fitting library"
);
py
::
class_
<
eos
::
morphablemodel
::
PcaModel
>
(
m
,
"PcaModel"
)
.
def
(
py
::
init
<>
())
.
def
(
"get_mean_at_point"
,
&
eos
::
morphablemodel
::
PcaModel
::
get_mean_at_point
);
return
m
.
ptr
();
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment