add base code
authorJonghyuk Lee <jhyuk47.lee@samsung.com>
Tue, 21 Aug 2012 11:21:15 +0000 (20:21 +0900)
committerJonghyuk Lee <jhyuk47.lee@samsung.com>
Tue, 21 Aug 2012 11:21:15 +0000 (20:21 +0900)
16 files changed:
CMakeLists.txt [new file with mode: 0755]
b.sh [new file with mode: 0755]
engine/CMakeLists.txt [new file with mode: 0755]
engine/arm/libface-engine.so [new file with mode: 0755]
engine/face-engine.pc.in [new file with mode: 0755]
engine/i586/libface-engine.so [new file with mode: 0755]
include/face-engine.h [new file with mode: 0755]
lib/CMakeLists.txt [new file with mode: 0755]
lib/arm/libface-engine-plugin.so [new file with mode: 0755]
lib/data/FR_c0.bin [new file with mode: 0755]
lib/data/FR_c1.bin [new file with mode: 0755]
lib/data/FR_g0.bin [new file with mode: 0755]
lib/i586/libface-engine-plugin.so [new file with mode: 0755]
make_tar.sh [new file with mode: 0755]
packaging/build.sh [new file with mode: 0755]
packaging/face-engine.spec [new file with mode: 0755]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..93f252f
--- /dev/null
@@ -0,0 +1,14 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "face-engine")
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+ADD_SUBDIRECTORY(lib)
+ADD_SUBDIRECTORY(engine)
+
+
+#install needed files
+
+INSTALL(DIRECTORY include/ DESTINATION include/${fw_name})
+
diff --git a/b.sh b/b.sh
new file mode 100755 (executable)
index 0000000..71c2097
--- /dev/null
+++ b/b.sh
@@ -0,0 +1,8 @@
+./make_tar.sh
+
+cd packaging 
+
+./build.sh $1
+
+cd ..
+
diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..c7b6779
--- /dev/null
@@ -0,0 +1,19 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "face-engine")
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}/ DESTINATION lib)
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+
+SET(PC_LDFLAGS "-lface-engine-plugin -l${fw_name}")
+
+#configure pc file
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
diff --git a/engine/arm/libface-engine.so b/engine/arm/libface-engine.so
new file mode 100755 (executable)
index 0000000..61bb08a
Binary files /dev/null and b/engine/arm/libface-engine.so differ
diff --git a/engine/face-engine.pc.in b/engine/face-engine.pc.in
new file mode 100755 (executable)
index 0000000..acc2517
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/@PC_NAME@
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
diff --git a/engine/i586/libface-engine.so b/engine/i586/libface-engine.so
new file mode 100755 (executable)
index 0000000..3752172
Binary files /dev/null and b/engine/i586/libface-engine.so differ
diff --git a/include/face-engine.h b/include/face-engine.h
new file mode 100755 (executable)
index 0000000..80ab41e
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
+
+ This file is part of face-engine
+ Written by Hyunwoo Kim <hw4444.kim@samsung.com>
+
+ PROPRIETARY/CONFIDENTIAL
+
+ This software is the confidential and proprietary information of
+ SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
+ disclose such Confidential Information and shall use it only in
+ accordance with the terms of the license agreement you entered
+ into with SAMSUNG ELECTRONICS.
+ SAMSUNG make no representations or warranties about the suitability
+ of the software, either express or implied, including but not limited
+ to the implied warranties of merchantability, fitness for a particular
+ purpose, or non-infringement. SAMSUNG shall not be liable for any
+ damages suffered by licensee as a result of using, modifying or
+ distributing this software or its derivatives.
+ */
+
+
+#ifndef __FACE_ENGINE_H__
+#define __FACE_ENGINE_H__
+
+#include <stdbool.h>
+
+/**
+ * @brief Facial engine handle type.
+ */
+typedef void* face_engine_h;
+
+/**
+ * @brief Enumerations of error codes for the FacialEngine API.
+ */
+typedef enum {
+       FACE_ENGINE_ERROR_NONE = 0,                     /**< Successful */
+       FACE_ENGINE_ERROR_INVALID_PARAMTER = -1,        /**< A specified input parameter is invalid. */
+       FACE_ENGINE_ERROR_OUT_OF_MEMORY = -2,           /**< The memory is insufficient. */
+       FACE_ENGINE_ERROR_OPERATION_FAILED = -3,                /**< Does not support this property. À߸øµÈ state */
+       FACE_ENGINE_ERROR_FAILURE = -4,                         /**< A system error has occurred. ³»ºÎ error */
+       FACE_ENGINE_ERROR_ENGINE_NOT_FOUND = -5,
+} face_engine_error_e;
+
+/**
+ * @brief Enumerations of input image format for the FacialEngine API.
+ */
+typedef enum {
+       FACE_ENGINE_IMAGE_FORMAT_Y,                     /**< luminance only image*/
+} face_engine_image_colorspace_e;
+
+/**
+ * @brief Enumerations of facial expression that recognized for the FacialEngine API.
+ */
+typedef enum {
+       FACE_ENGINE_EXPRESSION_UNKNOWN,
+       FACE_ENGINE_EXPRESSION_NUETRAL,         /**< Normal expression */
+       FACE_ENGINE_EXPRESSION_ANGRY,                   /**< Angry expression */
+       FACE_ENGINE_EXPRESSION_SMILE,                   /**< Cheerful expression */
+       FACE_ENGINE_EXPRESSION_SURPRISE,                /**< Suprised expression */
+} face_engine_expression_e;
+
+/**
+ * @brief Enumerations of the eye state for the FacialEngine API.
+ */
+typedef enum {
+       FACE_ENGINE_EYE_UNKNOWN,                /**< The no eye state, when the eye detect fails */
+       FACE_ENGINE_EYE_OPENED,         /**< The state when eye is opened */
+       FACE_ENGINE_EYE_CLOSED,         /**< The state when eye is closed */
+} face_engine_eye_e;
+
+typedef enum {
+       FACE_ENGINE_IMAGE_TYPE_SINGLE,  /**< */
+       FACE_ENGINE_IMAGE_TYPE_CONTINIOUS,
+} face_engine_image_type_e;
+
+typedef struct {
+       int x;          /**< x-coordinate */
+       int y;          /**< y-coordinate */
+} face_engine_point_t;
+
+typedef struct {
+       int x;          /**< most left coordinate of detected face region  */
+       int y;          /**< most top coordinate of detected face region  */
+       int w;          /**< width of detected face region  */
+       int h;          /**<  height of detected face region */
+} face_engine_rect_t;
+
+typedef struct {
+       unsigned char *pixel;            /**< pixel data */
+
+       int width;                                       /**< image data's width */
+       int height;                                      /**< image data's height */
+
+       face_engine_image_colorspace_e colorspace;      /**< color space */
+} face_engine_image_t;
+
+typedef union {
+       struct {
+               face_engine_rect_t face;        // 16
+
+               face_engine_point_t lefteye;    // 8
+               face_engine_point_t righteye;   // 8
+
+               face_engine_rect_t mouse;       // 16
+       };
+
+       char Reserved[128];
+} face_engine_component_t;
+
+typedef union {
+       struct {
+               int nMaxFaceNum; /**< */
+               int nScale;             /**< */
+               int nInterval; /**< */
+               int nDetectionOption;           /* 0 for FAST, 1 for ROBUST */
+       };
+
+       char Reserved[32];
+} face_engine_param_t;
+
+typedef struct {
+       unsigned char *data;    /**< result data of face information */
+       unsigned int len;               /**< size of result data */// in byte unit
+} face_engine_feature_t;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+face_engine_error_e face_engine_create(face_engine_h *handle);
+face_engine_error_e face_engine_destroy(face_engine_h handle);
+
+face_engine_error_e face_engine_get_param(face_engine_h handle, face_engine_param_t *param);
+face_engine_error_e face_engine_set_param(face_engine_h handle, const face_engine_param_t *param);
+
+face_engine_error_e face_engine_detect_faces(face_engine_h handle, face_engine_image_type_e image_type, const face_engine_image_t *image,  face_engine_rect_t *face[], int *count);
+
+face_engine_error_e face_engine_track_faces(face_engine_h handle, const face_engine_rect_t *prev_rect, face_engine_rect_t *cur_rect);
+
+face_engine_error_e face_engine_extract_face_component(face_engine_h handle, const face_engine_image_t *image, const face_engine_rect_t *rect, face_engine_component_t *component);
+face_engine_error_e face_engine_extract_face_feature(face_engine_h handle, const face_engine_image_t *image, const face_engine_component_t *component, face_engine_feature_t *feature);
+
+face_engine_error_e face_engine_compare_face_feature(const face_engine_feature_t *A, const face_engine_feature_t *B, int *similarity);
+
+face_engine_error_e face_engine_recognize_face_expression(face_engine_h handle, const face_engine_image_t *image , const face_engine_component_t *component, face_engine_expression_e *expression);
+
+face_engine_error_e face_engine_recognize_blink(face_engine_h handle,  const face_engine_image_t *image, const face_engine_component_t *component, face_engine_eye_e *lefteye,  face_engine_eye_e *righteye);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif         // __TIZEN_UIX_FACE_ENGINE_H__
+
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..ec98462
--- /dev/null
@@ -0,0 +1,4 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARCH}/ DESTINATION lib)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/ DESTINATION ${CMAKE_DATA_DIR})
diff --git a/lib/arm/libface-engine-plugin.so b/lib/arm/libface-engine-plugin.so
new file mode 100755 (executable)
index 0000000..b7fa9ac
Binary files /dev/null and b/lib/arm/libface-engine-plugin.so differ
diff --git a/lib/data/FR_c0.bin b/lib/data/FR_c0.bin
new file mode 100755 (executable)
index 0000000..59420ed
Binary files /dev/null and b/lib/data/FR_c0.bin differ
diff --git a/lib/data/FR_c1.bin b/lib/data/FR_c1.bin
new file mode 100755 (executable)
index 0000000..233d4f7
Binary files /dev/null and b/lib/data/FR_c1.bin differ
diff --git a/lib/data/FR_g0.bin b/lib/data/FR_g0.bin
new file mode 100755 (executable)
index 0000000..dc20050
Binary files /dev/null and b/lib/data/FR_g0.bin differ
diff --git a/lib/i586/libface-engine-plugin.so b/lib/i586/libface-engine-plugin.so
new file mode 100755 (executable)
index 0000000..f7e6e3d
Binary files /dev/null and b/lib/i586/libface-engine-plugin.so differ
diff --git a/make_tar.sh b/make_tar.sh
new file mode 100755 (executable)
index 0000000..7a71c07
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+echo ".gitattributes export-ignore" > .gitattributes
+echo ".gitignore export-ignore" >> .gitattributes
+echo "debian export-ignore" >> .gitattributes
+echo "packaging export-ignore" >> .gitattributes
+
+PWD=`pwd`
+DIR=`basename $PWD`
+echo "DIR=$DIR"
+
+COUNT=`ls -1 packaging/*.spec | grep .spec | wc -l`
+
+if [ $COUNT -ne 1 ]
+then
+       echo "No spec file !!"
+       exit;
+fi
+
+SPEC_FILE=`ls -1 packaging/*.spec`
+
+#SPEC_FILE=ug-image-viewer-efl.spec
+
+VER=`grep "Version:" $SPEC_FILE | awk '{ print $2 }'`
+REV=`grep "Release:" $SPEC_FILE | awk '{ print $2 }'`
+
+PKGNAME=`grep "Name:" $SPEC_FILE | awk '{ print $2}'`
+
+echo "package : $PKGNAME"
+echo "version : $VER"
+echo "revision : $REV"
+
+# git archive --format=tar --worktree-attributes --prefix=$PKGNAME-$VER/ HEAD  | gzip >  ./packaging/$PKGNAME-$VER.tar.gz
+
+rm .build_tmp -rf
+
+mkdir .build_tmp
+cd .build_tmp
+
+mkdir $PKGNAME-$VER
+
+cp ../* $PKGNAME-$VER -r
+
+tar cvzf ../packaging/$PKGNAME-$VER.tar.gz $PKGNAME-$VER --exclude .git --exclude packaging
+
+cd ..
+
+rm .build_tmp -rf
+
+# cd $PWD
+
+echo "Created : " $PKGNAME-$VER.tar.gz
+
diff --git a/packaging/build.sh b/packaging/build.sh
new file mode 100755 (executable)
index 0000000..54b9944
--- /dev/null
@@ -0,0 +1,29 @@
+if [ ! -e .osc ]
+then
+       echo -n "Enter reository(ex -> SLP:Main or home:hw4444.kim) : "
+       read ID
+       echo "****************************"
+
+       SPEC_FILE=`ls -1 *.spec`
+       PKGNAME=`grep "Name:" $SPEC_FILE | awk '{ print $2}'`
+
+       osc init $ID $PKGNAME
+fi
+
+# move rpm.
+mkdir old
+mv *.rpm old
+
+rm .osc/*.gz
+rm .osc/*.spec
+
+osc repairwc
+
+# -k means output RPM directory
+osc build armv7el --no-verify -j 8 -k . $1
+#osc build i586 --no-verify -j 8 -k . $1
+
+PWD=`pwd`;
+
+echo "Create rpm to " $PWD
+
diff --git a/packaging/face-engine.spec b/packaging/face-engine.spec
new file mode 100755 (executable)
index 0000000..b9f89b7
--- /dev/null
@@ -0,0 +1,73 @@
+Name:       face-engine
+Summary:    Face engine v1.0
+Version:    1.0.16
+Release:    1
+Group:      misc
+License:    Samsung proprietary
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires:  cmake
+BuildRequires:  embryo-bin
+BuildRequires:  pkgconfig(dlog)
+
+%description
+Face recognition engine v1.0.
+
+%package -n libface-engine
+Summary:    Face engine library.
+Group:     misc
+Requires:  %{name} = %{version}
+
+Provides : libface-engine-plugin.so
+Provides : libface-engine.so
+
+%description -n libface-engine
+Face engine library
+
+# Devel package
+%package -n libface-engine-devel
+Summary:   Face engine development library(devel)
+Group:     Development/Libraries
+Requires:  libface-engine = %{version}-%{release}
+
+%description -n libface-engine-devel
+Face engine development library
+
+%prep
+%setup -q
+
+%build
+
+%ifarch %{arm}
+%define ARCH arm
+%else
+%define ARCH i586
+%endif
+
+%define DATADIR /usr/share/face-engine/data/
+
+cmake . -DCMAKE_INSTALL_PREFIX="/usr" -DARCH=%{ARCH} -DCMAKE_DATA_DIR=%{DATADIR}
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%files
+%defattr(-,root,root,-)
+
+# /home/root/*
+
+%files -n libface-engine
+%defattr(-,root,root,-)
+/usr/lib/libface-engine.so*
+
+/usr/lib/libface-engine-plugin.so
+/usr/share/face-engine/data/*.bin
+
+%files -n libface-engine-devel
+%defattr(-,root,root,-)
+/usr/lib/pkgconfig/*
+/usr/include/face-engine/*
+