├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ ├── drawable │ │ │ ├── stick_ear.png │ │ │ ├── bg_btn_circle_red.xml │ │ │ └── bg_btn_circle_green.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── raw │ │ │ ├── screen_vertex.glsl │ │ │ ├── screen_frag.glsl │ │ │ ├── camera_vertex.vert │ │ │ ├── camera_frag.frag │ │ │ ├── bigeye_frag.glsl │ │ │ └── beauty_frag.glsl │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── assets │ │ └── seeta_fa_v1.1.bin │ │ ├── jniLibs │ │ └── armeabi-v7a │ │ │ └── libopencv_java3.so │ │ ├── cpp │ │ ├── include │ │ │ ├── opencv │ │ │ │ ├── cxmisc.h │ │ │ │ ├── ml.h │ │ │ │ ├── cvwimage.h │ │ │ │ ├── highgui.h │ │ │ │ ├── cxeigen.hpp │ │ │ │ ├── cvaux.hpp │ │ │ │ ├── cxcore.h │ │ │ │ ├── cxcore.hpp │ │ │ │ ├── cvaux.h │ │ │ │ └── cv.hpp │ │ │ └── opencv2 │ │ │ │ ├── flann │ │ │ │ ├── dummy.h │ │ │ │ ├── config.h │ │ │ │ ├── general.h │ │ │ │ ├── flann.hpp │ │ │ │ ├── timer.h │ │ │ │ ├── sampling.h │ │ │ │ └── object_factory.h │ │ │ │ ├── features2d │ │ │ │ ├── hal │ │ │ │ │ └── interface.h │ │ │ │ └── features2d.hpp │ │ │ │ ├── core │ │ │ │ ├── ovx.hpp │ │ │ │ ├── version.hpp │ │ │ │ ├── bufferpool.hpp │ │ │ │ ├── utils │ │ │ │ │ ├── logger.defines.hpp │ │ │ │ │ └── filesystem.hpp │ │ │ │ ├── opencl │ │ │ │ │ ├── runtime │ │ │ │ │ │ ├── opencl_svm_definitions.hpp │ │ │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ │ │ ├── opencl_gl.hpp │ │ │ │ │ │ ├── autogenerated │ │ │ │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ │ │ │ └── opencl_gl.hpp │ │ │ │ │ │ └── opencl_svm_20.hpp │ │ │ │ │ └── opencl_svm.hpp │ │ │ │ ├── core.hpp │ │ │ │ ├── ocl_genbase.hpp │ │ │ │ ├── va_intel.hpp │ │ │ │ └── cuda │ │ │ │ │ └── warp_reduce.hpp │ │ │ │ ├── opencv_modules.hpp │ │ │ │ ├── imgproc │ │ │ │ ├── hal │ │ │ │ │ └── interface.h │ │ │ │ └── imgproc.hpp │ │ │ │ ├── videoio │ │ │ │ ├── registry.hpp │ │ │ │ └── videoio.hpp │ │ │ │ ├── ml │ │ │ │ ├── ml.inl.hpp │ │ │ │ └── ml.hpp │ │ │ │ ├── photo │ │ │ │ ├── photo.hpp │ │ │ │ └── photo_c.h │ │ │ │ ├── shape │ │ │ │ └── shape.hpp │ │ │ │ ├── video │ │ │ │ └── video.hpp │ │ │ │ ├── calib3d │ │ │ │ └── calib3d.hpp │ │ │ │ ├── highgui │ │ │ │ └── highgui.hpp │ │ │ │ ├── imgcodecs │ │ │ │ ├── imgcodecs.hpp │ │ │ │ └── ios.h │ │ │ │ ├── objdetect │ │ │ │ └── objdetect.hpp │ │ │ │ ├── shape.hpp │ │ │ │ ├── video.hpp │ │ │ │ ├── videostab │ │ │ │ ├── log.hpp │ │ │ │ └── ring_buffer.hpp │ │ │ │ ├── dnn │ │ │ │ └── layer.details.hpp │ │ │ │ └── stitching │ │ │ │ └── detail │ │ │ │ └── camera.hpp │ │ ├── FaceAlignment │ │ │ ├── CMakeLists.txt │ │ │ ├── include │ │ │ │ ├── face_alignment.h │ │ │ │ └── common.h │ │ │ └── src │ │ │ │ └── face_alignment.cpp │ │ ├── LogUtils.h │ │ ├── FaceTrack.h │ │ └── FaceTrack.cpp │ │ ├── java │ │ └── com │ │ │ └── yeliang │ │ │ ├── widget │ │ │ └── CommonSurfaceView.java │ │ │ ├── face │ │ │ ├── Face.java │ │ │ └── FaceTrack.java │ │ │ ├── utils │ │ │ ├── FileUtils.java │ │ │ └── OpenGlUtils.java │ │ │ └── filter │ │ │ ├── ScreenFilter.java │ │ │ ├── BeautyFilter.java │ │ │ ├── CameraFilter.java │ │ │ ├── BaseFrameFilter.java │ │ │ ├── BaseFilter.java │ │ │ └── BigEyeFilter.java │ │ └── AndroidManifest.xml ├── FaceAlignment │ ├── CMakeLists.txt │ ├── include │ │ ├── face_alignment.h │ │ └── common.h │ └── src │ │ └── face_alignment.cpp ├── CMakeLists.txt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .idea ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml └── misc.xml ├── gradle.properties └── gradlew.bat /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 滤镜 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/assets/seeta_fa_v1.1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/assets/seeta_fa_v1.1.bin -------------------------------------------------------------------------------- /app/src/main/res/drawable/stick_ear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/drawable/stick_ear.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libopencv_java3.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/jniLibs/armeabi-v7a/libopencv_java3.so -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrYeLiang/Android-OpenGL-Filter/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv/cxmisc.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_OLD_CXMISC_H 2 | #define OPENCV_OLD_CXMISC_H 3 | 4 | #ifdef __cplusplus 5 | # include "opencv2/core/utility.hpp" 6 | #endif 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/raw/screen_vertex.glsl: -------------------------------------------------------------------------------- 1 | attribute vec4 vPosition; 2 | 3 | attribute vec2 vCoord; 4 | 5 | varying vec2 aCoord; 6 | 7 | void main() { 8 | gl_Position = vPosition; 9 | aCoord = vCoord; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/raw/screen_frag.glsl: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | 3 | //采样点的坐标 4 | varying vec2 aCoord; 5 | 6 | //采样器 7 | uniform sampler2D vTexture; 8 | void main() { 9 | gl_FragColor = texture2D(vTexture, aCoord); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/raw/camera_vertex.vert: -------------------------------------------------------------------------------- 1 | attribute vec4 vPosition; 2 | attribute vec4 vCoord; 3 | 4 | uniform mat4 vMatrix; 5 | 6 | varying vec2 aCoord; 7 | 8 | void main() { 9 | gl_Position = vPosition; 10 | aCoord = (vMatrix * vCoord).xy; 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/dummy.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef OPENCV_FLANN_DUMMY_H_ 3 | #define OPENCV_FLANN_DUMMY_H_ 4 | 5 | namespace cvflann 6 | { 7 | 8 | CV_DEPRECATED inline void dummyfunc() {} 9 | 10 | } 11 | 12 | 13 | #endif /* OPENCV_FLANN_DUMMY_H_ */ 14 | -------------------------------------------------------------------------------- /app/src/main/res/raw/camera_frag.frag: -------------------------------------------------------------------------------- 1 | #extension GL_OES_EGL_image_external : require 2 | 3 | precision mediump float; 4 | 5 | varying vec2 aCoord; 6 | 7 | uniform samplerExternalOES vTexture; 8 | 9 | void main() { 10 | gl_FragColor = texture2D(vTexture, aCoord); 11 | } 12 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 02 15:35:34 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_btn_circle_red.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg_btn_circle_green.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/FaceAlignment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 2 | 3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") 4 | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") 6 | 7 | include_directories(include) 8 | set(src_files 9 | src/cfan.cpp 10 | src/face_alignment.cpp 11 | src/sift.cpp 12 | ) 13 | 14 | add_library(seeta_fa_lib STATIC ${src_files}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/cpp/FaceAlignment/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 2 | 3 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") 4 | 5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") 6 | 7 | include_directories(include) 8 | set(src_files 9 | src/cfan.cpp 10 | src/face_alignment.cpp 11 | src/sift.cpp 12 | ) 13 | 14 | add_library(seeta_fa_lib STATIC ${src_files}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/cpp/LogUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Tom on 2020/1/30. 3 | // 4 | 5 | #ifndef ANDROID_OPENGL_FILTER_LOGUTILS_H 6 | #define ANDROID_OPENGL_FILTER_LOGUTILS_H 7 | 8 | #ifdef ANDROID 9 | 10 | #include 11 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "filter", __VA_ARGS__) 12 | 13 | 14 | #else 15 | #define LOGD(...) printf("filter", __VA_ARGS_) 16 | 17 | #endif 18 | 19 | #endif //ANDROID_OPENGL_FILTER_LOGUTILS_H 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | add_library( 4 | native-lib 5 | 6 | SHARED 7 | 8 | src/main/cpp/native-lib.cpp 9 | src/main/cpp/FaceTrack.cpp) 10 | 11 | include_directories(src/main/cpp/include) 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}" ) 13 | 14 | add_subdirectory(src/main/cpp/FaceAlignment) 15 | 16 | include_directories(src/main/cpp/FaceAlignment/include) 17 | 18 | target_link_libraries( 19 | native-lib 20 | opencv_java3 21 | seeta_fa_lib 22 | log ) -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/features2d/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_FEATURE2D_HAL_INTERFACE_H 2 | #define OPENCV_FEATURE2D_HAL_INTERFACE_H 3 | 4 | #include "opencv2/core/cvdef.h" 5 | //! @addtogroup featrure2d_hal_interface 6 | //! @{ 7 | 8 | //! @name Fast feature detector types 9 | //! @sa cv::FastFeatureDetector 10 | //! @{ 11 | #define CV_HAL_TYPE_5_8 0 12 | #define CV_HAL_TYPE_7_12 1 13 | #define CV_HAL_TYPE_9_16 2 14 | //! @} 15 | 16 | //! @name Key point 17 | //! @sa cv::KeyPoint 18 | //! @{ 19 | struct CV_EXPORTS cvhalKeyPoint 20 | { 21 | float x; 22 | float y; 23 | float size; 24 | float angle; 25 | float response; 26 | int octave; 27 | int class_id; 28 | }; 29 | //! @} 30 | 31 | //! @} 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/ovx.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2016, Intel Corporation, all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | // OpenVX related definitions and declarations 9 | 10 | #pragma once 11 | #ifndef OPENCV_OVX_HPP 12 | #define OPENCV_OVX_HPP 13 | 14 | #include "cvdef.h" 15 | 16 | namespace cv 17 | { 18 | /// Check if use of OpenVX is possible 19 | CV_EXPORTS_W bool haveOpenVX(); 20 | 21 | /// Check if use of OpenVX is enabled 22 | CV_EXPORTS_W bool useOpenVX(); 23 | 24 | /// Enable/disable use of OpenVX 25 | CV_EXPORTS_W void setUseOpenVX(bool flag); 26 | } // namespace cv 27 | 28 | #endif // OPENCV_OVX_HPP 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/opencv_modules.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ** File generated automatically, do not modify ** 3 | * 4 | * This file defines the list of modules available in current build configuration 5 | * 6 | * 7 | */ 8 | 9 | // This definition means that OpenCV is built with enabled non-free code. 10 | // For example, patented algorithms for non-profit/non-commercial use only. 11 | /* #undef OPENCV_ENABLE_NONFREE */ 12 | 13 | #define HAVE_OPENCV_CALIB3D 14 | #define HAVE_OPENCV_CORE 15 | #define HAVE_OPENCV_DNN 16 | #define HAVE_OPENCV_FEATURES2D 17 | #define HAVE_OPENCV_FLANN 18 | #define HAVE_OPENCV_HIGHGUI 19 | #define HAVE_OPENCV_IMGCODECS 20 | #define HAVE_OPENCV_IMGPROC 21 | #define HAVE_OPENCV_ML 22 | #define HAVE_OPENCV_OBJDETECT 23 | #define HAVE_OPENCV_PHOTO 24 | #define HAVE_OPENCV_SHAPE 25 | #define HAVE_OPENCV_STITCHING 26 | #define HAVE_OPENCV_SUPERRES 27 | #define HAVE_OPENCV_VIDEO 28 | #define HAVE_OPENCV_VIDEOIO 29 | #define HAVE_OPENCV_VIDEOSTAB 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/version.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VERSION_HPP 6 | #define OPENCV_VERSION_HPP 7 | 8 | #define CV_VERSION_MAJOR 3 9 | #define CV_VERSION_MINOR 4 10 | #define CV_VERSION_REVISION 3 11 | #define CV_VERSION_STATUS "" 12 | 13 | #define CVAUX_STR_EXP(__A) #__A 14 | #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) 15 | 16 | #define CVAUX_STRW_EXP(__A) L ## #__A 17 | #define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) 18 | 19 | #define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS 20 | 21 | /* old style version constants*/ 22 | #define CV_MAJOR_VERSION CV_VERSION_MAJOR 23 | #define CV_MINOR_VERSION CV_VERSION_MINOR 24 | #define CV_SUBMINOR_VERSION CV_VERSION_REVISION 25 | 26 | #endif // OPENCV_VERSION_HPP 27 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/bufferpool.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | // 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | 7 | #ifndef OPENCV_CORE_BUFFER_POOL_HPP 8 | #define OPENCV_CORE_BUFFER_POOL_HPP 9 | 10 | #ifdef _MSC_VER 11 | #pragma warning(push) 12 | #pragma warning(disable: 4265) 13 | #endif 14 | 15 | namespace cv 16 | { 17 | 18 | //! @addtogroup core 19 | //! @{ 20 | 21 | class BufferPoolController 22 | { 23 | protected: 24 | ~BufferPoolController() { } 25 | public: 26 | virtual size_t getReservedSize() const = 0; 27 | virtual size_t getMaxReservedSize() const = 0; 28 | virtual void setMaxReservedSize(size_t size) = 0; 29 | virtual void freeAllReservedBuffers() = 0; 30 | }; 31 | 32 | //! @} 33 | 34 | } 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(pop) 38 | #endif 39 | 40 | #endif // OPENCV_CORE_BUFFER_POOL_HPP 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/yeliang/widget/CommonSurfaceView.java: -------------------------------------------------------------------------------- 1 | package com.yeliang.widget; 2 | 3 | import android.content.Context; 4 | import android.opengl.GLSurfaceView; 5 | import android.util.AttributeSet; 6 | import android.view.SurfaceHolder; 7 | 8 | /** 9 | * Author: yeliang 10 | * Date: 2019/12/2 11 | * Time: 7:52 PM 12 | * Description: 13 | */ 14 | 15 | public class CommonSurfaceView extends GLSurfaceView { 16 | 17 | private CommonRender mCommonRender; 18 | 19 | public CommonSurfaceView(Context context, AttributeSet attrs) { 20 | super(context, attrs); 21 | setEGLContextClientVersion(2); 22 | mCommonRender = new CommonRender(this); 23 | setRenderer(mCommonRender); 24 | setRenderMode(RENDERMODE_WHEN_DIRTY); 25 | } 26 | 27 | @Override 28 | public void surfaceDestroyed(SurfaceHolder holder) { 29 | super.surfaceDestroyed(holder); 30 | mCommonRender.onSurfaceDestroyed(); 31 | } 32 | 33 | public CommonRender getRender() { 34 | return mCommonRender; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/yeliang/face/Face.java: -------------------------------------------------------------------------------- 1 | package com.yeliang.face; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * Created by yeliang on 2020/1/16. 7 | */ 8 | 9 | public class Face { 10 | 11 | //保存人脸的关键点坐标 12 | public float[] landmarks; 13 | 14 | //保存人脸宽高 15 | public int width; 16 | public int height; 17 | 18 | //送去检测图片的宽高 19 | public int imgWidth; 20 | public int imgHeight; 21 | 22 | public Face(int width, int height, int imgWidth, int imgHeight,float[] landmarks) { 23 | this.landmarks = landmarks; 24 | this.width = width; 25 | this.height = height; 26 | this.imgWidth = imgWidth; 27 | this.imgHeight = imgHeight; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return "Face{" + 33 | "landmarks=" + Arrays.toString(landmarks) + 34 | ", width=" + width + 35 | ", height=" + height + 36 | ", imgWidth=" + imgWidth + 37 | ", imgHeight=" + imgHeight + 38 | '}'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/utils/logger.defines.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_LOGGER_DEFINES_HPP 6 | #define OPENCV_LOGGER_DEFINES_HPP 7 | 8 | //! @addtogroup core_logging 9 | //! @{ 10 | 11 | // Supported logging levels and their semantic 12 | #define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogLevel() call 13 | #define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error) 14 | #define CV_LOG_LEVEL_ERROR 2 //!< Error message 15 | #define CV_LOG_LEVEL_WARN 3 //!< Warning message 16 | #define CV_LOG_LEVEL_INFO 4 //!< Info message 17 | #define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build. 18 | #define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 19 | 20 | //! @} 21 | 22 | #endif // OPENCV_LOGGER_DEFINES_HPP 23 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/raw/bigeye_frag.glsl: -------------------------------------------------------------------------------- 1 | precision mediump float; 2 | 3 | varying vec2 aCoord; 4 | 5 | uniform sampler2D vTexture; 6 | 7 | uniform vec2 left_eye;//左眼 8 | uniform vec2 right_eye;//右眼 9 | 10 | float fs(float r, float rmax){ 11 | float a = 0.4; 12 | return (1.0 - pow((r / rmax - 1.0), 2.0) * a); 13 | } 14 | //coord:输入采样点 eye:眼睛坐标点 rmax:最大作用半径 15 | //这个方法的目的是重新返回一个采样点的坐标,来实现放大效果 16 | vec2 newCoord(vec2 coord, vec2 eye, float rmax){ 17 | vec2 new_coord = coord; 18 | 19 | //1 算出当前采样点的坐标与眼睛的距离 20 | float r = distance(coord, eye); 21 | 22 | //如果在作用半径范围内 23 | if(r < rmax){ 24 | //2 套用放大公式 即根据 当前采样点与眼睛的距离 和 作用半径 算出一个系数 25 | float fsr = fs(r, rmax); 26 | 27 | //3 用这个系数来求得新坐标点的位置 new_coord - eye = fsr*(coord - eye) 28 | new_coord = fsr * (coord - eye) + eye; 29 | } 30 | 31 | return new_coord; 32 | } 33 | 34 | void main() { 35 | //1 计算放大半径 36 | float rmax = distance(left_eye, right_eye) / 2.0; 37 | 38 | //2.1 计算左眼放大处理后的采样点坐标 39 | vec2 new_coord = newCoord(aCoord, left_eye, rmax); 40 | 41 | //2.2 计算右眼放大处理后的采样点坐标 42 | new_coord = newCoord(new_coord, right_eye, rmax); 43 | 44 | //3 将重新求得的采样点坐标传给片元着色器 45 | gl_FragColor = texture2D(vTexture, new_coord); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/imgproc/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_IMGPROC_HAL_INTERFACE_H 2 | #define OPENCV_IMGPROC_HAL_INTERFACE_H 3 | 4 | //! @addtogroup imgproc_hal_interface 5 | //! @{ 6 | 7 | //! @name Interpolation modes 8 | //! @sa cv::InterpolationFlags 9 | //! @{ 10 | #define CV_HAL_INTER_NEAREST 0 11 | #define CV_HAL_INTER_LINEAR 1 12 | #define CV_HAL_INTER_CUBIC 2 13 | #define CV_HAL_INTER_AREA 3 14 | #define CV_HAL_INTER_LANCZOS4 4 15 | //! @} 16 | 17 | //! @name Morphology operations 18 | //! @sa cv::MorphTypes 19 | //! @{ 20 | #define CV_HAL_MORPH_ERODE 0 21 | #define CV_HAL_MORPH_DILATE 1 22 | //! @} 23 | 24 | //! @name Threshold types 25 | //! @sa cv::ThresholdTypes 26 | //! @{ 27 | #define CV_HAL_THRESH_BINARY 0 28 | #define CV_HAL_THRESH_BINARY_INV 1 29 | #define CV_HAL_THRESH_TRUNC 2 30 | #define CV_HAL_THRESH_TOZERO 3 31 | #define CV_HAL_THRESH_TOZERO_INV 4 32 | #define CV_HAL_THRESH_MASK 7 33 | #define CV_HAL_THRESH_OTSU 8 34 | #define CV_HAL_THRESH_TRIANGLE 16 35 | //! @} 36 | 37 | //! @name Adaptive threshold algorithm 38 | //! @sa cv::AdaptiveThresholdTypes 39 | //! @{ 40 | #define CV_HAL_ADAPTIVE_THRESH_MEAN_C 0 41 | #define CV_HAL_ADAPTIVE_THRESH_GAUSSIAN_C 1 42 | //! @} 43 | 44 | //! @} 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/yeliang/utils/FileUtils.java: -------------------------------------------------------------------------------- 1 | package com.yeliang.utils; 2 | 3 | import android.content.Context; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.io.InputStreamReader; 9 | 10 | /** 11 | * Author: yeliang 12 | * Date: 2019/12/2 13 | * Time: 3:46 PM 14 | * Description: 15 | */ 16 | 17 | public class FileUtils { 18 | 19 | public static String readRawTextFile(Context context, int rawId) { 20 | InputStream inputStream = context.getResources().openRawResource(rawId); 21 | BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); 22 | 23 | String line; 24 | StringBuilder stringBuilder = new StringBuilder(); 25 | 26 | try { 27 | while ((line = bufferedReader.readLine()) != null) { 28 | stringBuilder.append(line); 29 | stringBuilder.append("\n"); 30 | } 31 | } catch (IOException e) { 32 | e.printStackTrace(); 33 | } 34 | 35 | try { 36 | bufferedReader.close(); 37 | } catch (IOException e) { 38 | e.printStackTrace(); 39 | } 40 | 41 | return stringBuilder.toString(); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | defaultConfig { 6 | applicationId "com.yeliang" 7 | minSdkVersion 21 8 | targetSdkVersion 26 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | externalNativeBuild { 13 | cmake { 14 | arguments "-DANDROID_STL=gnustl_static" 15 | cppFlags "-std=c++11" 16 | abiFilters "armeabi-v7a" 17 | } 18 | 19 | } 20 | } 21 | buildTypes { 22 | release { 23 | postprocessing { 24 | removeUnusedCode false 25 | removeUnusedResources false 26 | obfuscate false 27 | optimizeCode false 28 | proguardFile 'proguard-rules.pro' 29 | } 30 | } 31 | } 32 | externalNativeBuild { 33 | cmake { 34 | path "CMakeLists.txt" 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation fileTree(dir: 'libs', include: ['*.jar']) 41 | implementation 'com.android.support:appcompat-v7:26.1.0' 42 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #if defined(CL_VERSION_2_0) 8 | 9 | // OpenCL 2.0 contains SVM definitions 10 | 11 | #else 12 | 13 | typedef cl_bitfield cl_device_svm_capabilities; 14 | typedef cl_bitfield cl_svm_mem_flags; 15 | typedef cl_uint cl_kernel_exec_info; 16 | 17 | // 18 | // TODO Add real values after OpenCL 2.0 release 19 | // 20 | 21 | #ifndef CL_DEVICE_SVM_CAPABILITIES 22 | #define CL_DEVICE_SVM_CAPABILITIES 0x1053 23 | 24 | #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0) 25 | #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1) 26 | #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2) 27 | #define CL_DEVICE_SVM_ATOMICS (1 << 3) 28 | #endif 29 | 30 | #ifndef CL_MEM_SVM_FINE_GRAIN_BUFFER 31 | #define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10) 32 | #endif 33 | 34 | #ifndef CL_MEM_SVM_ATOMICS 35 | #define CL_MEM_SVM_ATOMICS (1 << 11) 36 | #endif 37 | 38 | 39 | #endif // CL_VERSION_2_0 40 | #endif // HAVE_OPENCL_SVM 41 | 42 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 43 | -------------------------------------------------------------------------------- /app/src/main/cpp/FaceTrack.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 叶亮 on 2020/1/16. 3 | // 4 | 5 | #ifndef ANDROID_OPENGL_FILTER_FACETRACK_H 6 | #define ANDROID_OPENGL_FILTER_FACETRACK_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace std; 14 | using namespace cv; 15 | 16 | class CascadeDetectorAdapter : public DetectionBasedTracker :: IDetector{ 17 | public: 18 | CascadeDetectorAdapter(Ptr detector):IDetector(),Detector(detector){ 19 | CV_Assert(detector); 20 | } 21 | 22 | void detect(const cv::Mat & Image, std::vector &objects){ 23 | Detector->detectMultiScale(Image, objects, scaleFactor, minNeighbours, 0 ,minObjSize, maxObjSize); 24 | } 25 | 26 | virtual ~CascadeDetectorAdapter(){} 27 | 28 | private: 29 | CascadeDetectorAdapter(); 30 | Ptr Detector; 31 | }; 32 | 33 | class FaceTrack { 34 | public: 35 | FaceTrack(const char * model, const char * seeta); 36 | 37 | void detector(Mat src, vector &rects); 38 | 39 | void startTracking(); 40 | 41 | void stopTracking(); 42 | 43 | private: 44 | Ptr tracker; 45 | Ptr faceAlignment; 46 | }; 47 | 48 | 49 | #endif //ANDROID_OPENGL_FILTER_FACETRACK_H 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/yeliang/filter/ScreenFilter.java: -------------------------------------------------------------------------------- 1 | package com.yeliang.filter; 2 | 3 | import android.content.Context; 4 | import android.opengl.GLES20; 5 | 6 | import com.yeliang.R; 7 | 8 | /** 9 | * Author: yeliang 10 | * Date: 2019/12/7 11 | * Time: 5:11 PM 12 | * Description: 13 | */ 14 | 15 | public class ScreenFilter extends BaseFilter { 16 | public ScreenFilter(Context context) { 17 | super(context, R.raw.screen_vertex, R.raw.screen_frag); 18 | } 19 | 20 | @Override 21 | public int onDrawFrame(int textureId) { 22 | //1 设置窗口大小 23 | GLES20.glViewport(0, 0, mOutputWidth, mOutputHeight); 24 | 25 | //2 使用着色器 26 | GLES20.glUseProgram(mGLProgramId); 27 | 28 | 29 | //3.1 传递顶点坐标 30 | mGLVertexBuffer.position(0); 31 | GLES20.glVertexAttribPointer(vPosition, 2, GLES20.GL_FLOAT, false, 0, mGLVertexBuffer); 32 | GLES20.glEnableVertexAttribArray(vPosition); 33 | 34 | //3.2 传递纹理坐标 35 | mGLTextureBuffer.position(0); 36 | GLES20.glVertexAttribPointer(vCoord, 2, GLES20.GL_FLOAT, false, 0, mGLTextureBuffer); 37 | GLES20.glEnableVertexAttribArray(vCoord); 38 | 39 | //4 激活纹理 40 | GLES20.glActiveTexture(GLES20.GL_TEXTURE0); 41 | 42 | //5 解绑 43 | GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId); 44 | GLES20.glUniform1i(vTexture, 0); 45 | 46 | //6 绘制 47 | GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); 48 | return textureId; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/videoio/registry.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VIDEOIO_REGISTRY_HPP 6 | #define OPENCV_VIDEOIO_REGISTRY_HPP 7 | 8 | #include 9 | 10 | namespace cv { namespace videoio_registry { 11 | /** @addtogroup videoio_registry 12 | This section contains API description how to query/configure available Video I/O backends. 13 | 14 | Runtime configuration options: 15 | - enable debug mode: `OPENCV_VIDEOIO_DEBUG=1` 16 | - change backend priority: `OPENCV_VIDEOIO_PRIORITY_=9999` 17 | - disable backend: `OPENCV_VIDEOIO_PRIORITY_=0` 18 | - specify list of backends with high priority (>100000): `OPENCV_VIDEOIO_PRIORITY_LIST=FFMPEG,GSTREAMER` 19 | 20 | @{ 21 | */ 22 | 23 | 24 | /** @brief Returns backend API name or "unknown" 25 | @param api backend ID (#VideoCaptureAPIs) 26 | */ 27 | CV_EXPORTS_W cv::String getBackendName(VideoCaptureAPIs api); 28 | 29 | /** @brief Returns list of all builtin backends */ 30 | CV_EXPORTS_W std::vector getBackends(); 31 | 32 | /** @brief Returns list of available backends which works via `cv::VideoCapture(int index)` */ 33 | CV_EXPORTS_W std::vector getCameraBackends(); 34 | 35 | /** @brief Returns list of available backends which works via `cv::VideoCapture(filename)` */ 36 | CV_EXPORTS_W std::vector getStreamBackends(); 37 | 38 | /** @brief Returns list of available backends which works via `cv::VideoWriter()` */ 39 | CV_EXPORTS_W std::vector getWriterBackends(); 40 | 41 | //! @} 42 | }} // namespace 43 | 44 | #endif // OPENCV_VIDEOIO_REGISTRY_HPP 45 | -------------------------------------------------------------------------------- /app/src/main/cpp/FaceTrack.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by 叶亮 on 2020/1/16. 3 | // 4 | 5 | #include "FaceTrack.h" 6 | 7 | 8 | FaceTrack::FaceTrack(const char *model, const char *seeta) { 9 | Ptr mainDetector = makePtr(makePtr(model)); 10 | Ptr trackingDetector = makePtr(makePtr(model)); 11 | DetectionBasedTracker::Parameters detectorParams; 12 | 13 | //追踪器 14 | tracker = makePtr(mainDetector, trackingDetector, detectorParams); 15 | 16 | faceAlignment = makePtr(seeta); 17 | } 18 | 19 | //开启追踪器 20 | void FaceTrack::startTracking() { 21 | tracker->run(); 22 | } 23 | 24 | //关闭追踪器 25 | void FaceTrack::stopTracking() { 26 | tracker->stop(); 27 | } 28 | 29 | void FaceTrack::detector(Mat src, vector &rects) { 30 | vector faces; 31 | 32 | tracker->process(src); 33 | tracker->getObjects(faces); 34 | 35 | if(faces.size()){ 36 | Rect face = faces[0]; 37 | rects.push_back(Rect2f(face.x, face.y, face.width, face.height)); 38 | 39 | //关键点定位 40 | //保存5个关键点坐标 41 | //0:左眼 1:右眼 2:鼻头 3:嘴巴左 4:嘴巴右 42 | seeta::FacialLandmark points[5]; 43 | 44 | //图像数据 45 | seeta::ImageData image_data(src.cols, src.rows); 46 | image_data.data = src.data; 47 | 48 | //指定人脸部位 49 | seeta::FaceInfo faceInfo; 50 | seeta::Rect bbox; 51 | 52 | bbox.x = face.x; 53 | bbox.y = face.y; 54 | bbox.width = face.width; 55 | bbox.height = face.height; 56 | faceInfo.bbox = bbox; 57 | 58 | faceAlignment->PointDetectLandmarks(image_data,faceInfo, points); 59 | 60 | for(int i =0; i<5; ++i){ 61 | rects.push_back(Rect2f(points[i].x, points[i].y, 0, 0)); 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/config.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2011 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2011 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | *************************************************************************/ 28 | 29 | 30 | #ifndef OPENCV_FLANN_CONFIG_H_ 31 | #define OPENCV_FLANN_CONFIG_H_ 32 | 33 | #ifdef FLANN_VERSION_ 34 | #undef FLANN_VERSION_ 35 | #endif 36 | #define FLANN_VERSION_ "1.6.10" 37 | 38 | #endif /* OPENCV_FLANN_CONFIG_H_ */ 39 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/ml/ml.inl.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_ML_INL_HPP 6 | #define OPENCV_ML_INL_HPP 7 | 8 | namespace cv { namespace ml { 9 | 10 | // declared in ml.hpp 11 | template 12 | int simulatedAnnealingSolver(SimulatedAnnealingSolverSystem& solverSystem, 13 | double initialTemperature, double finalTemperature, double coolingRatio, 14 | size_t iterationsPerStep, 15 | CV_OUT double* lastTemperature, 16 | cv::RNG& rngEnergy 17 | ) 18 | { 19 | CV_Assert(finalTemperature > 0); 20 | CV_Assert(initialTemperature > finalTemperature); 21 | CV_Assert(iterationsPerStep > 0); 22 | CV_Assert(coolingRatio < 1.0f); 23 | double Ti = initialTemperature; 24 | double previousEnergy = solverSystem.energy(); 25 | int exchange = 0; 26 | while (Ti > finalTemperature) 27 | { 28 | for (size_t i = 0; i < iterationsPerStep; i++) 29 | { 30 | solverSystem.changeState(); 31 | double newEnergy = solverSystem.energy(); 32 | if (newEnergy < previousEnergy) 33 | { 34 | previousEnergy = newEnergy; 35 | exchange++; 36 | } 37 | else 38 | { 39 | double r = rngEnergy.uniform(0.0, 1.0); 40 | if (r < std::exp(-(newEnergy - previousEnergy) / Ti)) 41 | { 42 | previousEnergy = newEnergy; 43 | exchange++; 44 | } 45 | else 46 | { 47 | solverSystem.reverseState(); 48 | } 49 | } 50 | } 51 | Ti *= coolingRatio; 52 | } 53 | if (lastTemperature) 54 | *lastTemperature = Ti; 55 | return exchange; 56 | } 57 | 58 | }} //namespace 59 | 60 | #endif // OPENCV_ML_INL_HPP 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 |