Merge pull request #38 from Affectiva/v4.0.0

Updating the README and adding the docker directory
This commit is contained in:
Umang Mehta 2018-02-24 21:52:49 -05:00 committed by GitHub
commit db582b8caa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 271 additions and 61 deletions

View file

@ -1,14 +1,6 @@
dist: xenial-xerus sudo: required
language: cpp services:
compiler: - docker
- gcc-4.8 language: generic
before_script: before_install:
- sudo apt-get install -y gcc-4.8 g++-4.8 libopencv-dev libboost1.55-all-dev cmake - docker build --file=docker/Dockerfile-Ubuntu --tag=v4.0.0:affdex .
- wget https://download.affectiva.com/linux/affdex-cpp-sdk-3.3-40-ubuntu-xenial-xerus-x86_64bit.tar.gz -O /tmp/affdex-sdk.tar.gz
- mkdir /tmp/affdex-sdk
- tar -xzvf /tmp/affdex-sdk.tar.gz -C /tmp/affdex-sdk
- mkdir build
- cd build
- cmake -DBOOST_ROOT=/usr/ -DOpenCV_DIR=/usr/ -DAFFDEX_DIR=/tmp/affdex-sdk ..
script:
- make

138
README.md
View file

@ -1,8 +1,9 @@
# Sample Apps for Affdex SDK for Windows and Linux # Sample Apps for Affdex SDK for Windows and Linux
Welcome to our repository on GitHub! Here you will find example code to get you started with our Affdex Linux SDK 3.2, Affdex Windows SDK 3.4 and begin emotion-enabling you own app! Documentation for the SDKs is available on the <a href=http://developer.affectiva.com/>Affectiva's Developer Portal</a>. Welcome to our repository on GitHub! Here you will find example code to get you started with our Affdex Linux SDK 4.0.0, Affdex Windows SDK 3.4 and begin emotion-enabling you own app! Documentation for the SDKs is available on the <a href=http://developer.affectiva.com/>Affectiva's Developer Portal</a>.
*Build Status* Build Status
-------------
- Windows: [![Build status](https://ci.appveyor.com/api/projects/status/pn2y9h8a3nnkiw41?svg=true)] - Windows: [![Build status](https://ci.appveyor.com/api/projects/status/pn2y9h8a3nnkiw41?svg=true)]
(https://ci.appveyor.com/project/ahamino/win-sdk-samples) (https://ci.appveyor.com/project/ahamino/win-sdk-samples)
- Ubuntu: [![Build Status](https://travis-ci.org/Affectiva/cpp-sdk-samples.svg?branch=master)](https://travis-ci.org/Affectiva/cpp-sdk-samples) - Ubuntu: [![Build Status](https://travis-ci.org/Affectiva/cpp-sdk-samples.svg?branch=master)](https://travis-ci.org/Affectiva/cpp-sdk-samples)
@ -10,20 +11,20 @@ Welcome to our repository on GitHub! Here you will find example code to get you
Dependencies Dependencies
------------ ------------
*Windows* ##### Windows
- Affdex SDK 3.4 (64 bit) - Affdex SDK 3.4 (64 bit)
- Visual Studio 2013 or higher - Visual Studio 2013 or higher
*Linux* ##### Linux
- Ubuntu 14.04 or CentOS 7 - Ubuntu 16.04 with GCC v5.4.1
- Affdex SDK 3.2 - CentOS 7 with GCC v4.8.x
- CMake 2.8 or higher - Affdex SDK 4.0.0
- GCC 4.8 - CMake 3.5 or higher
*Additional dependencies* ##### Additional dependencies
- OpenCV 2.4 - OpenCV 2.4
- Boost 1.55 - Boost 1.63
- libuuid - libuuid
- libcurl - libcurl
- libopenssl - libopenssl
@ -31,55 +32,95 @@ Dependencies
Installation Installation
------------ ------------
- Download Affdex SDK for Linux [from here](https://affectiva.readme.io/docs/getting-started-with-the-affectiva-sdk-for-linux#section-1-download-and-extract-the-sdk-archive)
- Download Affdex SDK for Windows [from here](https://affectiva.readme.io/docs/getting-started-with-the-emotion-sdk-for-windows#section-1-download-and-run-the-sdk-installer)
*Windows*
- Download Affdex SDK [from here](https://knowledge.affectiva.com/docs/getting-started-with-the-emotion-sdk-for-windows) ##### Windows
- Install the SDK using MSI installer. - Install the SDK using MSI installer.
- The additional dependencies get installed automatically by NuGet. - The additional dependencies get installed automatically by NuGet.
*Ubuntu* ##### Linux
- Download Affdex SDK [from here](https://knowledge.affectiva.com/docs/getting-started-with-the-affectiva-sdk-for-linux)
```bashrc *Installation Guide for dependencies CMake v3.8.1 and Boost v1.63 for CentOS 7 and Ubuntu 16.04*
sudo apt-get install build-essential libopencv-dev libboost1.55-all-dev libcurl4-openssl uuid-dev cmake
wget https://download.affectiva.com/linux/affdex-cpp-sdk-3.2-20-ubuntu-xenial-xerus-64bit.tar.gz - Boost
mkdir $HOME/affdex-sdk
tar -xzvf affdex-cpp-sdk-3.2-20-ubuntu-xenial-xerus-64bit.tar.gz -C $HOME/affdex-sdk ```
export AFFDEX_DATA_DIR=$HOME/affdex-sdk/data $ wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz
git clone https://github.com/Affectiva/cpp-sdk-samples.git $HOME/sdk-samples $ tar -xzvf boost_1_63_0.tar.gz -C $HOME
mkdir $HOME/build $ cd boost_1_63_0
cd $HOME/build $ ./bootstrap.sh
cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$HOME/affdex-sdk $HOME/sdk-samples $ sudo ./b2 -j $(nproc) cxxflags=-fPIC threading=multi runtime-link=shared \
make --with-log --with-serialization --with-system --with-date_time \
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/affdex-sdk/lib --with-filesystem --with-regex --with-timer --with-chrono --with-thread \
--with-program_options install
``` ```
*CentOS* - CMAKE
- Download Affdex SDK [from here](https://knowledge.affectiva.com/docs/getting-started-with-the-affectiva-sdk-for-linux)
```
$ wget https://cmake.org/files/v3.8/cmake-3.8.1.tar.gz \
$ tar -xvf cmake-3.8.1.tar.gz && rm cmake-3.8.1.tar.gz
$ cd $SRC_DIR/cmake-3.8.1/
$ ./bootstrap --system-curl && \
make -j$(nproc) && \
make install && \
rm -rf $SRC_DIR/cmake-3.8.1
```
- Building the SDK on Ubuntu 16.04
```bashrc ```bashrc
sudo yum install libcurl-devel.x86_64 libuuid-devel.x86_64 opencv-devel cmake.x86_64 $ sudo apt-get install build-essential libopencv-dev libcurl4-openssl uuid-dev
wget https://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download -O boost_1_55_0.tar.gz $ wget https://download.affectiva.com/linux/gcc-5.4/affdex-cpp-sdk-4.0-75-ubuntu-xenial-xerus-x86_64bit.tar.gz
tar -xzvf boost_1_55_0.tar.gz -C $HOME $ mkdir $HOME/affdex-sdk
cd boost_1_55 $ tar -xzvf affdex-cpp-sdk-4.0-75-ubuntu-xenial-xerus-x86_64bit.tar.gz -C $HOME/affdex-sdk
./bootstrap.sh --with-libraries=log,serialization,system,date_time,filesystem,regex,timer,chrono,thread,program_options $ export AFFDEX_DATA_DIR=$HOME/affdex-sdk/data
sudo ./b2 link=static install $ git clone https://github.com/Affectiva/cpp-sdk-samples.git $HOME/sdk-samples
wget https://download.affectiva.com/linux/affdex-cpp-sdk-3.2-2893-centos-7-64bit.tar.gz $ mkdir $HOME/build
mkdir $HOME/affdex-sdk $ cd $HOME/build
tar -xzvf affdex-cpp-sdk-3.2-2893-centos-7-64bit.tar.gz -C $HOME/affdex-sdk $ cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$HOME/affdex-sdk $HOME/sdk-samples
export AFFDEX_DATA_DIR=$HOME/affdex-sdk/data $ make
git clone https://github.com/Affectiva/cpp-sdk-samples.git $HOME/sdk-samples $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/affdex-sdk/lib
mkdir $HOME/build
cd $HOME/build # The SDK statically links a forked version of OpenCV, so if you run into double free or corruption error
cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$HOME/affdex-sdk $HOME/sdk-samples # then you will need to preload the OpenCV library installed from package manager
make # Use this command to find the path of libopencv_core.so.2.4
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/affdex-sdk/lib
$ ldconfig -p | grep libopencv_core.so.2.4
$ export LD_PRELOAD=/path/to/libopencv_core.so.2.4
```
- Building the SDK on CentOS 7
```bashrc
$ sudo yum install libcurl-devel.x86_64 libuuid-devel.x86_64 opencv-devel
$ wget https://download.affectiva.com/linux/centos-4.8/affdex-cpp-sdk-4.0-2941-centos-7-x86_64bit.tar.gz
$ mkdir $HOME/affdex-sdk
$ tar -xzvf affdex-cpp-sdk-4.0-2941-centos-7-x86_64bit.tar.gz -C $HOME/affdex-sdk
$ export AFFDEX_DATA_DIR=$HOME/affdex-sdk/data
$ git clone https://github.com/Affectiva/cpp-sdk-samples.git $HOME/sdk-samples
$ mkdir $HOME/build
$ cd $HOME/build
$ cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$HOME/affdex-sdk $HOME/sdk-samples
$ make
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/affdex-sdk/lib
# The SDK statically links a forked version of OpenCV, so if you run into double free or corruption error
# then you will need to preload the OpenCV library installed from package manager
# Use this command to find the path of libopencv_core.so.2.4
$ ldconfig -p | grep libopencv_core.so.2.4
$ export LD_PRELOAD=/path/to/libopencv_core.so.2.4
``` ```
OpenCV-webcam-demo (c++) OpenCV-webcam-demo (c++)
------------------ ------------------
Project for demoing the [FrameDetector class](https://knowledge.affectiva.com/docs/analyze-a-video-frame-stream-3). It grabs frames from the camera, analyzes them and displays the results on screen. Project for demoing the [FrameDetector class](http://developer.affectiva.com/v3_2/cpp/analyze-frames/). It grabs frames from the camera, analyzes them and displays the results on screen.
The following command line arguments can be used to run it: The following command line arguments can be used to run it:
@ -99,7 +140,7 @@ The following command line arguments can be used to run it:
Video-demo (c++) Video-demo (c++)
---------- ----------
Project for demoing the Windows SDK [VideoDetector class](https://knowledge.affectiva.com/docs/analyze-a-recorded-video-file) and [PhotoDetector class](https://knowledge.affectiva.com/docs/analyze-a-photo-4). It processs video or image files, displays the emotion metrics and exports the results in a csv file. Project for demoing the Windows SDK [VideoDetector class](http://developer.affectiva.com/v3_2/cpp/analyze-video/) and [PhotoDetector class](http://developer.affectiva.com/v3_2/cpp/analyze-photo/). It process video or image files, displays the emotion metrics and exports the results in a csv file.
The following command line arguments can be used to run it: The following command line arguments can be used to run it:
@ -115,3 +156,8 @@ The following command line arguments can be used to run it:
For an example of how to use Affdex in a C# application .. please refer to [AffdexMe](https://github.com/affectiva/affdexme-win) For an example of how to use Affdex in a C# application .. please refer to [AffdexMe](https://github.com/affectiva/affdexme-win)
Docker Build Instructions
-------------------------
The Dockerfile's are located in the [docker](docker) directory. To build the docker image please refer to the files for instructions.

86
docker/Dockerfile-CentOS Normal file
View file

@ -0,0 +1,86 @@
# A Docker image to be used for building the sample applications for the Linux SDK CentOS7
#
# build:
# $ docker build --file=Dockerfile-CentOS --tag=v4.0.0:affdex .
#
# the result will be an image that has the tar'ed artifact of the sample app and all of its dependencies installed
#
# run interactively:
# $ docker run -it --rm v4.0.0:affdex
FROM affectiva/centos7-updates
MAINTAINER Affectiva Development (affdexdev@affectiva.com)
# Repo for latest git 2.x
RUN yum remove -y git
RUN yum install -y http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
RUN yum install -y gcc \
gcc-c++ \
jhead \
curl-devel \
openssl-devel \
zlib-devel \
wget \
git \
opencv-devel \
make
ENV SRC_DIR /opt/src
ENV BUILD_DIR /opt/build
ENV ARTIFACT_DIR /opt/testapp-artifact
#################################
###### Clone Sample App Repo ######
#################################
RUN git clone https://github.com/Affectiva/cpp-sdk-samples.git $SRC_DIR/sdk-samples
#### CMAKE ####
WORKDIR $SRC_DIR
RUN wget https://cmake.org/files/v3.8/cmake-3.8.1.tar.gz \
&& tar -xf cmake-3.8.1.tar.gz && rm cmake-3.8.1.tar.gz
RUN cd $SRC_DIR/cmake-3.8.1/ && \
./bootstrap --system-curl && \
make -j$(nproc) && \
make install && \
rm -rf $SRC_DIR/cmake-3.8.1
#### BOOST ####
WORKDIR $SRC_DIR
RUN wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz --no-check-certificate && \
tar -xf boost_1_63_0.tar.gz && \
rm boost_1_63_0.tar.gz && \
cd $SRC_DIR/boost_1_63_0 && \
./bootstrap.sh &&\
./b2 -j $(nproc) cxxflags=-fPIC threading=multi runtime-link=shared \
--with-log --with-serialization --with-system --with-date_time \
--with-filesystem --with-regex --with-timer --with-chrono --with-thread \
--with-program_options install && \
rm -rf $SRC_DIR/boost_1_63_0
#### DOWNLOAD Affdex CentOS SDK ####
WORKDIR $SRC_DIR
RUN wget https://download.affectiva.com/linux/centos-4.8/affdex-cpp-sdk-4.0-2941-centos-7-x86_64bit.tar.gz &&\
mkdir -p affdex-sdk && \
tar -xf affdex-cpp* -C affdex-sdk && \
rm -r $SRC_DIR/affdex-cpp-sdk-4.0-2941-centos-7-x86_64bit.tar.gz
#### BUILD SAMPLE APP ####
RUN mkdir -p $BUILD_DIR &&\
cd $BUILD_DIR &&\
cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$SRC_DIR/affdex-sdk $SRC_DIR/sdk-samples &&\
make -j$(nproc)
## CREATE THE ARTIFACT
WORKDIR $ARTIFACT_DIR
RUN mkdir -p $ARTIFACT_DIR &&\
mv $SRC_DIR/affdex-sdk/ . &&\
mv $BUILD_DIR . &&\
tar -cvf ../testapp-artifact.tar.gz .
ENV AFFDEX_DATA_DIR $ARTIFACT_DIR/affdex-sdk/data
ENV LD_LIBRARY_PATH $ARTIFACT_DIR/affdex-sdk/lib
ENV LD_PRELOAD /usr/lib64/libopencv_core.so
WORKDIR /opt

86
docker/Dockerfile-Ubuntu Normal file
View file

@ -0,0 +1,86 @@
# A Docker image to be used for building the sample applications for the Linux SDK Ubuntu 16.04
#
# build:
# $ docker build --file=Dockerfile-Ubuntu --tag=v4.0.0:affdex .
#
# the result will be an image that has the tar'ed artifact of the sample app and all of its dependencies installed
#
# run interactively:
# $ docker run -it --rm v4.0.0:affdex
FROM ubuntu:16.04
# Get dependencies
RUN apt-get update && apt-get install -y software-properties-common
# Repo for latest git 2.x
RUN add-apt-repository -y ppa:git-core/ppa && apt-get update && apt-get install -y git
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
bc \
gfortran \
unzip \
wget \
g++ \
make \
libopencv-dev
ENV SRC_DIR /opt/src
ENV BUILD_DIR /opt/build
ENV ARTIFACT_DIR /opt/testapp-artifact
#################################
###### Clone Sample App Repo ######
#################################
RUN git clone https://github.com/Affectiva/cpp-sdk-samples.git $SRC_DIR/sdk-samples
#### CMAKE ####
WORKDIR $SRC_DIR
RUN wget https://cmake.org/files/v3.8/cmake-3.8.1.tar.gz \
&& tar -xf cmake-3.8.1.tar.gz && rm cmake-3.8.1.tar.gz
RUN cd $SRC_DIR/cmake-3.8.1/ && \
./bootstrap --system-curl && \
make -j$(nproc) install > /dev/null && \
rm -rf $SRC_DIR/cmake-3.8.1
#### BOOST ####
WORKDIR $SRC_DIR
RUN wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz --no-check-certificate && \
tar -xf boost_1_63_0.tar.gz && \
rm boost_1_63_0.tar.gz && \
cd $SRC_DIR/boost_1_63_0 && \
./bootstrap.sh &&\
./b2 -j $(nproc) cxxflags=-fPIC threading=multi runtime-link=shared \
--with-log --with-serialization --with-system --with-date_time \
--with-filesystem --with-regex --with-timer --with-chrono --with-thread \
--with-program_options \
install && \
rm -rf $SRC_DIR/boost_1_63_0
#### DOWNLOAD Affdex Ubuntu SDK ####
WORKDIR $SRC_DIR
RUN wget https://download.affectiva.com/linux/gcc-5.4/affdex-cpp-sdk-4.0-75-ubuntu-xenial-xerus-x86_64bit.tar.gz &&\
mkdir -p affdex-sdk && \
tar -xf affdex-cpp* -C affdex-sdk && \
rm -r $SRC_DIR/affdex-cpp-sdk-*
#### BUILD SAMPLE APP ####
RUN mkdir -p $BUILD_DIR &&\
cd $BUILD_DIR &&\
cmake -DOpenCV_DIR=/usr/ -DBOOST_ROOT=/usr/ -DAFFDEX_DIR=$SRC_DIR/affdex-sdk $SRC_DIR/sdk-samples &&\
make -j$(nproc) > /dev/null
## CREATE THE ARTIFACT
WORKDIR $ARTIFACT_DIR
RUN mkdir -p $ARTIFACT_DIR &&\
mv $SRC_DIR/affdex-sdk/ . &&\
mv $BUILD_DIR . &&\
tar -cvf ../testapp-artifact.tar.gz .
ENV AFFDEX_DATA_DIR $ARTIFACT_DIR/affdex-sdk/data
ENV LD_LIBRARY_PATH $ARTIFACT_DIR/affdex-sdk/lib
ENV LD_PRELOAD /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4
WORKDIR /opt