Skip to content

Commit c0554d2

Browse files
committed
2 parents 50a9a9a + 020f9ad commit c0554d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+10637
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
cuboid_detection/bags/*
2+
openface2_ros/rosbags/*
23

34
.vscode/
45

openface2_ros/CMakeLists.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(openface2_ros)
3+
4+
find_package(catkin REQUIRED COMPONENTS
5+
message_generation
6+
message_runtime
7+
image_transport
8+
cv_bridge
9+
std_msgs
10+
geometry_msgs
11+
sensor_msgs
12+
roscpp
13+
tf2
14+
tf2_ros
15+
)
16+
17+
find_package(Boost 1.5.9 REQUIRED COMPONENTS filesystem system)
18+
find_package(OpenCV 3 REQUIRED)
19+
20+
find_library(OPENFACE_LD_LIB LandmarkDetector)
21+
find_library(OPENFACE_FA_LIB FaceAnalyser)
22+
find_library(OPENFACE_GA_LIB GazeAnalyser)
23+
find_library(OPENFACE_UT_LIB Utilities)
24+
25+
set(OPENFACE_LIBS ${OPENFACE_LD_LIB} ${OPENFACE_FA_LIB} ${OPENFACE_GA_LIB} ${OPENFACE_UT_LIB})
26+
27+
find_path(OPENFACE_INCLUDE_DIR LandmarkDetectorModel.h PATH_SUFFIXES OpenFace)
28+
29+
add_message_files(
30+
FILES
31+
ActionUnit.msg
32+
Face.msg
33+
Faces.msg
34+
)
35+
generate_messages(DEPENDENCIES std_msgs geometry_msgs)
36+
37+
add_definitions(-std=c++11)
38+
add_definitions(-g -pg)
39+
40+
include_directories(
41+
include
42+
${catkin_INCLUDE_DIRS}
43+
${OPENFACE_INCLUDE_DIR}
44+
${OpenBLAS_INCLUDE_DIR}
45+
${Boost_INCLUDE_DIRS}
46+
${Boost_INCLUDE_DIRS}/boost
47+
${OpenCV_INCLUDE_DIRS}
48+
)
49+
add_executable(openface2_ros src/openface2_ros.cpp)
50+
add_dependencies(openface2_ros ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
51+
add_dependencies(openface2_ros openface2_ros_generate_messages_cpp)
52+
53+
add_executable(openface2_ros_single src/openface2_ros_single.cpp)
54+
add_dependencies(openface2_ros_single ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
55+
add_dependencies(openface2_ros_single openface2_ros_generate_messages_cpp)
56+
57+
target_link_libraries(openface2_ros
58+
${catkin_LIBRARIES}
59+
${OPENFACE_LIBS}
60+
openblas
61+
dlib
62+
${Boost_LIBRARIES}
63+
${OpenCV_LIBRARIES}
64+
)
65+
66+
install(TARGETS openface2_ros
67+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
68+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
69+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
70+
)
71+
72+
target_link_libraries(openface2_ros_single
73+
${catkin_LIBRARIES}
74+
${OPENFACE_LIBS}
75+
openblas
76+
dlib
77+
${Boost_LIBRARIES}
78+
${OpenCV_LIBRARIES}
79+
)
80+
81+
install(TARGETS openface2_ros_single
82+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
83+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
84+
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
85+
)

openface2_ros/LICENSE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright (c) 2016, Braden McDorman.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
8+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9+
10+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11+
12+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

openface2_ros/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# ROS Wrapper for Openface 2.1.0
2+
3+
This is a ROS wrapper for OpenFace 2.1.0. In particular, given an image of a face, it will output:
4+
* Eye Gaze Vectors
5+
* Head Pose
6+
* 2D Landmarks
7+
* 3D Landmarks
8+
* Action Units
9+
* Debug Visualization (optional)
10+
11+
## ROS Parameters
12+
13+
### Required
14+
* `~image_topic` - The topic the image is provided on (e.g. `/usb_cam/image_raw`).
15+
16+
### Optional
17+
* `~publish_viz` - Set to `true` to publish a debug visualization (default: `false`).
18+
19+
## Installation
20+
21+
* Clone the OpenFace project release 2.1.0 : `git clone https://github.com/TadasBaltrusaitis/OpenFace/tree/OpenFace_2.1.0`
22+
* Download model : [Model download · TadasBaltrusaitis/OpenFace Wiki · GitHub](https://github.com/TadasBaltrusaitis/OpenFace/wiki/Model-download)
23+
* Install OpenFace, following this instruction : [Unix Installation · TadasBaltrusaitis/OpenFace Wiki · GitHub](https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation) (don't forget to sudo make install at the end)
24+
* Download [openface2_ros](https://github.com/ditoec/openface_ros) to your catkin src folder and `cd .. && catkin make`
25+
* Clone [`usb_cam` ros node](http://wiki.ros.org/usb_cam) or other ros node of your choice for interfacing with USB camera
26+
27+
### Running
28+
29+
* `roscore`
30+
* `rosrun usb_cam usb_cam_node`
31+
* `roslaunch openface2_ros openface2_ros.launch`
32+
33+
### Notes
34+
35+
This node requires `cv_bridge` *and* OpenCV 3. You must ensure that `cv_bridge` is also linked against OpenCV 3. If you get a warning during compilation, you may have to manually clone the `vision_opencv` repository and re-build `cv_bridge`.
36+
37+
### Issues
38+
39+
If running `openface2_ros` results in a segfault or you see the following lines when running `catkin_make`:
40+
41+
/usr/bin/ld: warning: libopencv_imgproc.so.2.4, needed by /opt/ros/indigo/lib/libcv_bridge.so, may conflict with libopencv_imgproc.so.3.1
42+
/usr/bin/ld: warning: libopencv_highgui.so.2.4, needed by /opt/ros/indigo/lib/libcv_bridge.so, may conflict with libopencv_highgui.so.3.1
43+
/usr/bin/ld: warning: libopencv_calib3d.so.2.4, needed by /usr/lib/x86_64-linux-gnu/libopencv_contrib.so.2.4.8, may conflict with libopencv_calib3d.so.3.1
44+
45+
then openface2 ros is linking against OpenCV2 instead of OpenCV3. To fix this: update cmake to at least 3.6.2, rebuild OpenCV3, clone vision\_opencv into the src folder of your catkin workspace, then recompile cv\_bridge. Remake your catkin workspace, and the segfault and warnings should have been resolved.
46+
47+
## Published Topics
48+
49+
* `/openface2/faces` ( `openface2_ros/faces` )
50+
* `/openface2/image` ( `sensor_msgs/Image` )
51+
52+
## Messages
53+
54+
### Faces
55+
```
56+
std_msgs/Header header
57+
58+
openface_ros/Face[] faces
59+
uint32 count```
60+
```
61+
62+
### FaceFeatures
63+
```
64+
geometry_msgs/Vector3 left_gaze
65+
geometry_msgs/Vector3 right_gaze
66+
geometry_msgs/Vector3 gaze_angle
67+
68+
geometry_msgs/Pose head_pose
69+
70+
geometry_msgs/Point[] landmarks_3d
71+
geometry_msgs/Point[] landmarks_2d
72+
73+
openface_ros/ActionUnit[] action_units
74+
```
75+
76+
### ActionUnit
77+
```
78+
string name
79+
float64 presence
80+
float64 intensity
81+
```
82+
83+
## Changelog
84+
* Accommodate major changes in openface 2.0.6 (functions and classes naming & grouping)
85+
* Add eye gaze angle in the Face message type
86+
* Add Faces message type (an array of Face message type) in order to accommodate the new multiple face detection in openface 2.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<launch>
2+
3+
<include file="$(find realsense2_camera)/launch/rs_camera.launch"/>
4+
5+
<arg name="image_topic" default="/camera/color/image_raw" />
6+
<arg name="publish_viz" default="true" />
7+
8+
<node pkg="openface2_ros" name="openface2_ros" type="openface2_ros" output="screen">
9+
<param name="image_topic" value="$(arg image_topic)" type="str"/>
10+
<param name="publish_viz" value="$(arg publish_viz)" type="bool"/>
11+
</node>
12+
13+
14+
15+
</launch>

openface2_ros/msg/ActionUnit.msg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
string name
2+
float64 presence
3+
float64 intensity

openface2_ros/msg/Face.msg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
std_msgs/Header header
2+
3+
geometry_msgs/Pose left_gaze
4+
geometry_msgs/Pose right_gaze
5+
6+
geometry_msgs/Vector3 gaze_angle
7+
8+
geometry_msgs/Pose head_pose
9+
10+
geometry_msgs/Point[] landmarks_3d
11+
geometry_msgs/Point[] landmarks_2d
12+
13+
openface2_ros/ActionUnit[] action_units

openface2_ros/msg/Faces.msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
std_msgs/Header header
2+
3+
openface2_ros/Face[] faces
4+
uint32 count

openface2_ros/package.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0"?>
2+
<package>
3+
<name>openface2_ros</name>
4+
<version>1.0.0</version>
5+
<description>The openface2_ros package</description>
6+
7+
<maintainer email="[email protected]">Dito Cahya</maintainer>
8+
<license>Apache 2</license>
9+
10+
<author email="[email protected]">Dito Cahya</author>
11+
12+
<buildtool_depend>catkin</buildtool_depend>
13+
<build_depend>std_msgs</build_depend>
14+
<build_depend>geometry_msgs</build_depend>
15+
<build_depend>sensor_msgs</build_depend>
16+
<build_depend>image_transport</build_depend>
17+
<build_depend>cv_bridge</build_depend>
18+
<build_depend>message_generation</build_depend>
19+
<build_depend>roscpp</build_depend>
20+
<build_depend>tf2</build_depend>
21+
<build_depend>tf2_ros</build_depend>
22+
<run_depend>message_runtime</run_depend>
23+
<run_depend>roscpp</run_depend>
24+
<run_depend>image_transport</run_depend>
25+
<run_depend>cv_bridge</run_depend>
26+
<run_depend>tf2</run_depend>
27+
<run_depend>tf2_ros</run_depend>
28+
29+
30+
<export>
31+
32+
</export>
33+
</package>

0 commit comments

Comments
 (0)