This sample is also compiled by NDS as an external package, which locates, for example, external/pprotector.
The directory tree is as follows and we called OpenCV2.4 APIs in privacy_detect.cpp.
.
|-- Android.mk
|-- ImageUtils.h
|-- ImageUtils_0.7.cpp
|-- detectObject.cpp
|-- detectObject.h
|-- haarcascades
| |-- faces.jpeg
| |-- fist.xml
| |-- haarcascade_eye.xml
| |-- haarcascade_eye_tree_eyeglasses.xml
| |-- haarcascade_frontalface_alt2.xml
| |-- haarcascade_profileface.xml
| |-- haarcascade_smile.xml
| |-- lbpcascade_frontalface.xml
| |-- palm.xml
|-- preprocessFace.cpp
|-- preprocessFace.h
|-- privacy_detect.cpp
|-- privacy_detect.h
|-- recognition.cpp
`-- recognition.h
As the compilation of OpenCV2.4 to AOSP, the big part is how to set up the NDK compiling configuration, which is Android.mk. Please note that the value of LOCAL_STATIC_LIBRARIES includes the static library of OpenCV2.4 (i.e., libopencv24) and other built-in static libraries with OpenCV 2.4 SDK.
Here is the content of my Android.mk :
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libpprotector24
LOCAL_SRC_FILES := privacy_detect.cpp detectObject.cpp ImageUtils_0.7.cpp preprocessFace.cpp recognition.cpp
LOCAL_STATIC_LIBRARIES += libopencv24 opencv_contrib opencv_legacy opencv_stitching opencv_superres opencv_ocl opencv_objdetect opencv_ml opencv_ts opencv_videostab opencv_video opencv_photo opencv_calib3d opencv_features2d opencv_highgui opencv_imgproc opencv_flann opencv_androidcamera opencv_core tbb libjpeg libpng libtiff libjasper IlmImf
LOCAL_CFLAGS := -Wall -Wextra -Wno-error=non-virtual-dtor -Werror=return-type -std=c++11 -frtti -fexceptions
LOCAL_LDLIBS := prebuilts/ndk/9/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/libgnustl_static.a -lc -llog -lm -ldl -lz
No comments:
Post a Comment