├── .gitignore ├── .idea ├── encodings.xml ├── gradle.xml ├── misc.xml └── runConfigurations.xml ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yu │ │ └── opencvdemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── assets │ │ └── lbpcascade_frontalface.xml │ ├── cpp │ │ ├── CMakeLists.txt │ │ ├── include │ │ │ └── opencv2 │ │ │ │ ├── calib3d.hpp │ │ │ │ ├── calib3d │ │ │ │ ├── calib3d.hpp │ │ │ │ └── calib3d_c.h │ │ │ │ ├── core.hpp │ │ │ │ ├── core │ │ │ │ ├── affine.hpp │ │ │ │ ├── base.hpp │ │ │ │ ├── bindings_utils.hpp │ │ │ │ ├── bufferpool.hpp │ │ │ │ ├── check.hpp │ │ │ │ ├── core.hpp │ │ │ │ ├── core_c.h │ │ │ │ ├── cuda.hpp │ │ │ │ ├── cuda.inl.hpp │ │ │ │ ├── cuda │ │ │ │ │ ├── block.hpp │ │ │ │ │ ├── border_interpolate.hpp │ │ │ │ │ ├── color.hpp │ │ │ │ │ ├── common.hpp │ │ │ │ │ ├── datamov_utils.hpp │ │ │ │ │ ├── detail │ │ │ │ │ │ ├── color_detail.hpp │ │ │ │ │ │ ├── reduce.hpp │ │ │ │ │ │ ├── reduce_key_val.hpp │ │ │ │ │ │ ├── transform_detail.hpp │ │ │ │ │ │ ├── type_traits_detail.hpp │ │ │ │ │ │ └── vec_distance_detail.hpp │ │ │ │ │ ├── dynamic_smem.hpp │ │ │ │ │ ├── emulation.hpp │ │ │ │ │ ├── filters.hpp │ │ │ │ │ ├── funcattrib.hpp │ │ │ │ │ ├── functional.hpp │ │ │ │ │ ├── limits.hpp │ │ │ │ │ ├── reduce.hpp │ │ │ │ │ ├── saturate_cast.hpp │ │ │ │ │ ├── scan.hpp │ │ │ │ │ ├── simd_functions.hpp │ │ │ │ │ ├── transform.hpp │ │ │ │ │ ├── type_traits.hpp │ │ │ │ │ ├── utility.hpp │ │ │ │ │ ├── vec_distance.hpp │ │ │ │ │ ├── vec_math.hpp │ │ │ │ │ ├── vec_traits.hpp │ │ │ │ │ ├── warp.hpp │ │ │ │ │ ├── warp_reduce.hpp │ │ │ │ │ └── warp_shuffle.hpp │ │ │ │ ├── cuda_stream_accessor.hpp │ │ │ │ ├── cuda_types.hpp │ │ │ │ ├── cv_cpu_dispatch.h │ │ │ │ ├── cv_cpu_helper.h │ │ │ │ ├── cvdef.h │ │ │ │ ├── cvstd.hpp │ │ │ │ ├── cvstd.inl.hpp │ │ │ │ ├── cvstd_wrapper.hpp │ │ │ │ ├── directx.hpp │ │ │ │ ├── eigen.hpp │ │ │ │ ├── fast_math.hpp │ │ │ │ ├── hal │ │ │ │ │ ├── hal.hpp │ │ │ │ │ ├── interface.h │ │ │ │ │ ├── intrin.hpp │ │ │ │ │ ├── intrin_avx.hpp │ │ │ │ │ ├── intrin_cpp.hpp │ │ │ │ │ ├── intrin_forward.hpp │ │ │ │ │ ├── intrin_neon.hpp │ │ │ │ │ ├── intrin_sse.hpp │ │ │ │ │ ├── intrin_sse_em.hpp │ │ │ │ │ └── intrin_vsx.hpp │ │ │ │ ├── mat.hpp │ │ │ │ ├── mat.inl.hpp │ │ │ │ ├── matx.hpp │ │ │ │ ├── neon_utils.hpp │ │ │ │ ├── ocl.hpp │ │ │ │ ├── ocl_genbase.hpp │ │ │ │ ├── opencl │ │ │ │ │ ├── ocl_defs.hpp │ │ │ │ │ ├── opencl_info.hpp │ │ │ │ │ ├── opencl_svm.hpp │ │ │ │ │ └── runtime │ │ │ │ │ │ ├── autogenerated │ │ │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ │ │ ├── opencl_core.hpp │ │ │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ │ │ ├── opencl_gl.hpp │ │ │ │ │ │ └── opencl_gl_wrappers.hpp │ │ │ │ │ │ ├── opencl_clamdblas.hpp │ │ │ │ │ │ ├── opencl_clamdfft.hpp │ │ │ │ │ │ ├── opencl_core.hpp │ │ │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ │ │ ├── opencl_gl.hpp │ │ │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ │ │ ├── opencl_svm_20.hpp │ │ │ │ │ │ ├── opencl_svm_definitions.hpp │ │ │ │ │ │ └── opencl_svm_hsa_extension.hpp │ │ │ │ ├── opengl.hpp │ │ │ │ ├── operations.hpp │ │ │ │ ├── optim.hpp │ │ │ │ ├── ovx.hpp │ │ │ │ ├── persistence.hpp │ │ │ │ ├── saturate.hpp │ │ │ │ ├── softfloat.hpp │ │ │ │ ├── sse_utils.hpp │ │ │ │ ├── traits.hpp │ │ │ │ ├── types.hpp │ │ │ │ ├── types_c.h │ │ │ │ ├── utility.hpp │ │ │ │ ├── utils │ │ │ │ │ ├── filesystem.hpp │ │ │ │ │ ├── logger.defines.hpp │ │ │ │ │ ├── logger.hpp │ │ │ │ │ └── trace.hpp │ │ │ │ ├── va_intel.hpp │ │ │ │ ├── version.hpp │ │ │ │ └── vsx_utils.hpp │ │ │ │ ├── cvconfig.h │ │ │ │ ├── dnn.hpp │ │ │ │ ├── dnn │ │ │ │ ├── all_layers.hpp │ │ │ │ ├── dict.hpp │ │ │ │ ├── dnn.hpp │ │ │ │ ├── dnn.inl.hpp │ │ │ │ ├── layer.details.hpp │ │ │ │ ├── layer.hpp │ │ │ │ ├── shape_utils.hpp │ │ │ │ ├── utils │ │ │ │ │ └── inference_engine.hpp │ │ │ │ └── version.hpp │ │ │ │ ├── features2d.hpp │ │ │ │ ├── features2d │ │ │ │ ├── features2d.hpp │ │ │ │ └── hal │ │ │ │ │ └── interface.h │ │ │ │ ├── flann.hpp │ │ │ │ ├── flann │ │ │ │ ├── all_indices.h │ │ │ │ ├── allocator.h │ │ │ │ ├── any.h │ │ │ │ ├── autotuned_index.h │ │ │ │ ├── composite_index.h │ │ │ │ ├── config.h │ │ │ │ ├── defines.h │ │ │ │ ├── dist.h │ │ │ │ ├── dummy.h │ │ │ │ ├── dynamic_bitset.h │ │ │ │ ├── flann.hpp │ │ │ │ ├── flann_base.hpp │ │ │ │ ├── general.h │ │ │ │ ├── ground_truth.h │ │ │ │ ├── heap.h │ │ │ │ ├── hierarchical_clustering_index.h │ │ │ │ ├── index_testing.h │ │ │ │ ├── kdtree_index.h │ │ │ │ ├── kdtree_single_index.h │ │ │ │ ├── kmeans_index.h │ │ │ │ ├── linear_index.h │ │ │ │ ├── logger.h │ │ │ │ ├── lsh_index.h │ │ │ │ ├── lsh_table.h │ │ │ │ ├── matrix.h │ │ │ │ ├── miniflann.hpp │ │ │ │ ├── nn_index.h │ │ │ │ ├── object_factory.h │ │ │ │ ├── params.h │ │ │ │ ├── random.h │ │ │ │ ├── result_set.h │ │ │ │ ├── sampling.h │ │ │ │ ├── saving.h │ │ │ │ ├── simplex_downhill.h │ │ │ │ └── timer.h │ │ │ │ ├── highgui.hpp │ │ │ │ ├── highgui │ │ │ │ ├── highgui.hpp │ │ │ │ └── highgui_c.h │ │ │ │ ├── imgcodecs.hpp │ │ │ │ ├── imgcodecs │ │ │ │ ├── imgcodecs.hpp │ │ │ │ ├── imgcodecs_c.h │ │ │ │ ├── ios.h │ │ │ │ └── legacy │ │ │ │ │ └── constants_c.h │ │ │ │ ├── imgproc.hpp │ │ │ │ ├── imgproc │ │ │ │ ├── detail │ │ │ │ │ └── gcgraph.hpp │ │ │ │ ├── hal │ │ │ │ │ ├── hal.hpp │ │ │ │ │ └── interface.h │ │ │ │ ├── imgproc.hpp │ │ │ │ ├── imgproc_c.h │ │ │ │ └── types_c.h │ │ │ │ ├── ml.hpp │ │ │ │ ├── ml │ │ │ │ ├── ml.hpp │ │ │ │ └── ml.inl.hpp │ │ │ │ ├── objdetect.hpp │ │ │ │ ├── objdetect │ │ │ │ ├── detection_based_tracker.hpp │ │ │ │ └── objdetect.hpp │ │ │ │ ├── opencv.hpp │ │ │ │ ├── opencv_modules.hpp │ │ │ │ ├── photo.hpp │ │ │ │ ├── photo │ │ │ │ ├── cuda.hpp │ │ │ │ ├── legacy │ │ │ │ │ └── constants_c.h │ │ │ │ └── photo.hpp │ │ │ │ ├── stitching.hpp │ │ │ │ ├── stitching │ │ │ │ ├── detail │ │ │ │ │ ├── autocalib.hpp │ │ │ │ │ ├── blenders.hpp │ │ │ │ │ ├── camera.hpp │ │ │ │ │ ├── exposure_compensate.hpp │ │ │ │ │ ├── matchers.hpp │ │ │ │ │ ├── motion_estimators.hpp │ │ │ │ │ ├── seam_finders.hpp │ │ │ │ │ ├── timelapsers.hpp │ │ │ │ │ ├── util.hpp │ │ │ │ │ ├── util_inl.hpp │ │ │ │ │ ├── warpers.hpp │ │ │ │ │ └── warpers_inl.hpp │ │ │ │ └── warpers.hpp │ │ │ │ ├── video.hpp │ │ │ │ ├── video │ │ │ │ ├── background_segm.hpp │ │ │ │ ├── legacy │ │ │ │ │ └── constants_c.h │ │ │ │ ├── tracking.hpp │ │ │ │ └── video.hpp │ │ │ │ ├── videoio.hpp │ │ │ │ └── videoio │ │ │ │ ├── cap_ios.h │ │ │ │ ├── legacy │ │ │ │ └── constants_c.h │ │ │ │ ├── registry.hpp │ │ │ │ ├── videoio.hpp │ │ │ │ └── videoio_c.h │ │ ├── libs │ │ │ └── armeabi-v7a │ │ │ │ └── libopencv_java4.so │ │ └── native-lib.cpp │ ├── java │ │ └── com │ │ │ └── yu │ │ │ └── opencvdemo │ │ │ ├── MainActivity.java │ │ │ ├── OpencvJni.java │ │ │ └── util │ │ │ ├── CameraHelper.java │ │ │ └── Utils.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.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 │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── yu │ └── opencvdemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "com.yu.opencvdemo" 7 | minSdkVersion 21 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | externalNativeBuild { 13 | cmake { 14 | cppFlags "" 15 | abiFilters 'armeabi-v7a' 16 | } 17 | } 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | externalNativeBuild { 26 | cmake { 27 | path "src/main/cpp/CMakeLists.txt" 28 | version "3.10.2" 29 | } 30 | } 31 | 32 | sourceSets { 33 | main { 34 | jniLibs.srcDirs = ['src/main/cpp/libs'] 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | implementation fileTree(dir: 'libs', include: ['*.jar']) 41 | implementation 'com.android.support:appcompat-v7:28.0.0' 42 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 43 | testImplementation 'junit:junit:4.12' 44 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 45 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 46 | } 47 | -------------------------------------------------------------------------------- /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/androidTest/java/com/yu/opencvdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.yu.opencvdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.yu.opencvdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required(VERSION 3.4.1) 3 | 4 | 5 | add_library( 6 | native-lib 7 | 8 | SHARED 9 | 10 | native-lib.cpp) 11 | 12 | #导入头文件 13 | include_directories(include) 14 | 15 | #导入库文件 16 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/libs/${ANDROID_ABI}") 17 | 18 | find_library( 19 | log-lib 20 | 21 | log) 22 | 23 | 24 | target_link_libraries( 25 | native-lib 26 | 27 | opencv_java4 28 | 29 | android 30 | 31 | ${log-lib}) -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/calib3d/calib3d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/calib3d.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/bindings_utils.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_CORE_BINDINGS_UTILS_HPP 6 | #define OPENCV_CORE_BINDINGS_UTILS_HPP 7 | 8 | namespace cv { namespace utils { 9 | //! @addtogroup core_utils 10 | //! @{ 11 | 12 | CV_EXPORTS_W String dumpInputArray(InputArray argument); 13 | 14 | CV_EXPORTS_W String dumpInputArrayOfArrays(InputArrayOfArrays argument); 15 | 16 | CV_EXPORTS_W String dumpInputOutputArray(InputOutputArray argument); 17 | 18 | CV_EXPORTS_W String dumpInputOutputArrayOfArrays(InputOutputArrayOfArrays argument); 19 | 20 | //! @} 21 | }} // namespace 22 | 23 | #endif // OPENCV_CORE_BINDINGS_UTILS_HPP 24 | -------------------------------------------------------------------------------- /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/cpp/include/opencv2/core/core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/core.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda/common.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_COMMON_HPP 44 | #define OPENCV_CUDA_COMMON_HPP 45 | 46 | #include 47 | #include "opencv2/core/cuda_types.hpp" 48 | #include "opencv2/core/cvdef.h" 49 | #include "opencv2/core/base.hpp" 50 | 51 | /** @file 52 | * @deprecated Use @ref cudev instead. 53 | */ 54 | 55 | //! @cond IGNORED 56 | 57 | #ifndef CV_PI_F 58 | #ifndef CV_PI 59 | #define CV_PI_F 3.14159265f 60 | #else 61 | #define CV_PI_F ((float)CV_PI) 62 | #endif 63 | #endif 64 | 65 | namespace cv { namespace cuda { 66 | static inline void checkCudaError(cudaError_t err, const char* file, const int line, const char* func) 67 | { 68 | if (cudaSuccess != err) 69 | cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line); 70 | } 71 | }} 72 | 73 | #ifndef cudaSafeCall 74 | #define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func) 75 | #endif 76 | 77 | namespace cv { namespace cuda 78 | { 79 | template static inline bool isAligned(const T* ptr, size_t size) 80 | { 81 | return reinterpret_cast(ptr) % size == 0; 82 | } 83 | 84 | static inline bool isAligned(size_t step, size_t size) 85 | { 86 | return step % size == 0; 87 | } 88 | }} 89 | 90 | namespace cv { namespace cuda 91 | { 92 | namespace device 93 | { 94 | __host__ __device__ __forceinline__ int divUp(int total, int grain) 95 | { 96 | return (total + grain - 1) / grain; 97 | } 98 | 99 | template inline void bindTexture(const textureReference* tex, const PtrStepSz& img) 100 | { 101 | cudaChannelFormatDesc desc = cudaCreateChannelDesc(); 102 | cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) ); 103 | } 104 | } 105 | }} 106 | 107 | //! @endcond 108 | 109 | #endif // OPENCV_CUDA_COMMON_HPP 110 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda/dynamic_smem.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DYNAMIC_SMEM_HPP 44 | #define OPENCV_CUDA_DYNAMIC_SMEM_HPP 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template struct DynamicSharedMem 55 | { 56 | __device__ __forceinline__ operator T*() 57 | { 58 | extern __shared__ int __smem[]; 59 | return (T*)__smem; 60 | } 61 | 62 | __device__ __forceinline__ operator const T*() const 63 | { 64 | extern __shared__ int __smem[]; 65 | return (T*)__smem; 66 | } 67 | }; 68 | 69 | // specialize for double to avoid unaligned memory access compile errors 70 | template<> struct DynamicSharedMem 71 | { 72 | __device__ __forceinline__ operator double*() 73 | { 74 | extern __shared__ double __smem_d[]; 75 | return (double*)__smem_d; 76 | } 77 | 78 | __device__ __forceinline__ operator const double*() const 79 | { 80 | extern __shared__ double __smem_d[]; 81 | return (double*)__smem_d; 82 | } 83 | }; 84 | }}} 85 | 86 | //! @endcond 87 | 88 | #endif // OPENCV_CUDA_DYNAMIC_SMEM_HPP 89 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda/funcattrib.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 44 | #define OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 45 | 46 | #include 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | template 57 | void printFuncAttrib(Func& func) 58 | { 59 | 60 | cudaFuncAttributes attrs; 61 | cudaFuncGetAttributes(&attrs, func); 62 | 63 | printf("=== Function stats ===\n"); 64 | printf("Name: \n"); 65 | printf("sharedSizeBytes = %d\n", attrs.sharedSizeBytes); 66 | printf("constSizeBytes = %d\n", attrs.constSizeBytes); 67 | printf("localSizeBytes = %d\n", attrs.localSizeBytes); 68 | printf("maxThreadsPerBlock = %d\n", attrs.maxThreadsPerBlock); 69 | printf("numRegs = %d\n", attrs.numRegs); 70 | printf("ptxVersion = %d\n", attrs.ptxVersion); 71 | printf("binaryVersion = %d\n", attrs.binaryVersion); 72 | printf("\n"); 73 | fflush(stdout); 74 | } 75 | }}} // namespace cv { namespace cuda { namespace cudev 76 | 77 | //! @endcond 78 | 79 | #endif /* OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP */ 80 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda/transform.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_TRANSFORM_HPP 44 | #define OPENCV_CUDA_TRANSFORM_HPP 45 | 46 | #include "common.hpp" 47 | #include "utility.hpp" 48 | #include "detail/transform_detail.hpp" 49 | 50 | /** @file 51 | * @deprecated Use @ref cudev instead. 52 | */ 53 | 54 | //! @cond IGNORED 55 | 56 | namespace cv { namespace cuda { namespace device 57 | { 58 | template 59 | static inline void transform(PtrStepSz src, PtrStepSz dst, UnOp op, const Mask& mask, cudaStream_t stream) 60 | { 61 | typedef TransformFunctorTraits ft; 62 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src, dst, op, mask, stream); 63 | } 64 | 65 | template 66 | static inline void transform(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, const Mask& mask, cudaStream_t stream) 67 | { 68 | typedef TransformFunctorTraits ft; 69 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src1, src2, dst, op, mask, stream); 70 | } 71 | }}} 72 | 73 | //! @endcond 74 | 75 | #endif // OPENCV_CUDA_TRANSFORM_HPP 76 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda/warp_reduce.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_WARP_REDUCE_HPP__ 44 | #define OPENCV_CUDA_WARP_REDUCE_HPP__ 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template 55 | __device__ __forceinline__ T warp_reduce(volatile T *ptr , const unsigned int tid = threadIdx.x) 56 | { 57 | const unsigned int lane = tid & 31; // index of thread in warp (0..31) 58 | 59 | if (lane < 16) 60 | { 61 | T partial = ptr[tid]; 62 | 63 | ptr[tid] = partial = partial + ptr[tid + 16]; 64 | ptr[tid] = partial = partial + ptr[tid + 8]; 65 | ptr[tid] = partial = partial + ptr[tid + 4]; 66 | ptr[tid] = partial = partial + ptr[tid + 2]; 67 | ptr[tid] = partial = partial + ptr[tid + 1]; 68 | } 69 | 70 | return ptr[tid - lane]; 71 | } 72 | }}} // namespace cv { namespace cuda { namespace cudev { 73 | 74 | //! @endcond 75 | 76 | #endif /* OPENCV_CUDA_WARP_REDUCE_HPP__ */ 77 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/cuda_stream_accessor.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 44 | #define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 45 | 46 | #ifndef __cplusplus 47 | # error cuda_stream_accessor.hpp header must be compiled as C++ 48 | #endif 49 | 50 | /** @file cuda_stream_accessor.hpp 51 | * This is only header file that depends on CUDA Runtime API. All other headers are independent. 52 | */ 53 | 54 | #include 55 | #include "opencv2/core/cuda.hpp" 56 | 57 | namespace cv 58 | { 59 | namespace cuda 60 | { 61 | 62 | //! @addtogroup cudacore_struct 63 | //! @{ 64 | 65 | /** @brief Class that enables getting cudaStream_t from cuda::Stream 66 | */ 67 | struct StreamAccessor 68 | { 69 | CV_EXPORTS static cudaStream_t getStream(const Stream& stream); 70 | CV_EXPORTS static Stream wrapStream(cudaStream_t stream); 71 | }; 72 | 73 | /** @brief Class that enables getting cudaEvent_t from cuda::Event 74 | */ 75 | struct EventAccessor 76 | { 77 | CV_EXPORTS static cudaEvent_t getEvent(const Event& event); 78 | CV_EXPORTS static Event wrapEvent(cudaEvent_t event); 79 | }; 80 | 81 | //! @} 82 | 83 | } 84 | } 85 | 86 | #endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */ 87 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/ocl_genbase.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_OPENCL_GENBASE_HPP 43 | #define OPENCV_OPENCL_GENBASE_HPP 44 | 45 | //! @cond IGNORED 46 | 47 | namespace cv { 48 | namespace ocl { 49 | 50 | class ProgramSource; 51 | 52 | namespace internal { 53 | 54 | struct CV_EXPORTS ProgramEntry 55 | { 56 | const char* module; 57 | const char* name; 58 | const char* programCode; 59 | const char* programHash; 60 | ProgramSource* pProgramSource; 61 | 62 | operator ProgramSource& () const; 63 | }; 64 | 65 | } } } // namespace 66 | 67 | //! @endcond 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/ocl_defs.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 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_OPENCL_DEFS_HPP 9 | #define OPENCV_CORE_OPENCL_DEFS_HPP 10 | 11 | #include "opencv2/core/utility.hpp" 12 | #include "cvconfig.h" 13 | 14 | namespace cv { namespace ocl { 15 | #ifdef HAVE_OPENCL 16 | /// Call is similar to useOpenCL() but doesn't try to load OpenCL runtime or create OpenCL context 17 | CV_EXPORTS bool isOpenCLActivated(); 18 | #else 19 | static inline bool isOpenCLActivated() { return false; } 20 | #endif 21 | }} // namespace 22 | 23 | 24 | //#define CV_OPENCL_RUN_ASSERT 25 | 26 | #ifdef HAVE_OPENCL 27 | 28 | #ifdef CV_OPENCL_RUN_VERBOSE 29 | #define CV_OCL_RUN_(condition, func, ...) \ 30 | { \ 31 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 32 | { \ 33 | printf("%s: OpenCL implementation is running\n", CV_Func); \ 34 | fflush(stdout); \ 35 | CV_IMPL_ADD(CV_IMPL_OCL); \ 36 | return __VA_ARGS__; \ 37 | } \ 38 | else \ 39 | { \ 40 | printf("%s: Plain implementation is running\n", CV_Func); \ 41 | fflush(stdout); \ 42 | } \ 43 | } 44 | #elif defined CV_OPENCL_RUN_ASSERT 45 | #define CV_OCL_RUN_(condition, func, ...) \ 46 | { \ 47 | if (cv::ocl::isOpenCLActivated() && (condition)) \ 48 | { \ 49 | if(func) \ 50 | { \ 51 | CV_IMPL_ADD(CV_IMPL_OCL); \ 52 | } \ 53 | else \ 54 | { \ 55 | CV_Error(cv::Error::StsAssert, #func); \ 56 | } \ 57 | return __VA_ARGS__; \ 58 | } \ 59 | } 60 | #else 61 | #define CV_OCL_RUN_(condition, func, ...) \ 62 | try \ 63 | { \ 64 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 65 | { \ 66 | CV_IMPL_ADD(CV_IMPL_OCL); \ 67 | return __VA_ARGS__; \ 68 | } \ 69 | } \ 70 | catch (const cv::Exception& e) \ 71 | { \ 72 | CV_UNUSED(e); /* TODO: Add some logging here */ \ 73 | } 74 | #endif 75 | 76 | #else 77 | #define CV_OCL_RUN_(condition, func, ...) 78 | #endif 79 | 80 | #define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func) 81 | 82 | #endif // OPENCV_CORE_OPENCL_DEFS_HPP 83 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/opencl_svm.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OPENCL_SVM_HPP 4 | #define OPENCV_CORE_OPENCL_SVM_HPP 5 | 6 | // 7 | // Internal usage only (binary compatibility is not guaranteed) 8 | // 9 | #ifndef __OPENCV_BUILD 10 | #error Internal header file 11 | #endif 12 | 13 | #if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM) 14 | #include "runtime/opencl_core.hpp" 15 | #include "runtime/opencl_svm_20.hpp" 16 | #include "runtime/opencl_svm_hsa_extension.hpp" 17 | 18 | namespace cv { namespace ocl { namespace svm { 19 | 20 | struct SVMCapabilities 21 | { 22 | enum Value 23 | { 24 | SVM_COARSE_GRAIN_BUFFER = (1 << 0), 25 | SVM_FINE_GRAIN_BUFFER = (1 << 1), 26 | SVM_FINE_GRAIN_SYSTEM = (1 << 2), 27 | SVM_ATOMICS = (1 << 3), 28 | }; 29 | int value_; 30 | 31 | SVMCapabilities(int capabilities = 0) : value_(capabilities) { } 32 | operator int() const { return value_; } 33 | 34 | inline bool isNoSVMSupport() const { return value_ == 0; } 35 | inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; } 36 | inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; } 37 | inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; } 38 | inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; } 39 | }; 40 | 41 | CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context); 42 | 43 | struct SVMFunctions 44 | { 45 | clSVMAllocAMD_fn fn_clSVMAlloc; 46 | clSVMFreeAMD_fn fn_clSVMFree; 47 | clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer; 48 | //clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo; 49 | //clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree; 50 | clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy; 51 | clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill; 52 | clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap; 53 | clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap; 54 | 55 | inline SVMFunctions() 56 | : fn_clSVMAlloc(NULL), fn_clSVMFree(NULL), 57 | fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/ 58 | /*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL), 59 | fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL) 60 | { 61 | // nothing 62 | } 63 | 64 | inline bool isValid() const 65 | { 66 | return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer && 67 | /*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy && 68 | fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap; 69 | } 70 | }; 71 | 72 | // We should guarantee that SVMFunctions lifetime is not less than context's lifetime 73 | CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context); 74 | 75 | CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags); 76 | 77 | }}} //namespace cv::ocl::svm 78 | #endif 79 | 80 | #endif // OPENCV_CORE_OPENCL_SVM_HPP 81 | /* End of file. */ 82 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | // generated by parser_cl.py 9 | #define clCreateFromGLBuffer clCreateFromGLBuffer_ 10 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_ 11 | #define clCreateFromGLTexture clCreateFromGLTexture_ 12 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_ 13 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_ 14 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_ 15 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_ 16 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_ 17 | #define clGetGLObjectInfo clGetGLObjectInfo_ 18 | #define clGetGLTextureInfo clGetGLTextureInfo_ 19 | 20 | #if defined __APPLE__ 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | // generated by parser_cl.py 27 | #undef clCreateFromGLBuffer 28 | #define clCreateFromGLBuffer clCreateFromGLBuffer_pfn 29 | #undef clCreateFromGLRenderbuffer 30 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_pfn 31 | #undef clCreateFromGLTexture 32 | #define clCreateFromGLTexture clCreateFromGLTexture_pfn 33 | #undef clCreateFromGLTexture2D 34 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_pfn 35 | #undef clCreateFromGLTexture3D 36 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_pfn 37 | #undef clEnqueueAcquireGLObjects 38 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_pfn 39 | #undef clEnqueueReleaseGLObjects 40 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_pfn 41 | #undef clGetGLContextInfoKHR 42 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_pfn 43 | #undef clGetGLObjectInfo 44 | #define clGetGLObjectInfo clGetGLObjectInfo_pfn 45 | #undef clGetGLTextureInfo 46 | #define clGetGLTextureInfo clGetGLTextureInfo_pfn 47 | 48 | #ifdef cl_khr_gl_sharing 49 | 50 | // generated by parser_cl.py 51 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer)(cl_context, cl_mem_flags, cl_GLuint, int*); 52 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer)(cl_context, cl_mem_flags, cl_GLuint, cl_int*); 53 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 54 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 55 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 56 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 57 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 58 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*); 59 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo)(cl_mem, cl_gl_object_type*, cl_GLuint*); 60 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*); 61 | 62 | #endif // cl_khr_gl_sharing 63 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | #ifdef cl_khr_gl_sharing 9 | 10 | // generated by parser_cl.py 11 | #undef clCreateFromGLBuffer 12 | #define clCreateFromGLBuffer clCreateFromGLBuffer_fn 13 | inline cl_mem clCreateFromGLBuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, int* p3) { return clCreateFromGLBuffer_pfn(p0, p1, p2, p3); } 14 | #undef clCreateFromGLRenderbuffer 15 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_fn 16 | inline cl_mem clCreateFromGLRenderbuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, cl_int* p3) { return clCreateFromGLRenderbuffer_pfn(p0, p1, p2, p3); } 17 | #undef clCreateFromGLTexture 18 | #define clCreateFromGLTexture clCreateFromGLTexture_fn 19 | inline cl_mem clCreateFromGLTexture(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture_pfn(p0, p1, p2, p3, p4, p5); } 20 | #undef clCreateFromGLTexture2D 21 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_fn 22 | inline cl_mem clCreateFromGLTexture2D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture2D_pfn(p0, p1, p2, p3, p4, p5); } 23 | #undef clCreateFromGLTexture3D 24 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_fn 25 | inline cl_mem clCreateFromGLTexture3D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture3D_pfn(p0, p1, p2, p3, p4, p5); } 26 | #undef clEnqueueAcquireGLObjects 27 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_fn 28 | inline cl_int clEnqueueAcquireGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueAcquireGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 29 | #undef clEnqueueReleaseGLObjects 30 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_fn 31 | inline cl_int clEnqueueReleaseGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueReleaseGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 32 | #undef clGetGLContextInfoKHR 33 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_fn 34 | inline cl_int clGetGLContextInfoKHR(const cl_context_properties* p0, cl_gl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLContextInfoKHR_pfn(p0, p1, p2, p3, p4); } 35 | #undef clGetGLObjectInfo 36 | #define clGetGLObjectInfo clGetGLObjectInfo_fn 37 | inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2) { return clGetGLObjectInfo_pfn(p0, p1, p2); } 38 | #undef clGetGLTextureInfo 39 | #define clGetGLTextureInfo clGetGLTextureInfo_fn 40 | inline cl_int clGetGLTextureInfo(cl_mem p0, cl_gl_texture_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLTextureInfo_pfn(p0, p1, p2, p3, p4); } 41 | 42 | #endif // cl_khr_gl_sharing 43 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_clamdblas.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 44 | 45 | #ifdef HAVE_CLAMDBLAS 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clamdblas.hpp" 50 | 51 | #endif // HAVE_CLAMDBLAS 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_clamdfft.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 44 | 45 | #ifdef HAVE_CLAMDFFT 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clamdfft.hpp" 50 | 51 | #endif // HAVE_CLAMDFFT 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 44 | 45 | #ifdef HAVE_OPENCL 46 | 47 | #ifndef CL_RUNTIME_EXPORT 48 | #if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \ 49 | !(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD)) 50 | #define CL_RUNTIME_EXPORT __declspec(dllimport) 51 | #else 52 | #define CL_RUNTIME_EXPORT 53 | #endif 54 | #endif 55 | 56 | #ifdef HAVE_OPENCL_SVM 57 | #define clSVMAlloc clSVMAlloc_ 58 | #define clSVMFree clSVMFree_ 59 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_ 60 | #define clSetKernelExecInfo clSetKernelExecInfo_ 61 | #define clEnqueueSVMFree clEnqueueSVMFree_ 62 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_ 63 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_ 64 | #define clEnqueueSVMMap clEnqueueSVMMap_ 65 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_ 66 | #endif 67 | 68 | #include "autogenerated/opencl_core.hpp" 69 | 70 | #ifndef CL_DEVICE_DOUBLE_FP_CONFIG 71 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 72 | #endif 73 | 74 | #ifndef CL_DEVICE_HALF_FP_CONFIG 75 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 76 | #endif 77 | 78 | #ifndef CL_VERSION_1_2 79 | #define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") 80 | #endif 81 | 82 | #endif // HAVE_OPENCL 83 | 84 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 85 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_core_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 44 | 45 | #if defined HAVE_OPENCL && defined HAVE_OPENGL 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_gl.hpp" 50 | 51 | #endif // defined HAVE_OPENCL && defined HAVE_OPENGL 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 54 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_gl_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/opencl/runtime/opencl_svm_20.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #include "opencl_core.hpp" 8 | 9 | #include "opencl_svm_definitions.hpp" 10 | 11 | #undef clSVMAlloc 12 | #define clSVMAlloc clSVMAlloc_pfn 13 | #undef clSVMFree 14 | #define clSVMFree clSVMFree_pfn 15 | #undef clSetKernelArgSVMPointer 16 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_pfn 17 | #undef clSetKernelExecInfo 18 | //#define clSetKernelExecInfo clSetKernelExecInfo_pfn 19 | #undef clEnqueueSVMFree 20 | //#define clEnqueueSVMFree clEnqueueSVMFree_pfn 21 | #undef clEnqueueSVMMemcpy 22 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_pfn 23 | #undef clEnqueueSVMMemFill 24 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_pfn 25 | #undef clEnqueueSVMMap 26 | #define clEnqueueSVMMap clEnqueueSVMMap_pfn 27 | #undef clEnqueueSVMUnmap 28 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_pfn 29 | 30 | extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSVMAlloc)(cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment); 31 | extern CL_RUNTIME_EXPORT void (CL_API_CALL *clSVMFree)(cl_context context, void* svm_pointer); 32 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(cl_kernel kernel, cl_uint arg_index, const void* arg_value); 33 | //extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSetKernelExecInfo)(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value); 34 | //extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMFree)(cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], 35 | // void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, 36 | // cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 37 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, 38 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 39 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemFill)(cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, 40 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 41 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags map_flags, void* svm_ptr, size_t size, 42 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 43 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr, 44 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 45 | 46 | #endif // HAVE_OPENCL_SVM 47 | 48 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 49 | -------------------------------------------------------------------------------- /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/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/core/utils/filesystem.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_UTILS_FILESYSTEM_HPP 6 | #define OPENCV_UTILS_FILESYSTEM_HPP 7 | 8 | namespace cv { namespace utils { namespace fs { 9 | 10 | 11 | CV_EXPORTS bool exists(const cv::String& path); 12 | CV_EXPORTS bool isDirectory(const cv::String& path); 13 | 14 | CV_EXPORTS void remove_all(const cv::String& path); 15 | 16 | 17 | CV_EXPORTS cv::String getcwd(); 18 | 19 | /** @brief Converts path p to a canonical absolute path 20 | * Symlinks are processed if there is support for them on running platform. 21 | * 22 | * @param path input path. Target file/directory should exist. 23 | */ 24 | CV_EXPORTS cv::String canonical(const cv::String& path); 25 | 26 | /** Join path components */ 27 | CV_EXPORTS cv::String join(const cv::String& base, const cv::String& path); 28 | 29 | /** Get parent directory */ 30 | CV_EXPORTS cv::String getParent(const cv::String &path); 31 | 32 | /** 33 | * Generate a list of all files that match the globbing pattern. 34 | * 35 | * Result entries are prefixed by base directory path. 36 | * 37 | * @param directory base directory 38 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 39 | * @param[out] result result of globing. 40 | * @param recursive scan nested directories too 41 | * @param includeDirectories include directories into results list 42 | */ 43 | CV_EXPORTS void glob(const cv::String& directory, const cv::String& pattern, 44 | CV_OUT std::vector& result, 45 | bool recursive = false, bool includeDirectories = false); 46 | 47 | /** 48 | * Generate a list of all files that match the globbing pattern. 49 | * 50 | * @param directory base directory 51 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 52 | * @param[out] result globbing result with relative paths from base directory 53 | * @param recursive scan nested directories too 54 | * @param includeDirectories include directories into results list 55 | */ 56 | CV_EXPORTS void glob_relative(const cv::String& directory, const cv::String& pattern, 57 | CV_OUT std::vector& result, 58 | bool recursive = false, bool includeDirectories = false); 59 | 60 | 61 | CV_EXPORTS bool createDirectory(const cv::String& path); 62 | CV_EXPORTS bool createDirectories(const cv::String& path); 63 | 64 | #ifdef __OPENCV_BUILD 65 | // TODO 66 | //CV_EXPORTS cv::String getTempDirectory(); 67 | 68 | /** 69 | * @brief Returns directory to store OpenCV cache files 70 | * Create sub-directory in common OpenCV cache directory if it doesn't exist. 71 | * @param sub_directory_name name of sub-directory. NULL or "" value asks to return root cache directory. 72 | * @param configuration_name optional name of configuration parameter name which overrides default behavior. 73 | * @return Path to cache directory. Returns empty string if cache directories support is not available. Returns "disabled" if cache disabled by user. 74 | */ 75 | CV_EXPORTS cv::String getCacheDirectory(const char* sub_directory_name, const char* configuration_name = NULL); 76 | 77 | #endif 78 | 79 | }}} // namespace 80 | 81 | #endif // OPENCV_UTILS_FILESYSTEM_HPP 82 | -------------------------------------------------------------------------------- /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/cpp/include/opencv2/core/utils/logger.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_HPP 6 | #define OPENCV_LOGGER_HPP 7 | 8 | #include 9 | #include 10 | #include // INT_MAX 11 | 12 | #include "logger.defines.hpp" 13 | 14 | //! @addtogroup core_logging 15 | // This section describes OpenCV logging utilities. 16 | // 17 | //! @{ 18 | 19 | namespace cv { 20 | namespace utils { 21 | namespace logging { 22 | 23 | //! Supported logging levels and their semantic 24 | enum LogLevel { 25 | LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call 26 | LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error) 27 | LOG_LEVEL_ERROR = 2, //!< Error message 28 | LOG_LEVEL_WARNING = 3, //!< Warning message 29 | LOG_LEVEL_INFO = 4, //!< Info message 30 | LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build. 31 | LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 32 | #ifndef CV_DOXYGEN 33 | ENUM_LOG_LEVEL_FORCE_INT = INT_MAX 34 | #endif 35 | }; 36 | 37 | /** Set global logging level 38 | @return previous logging level 39 | */ 40 | CV_EXPORTS LogLevel setLogLevel(LogLevel logLevel); 41 | /** Get global logging level */ 42 | CV_EXPORTS LogLevel getLogLevel(); 43 | 44 | namespace internal { 45 | /** Write log message */ 46 | CV_EXPORTS void writeLogMessage(LogLevel logLevel, const char* message); 47 | } // namespace 48 | 49 | /** 50 | * \def CV_LOG_STRIP_LEVEL 51 | * 52 | * Define CV_LOG_STRIP_LEVEL=CV_LOG_LEVEL_[DEBUG|INFO|WARN|ERROR|FATAL|DISABLED] to compile out anything at that and before that logging level 53 | */ 54 | #ifndef CV_LOG_STRIP_LEVEL 55 | # if defined NDEBUG 56 | # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_DEBUG 57 | # else 58 | # define CV_LOG_STRIP_LEVEL CV_LOG_LEVEL_VERBOSE 59 | # endif 60 | #endif 61 | 62 | 63 | #define CV_LOG_FATAL(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_FATAL) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_FATAL, ss.str().c_str()); break; } 64 | #define CV_LOG_ERROR(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_ERROR) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_ERROR, ss.str().c_str()); break; } 65 | #define CV_LOG_WARNING(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_WARNING) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_WARNING, ss.str().c_str()); break; } 66 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_INFO 67 | #define CV_LOG_INFO(tag, ...) 68 | #else 69 | #define CV_LOG_INFO(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_INFO) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_INFO, ss.str().c_str()); break; } 70 | #endif 71 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_DEBUG 72 | #define CV_LOG_DEBUG(tag, ...) 73 | #else 74 | #define CV_LOG_DEBUG(tag, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_DEBUG) break; std::stringstream ss; ss << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_DEBUG, ss.str().c_str()); break; } 75 | #endif 76 | #if CV_LOG_STRIP_LEVEL <= CV_LOG_LEVEL_VERBOSE 77 | #define CV_LOG_VERBOSE(tag, v, ...) 78 | #else 79 | #define CV_LOG_VERBOSE(tag, v, ...) for(;;) { if (cv::utils::logging::getLogLevel() < cv::utils::logging::LOG_LEVEL_VERBOSE) break; std::stringstream ss; ss << "[VERB" << v << ":" << cv::utils::getThreadID() << "] " << __VA_ARGS__; cv::utils::logging::internal::writeLogMessage(cv::utils::logging::LOG_LEVEL_VERBOSE, ss.str().c_str()); break; } 80 | #endif 81 | 82 | 83 | }}} // namespace 84 | 85 | //! @} 86 | 87 | #endif // OPENCV_LOGGER_HPP 88 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/core/va_intel.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) 2015, Itseez, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_VA_INTEL_HPP 9 | #define OPENCV_CORE_VA_INTEL_HPP 10 | 11 | #ifndef __cplusplus 12 | # error va_intel.hpp header must be compiled as C++ 13 | #endif 14 | 15 | #include "opencv2/core.hpp" 16 | #include "ocl.hpp" 17 | 18 | #if defined(HAVE_VA) 19 | # include "va/va.h" 20 | #else // HAVE_VA 21 | # if !defined(_VA_H_) 22 | typedef void* VADisplay; 23 | typedef unsigned int VASurfaceID; 24 | # endif // !_VA_H_ 25 | #endif // HAVE_VA 26 | 27 | namespace cv { namespace va_intel { 28 | 29 | /** @addtogroup core_va_intel 30 | This section describes Intel VA-API/OpenCL (CL-VA) interoperability. 31 | 32 | To enable CL-VA interoperability support, configure OpenCV using CMake with WITH_VA_INTEL=ON . Currently VA-API is 33 | supported on Linux only. You should also install Intel Media Server Studio (MSS) to use this feature. You may 34 | have to specify the path(s) to MSS components for cmake in environment variables: 35 | 36 | - VA_INTEL_IOCL_ROOT for Intel OpenCL (default is "/opt/intel/opencl"). 37 | 38 | To use CL-VA interoperability you should first create VADisplay (libva), and then call initializeContextFromVA() 39 | function to create OpenCL context and set up interoperability. 40 | */ 41 | //! @{ 42 | 43 | /////////////////// CL-VA Interoperability Functions /////////////////// 44 | 45 | namespace ocl { 46 | using namespace cv::ocl; 47 | 48 | // TODO static functions in the Context class 49 | /** @brief Creates OpenCL context from VA. 50 | @param display - VADisplay for which CL interop should be established. 51 | @param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. 52 | @return Returns reference to OpenCL Context 53 | */ 54 | CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); 55 | 56 | } // namespace cv::va_intel::ocl 57 | 58 | /** @brief Converts InputArray to VASurfaceID object. 59 | @param display - VADisplay object. 60 | @param src - source InputArray. 61 | @param surface - destination VASurfaceID object. 62 | @param size - size of image represented by VASurfaceID object. 63 | */ 64 | CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); 65 | 66 | /** @brief Converts VASurfaceID object to OutputArray. 67 | @param display - VADisplay object. 68 | @param surface - source VASurfaceID object. 69 | @param size - size of image represented by VASurfaceID object. 70 | @param dst - destination OutputArray. 71 | */ 72 | CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); 73 | 74 | //! @} 75 | 76 | }} // namespace cv::va_intel 77 | 78 | #endif /* OPENCV_CORE_VA_INTEL_HPP */ 79 | -------------------------------------------------------------------------------- /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 4 9 | #define CV_VERSION_MINOR 1 10 | #define CV_VERSION_REVISION 0 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/cvconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_CVCONFIG_H_INCLUDED 2 | #define OPENCV_CVCONFIG_H_INCLUDED 3 | 4 | /* OpenCV compiled as static or dynamic libs */ 5 | /* #undef BUILD_SHARED_LIBS */ 6 | 7 | /* OpenCV intrinsics optimized code */ 8 | #define CV_ENABLE_INTRINSICS 9 | 10 | /* OpenCV additional optimized code */ 11 | /* #undef CV_DISABLE_OPTIMIZATION */ 12 | 13 | /* Compile for 'real' NVIDIA GPU architectures */ 14 | #define CUDA_ARCH_BIN "" 15 | 16 | /* Create PTX or BIN for 1.0 compute capability */ 17 | /* #undef CUDA_ARCH_BIN_OR_PTX_10 */ 18 | 19 | /* NVIDIA GPU features are used */ 20 | #define CUDA_ARCH_FEATURES "" 21 | 22 | /* Compile for 'virtual' NVIDIA PTX architectures */ 23 | #define CUDA_ARCH_PTX "" 24 | 25 | /* AMD's Basic Linear Algebra Subprograms Library*/ 26 | /* #undef HAVE_CLAMDBLAS */ 27 | 28 | /* AMD's OpenCL Fast Fourier Transform Library*/ 29 | /* #undef HAVE_CLAMDFFT */ 30 | 31 | /* Clp support */ 32 | /* #undef HAVE_CLP */ 33 | 34 | /* Cocoa API */ 35 | /* #undef HAVE_COCOA */ 36 | 37 | /* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ 38 | /* #undef HAVE_CUBLAS */ 39 | 40 | /* NVIDIA CUDA Runtime API*/ 41 | /* #undef HAVE_CUDA */ 42 | 43 | /* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ 44 | /* #undef HAVE_CUFFT */ 45 | 46 | /* DirectX */ 47 | /* #undef HAVE_DIRECTX */ 48 | /* #undef HAVE_DIRECTX_NV12 */ 49 | /* #undef HAVE_D3D11 */ 50 | /* #undef HAVE_D3D10 */ 51 | /* #undef HAVE_D3D9 */ 52 | 53 | /* Eigen Matrix & Linear Algebra Library */ 54 | /* #undef HAVE_EIGEN */ 55 | 56 | /* Geospatial Data Abstraction Library */ 57 | /* #undef HAVE_GDAL */ 58 | 59 | /* GTK+ 2.0 Thread support */ 60 | /* #undef HAVE_GTHREAD */ 61 | 62 | /* GTK+ 2.x toolkit */ 63 | /* #undef HAVE_GTK */ 64 | 65 | /* Halide support */ 66 | /* #undef HAVE_HALIDE */ 67 | 68 | /* Vulkan support */ 69 | /* #undef HAVE_VULKAN */ 70 | 71 | /* Define to 1 if you have the header file. */ 72 | #define HAVE_INTTYPES_H 1 73 | 74 | /* Intel Integrated Performance Primitives */ 75 | #define HAVE_IPP 76 | #define HAVE_IPP_ICV 77 | #define HAVE_IPP_IW 78 | #define HAVE_IPP_IW_LL 79 | 80 | /* JPEG-2000 codec */ 81 | #define HAVE_JASPER 82 | 83 | /* IJG JPEG codec */ 84 | #define HAVE_JPEG 85 | 86 | /* libpng/png.h needs to be included */ 87 | /* #undef HAVE_LIBPNG_PNG_H */ 88 | 89 | /* GDCM DICOM codec */ 90 | /* #undef HAVE_GDCM */ 91 | 92 | /* NVIDIA Video Decoding API*/ 93 | /* #undef HAVE_NVCUVID */ 94 | 95 | /* NVIDIA Video Encoding API*/ 96 | /* #undef HAVE_NVCUVENC */ 97 | 98 | /* OpenCL Support */ 99 | /* #undef HAVE_OPENCL */ 100 | /* #undef HAVE_OPENCL_STATIC */ 101 | /* #undef HAVE_OPENCL_SVM */ 102 | 103 | /* NVIDIA OpenCL D3D Extensions support */ 104 | /* #undef HAVE_OPENCL_D3D11_NV */ 105 | 106 | /* OpenEXR codec */ 107 | #define HAVE_OPENEXR 108 | 109 | /* OpenGL support*/ 110 | /* #undef HAVE_OPENGL */ 111 | 112 | /* PNG codec */ 113 | #define HAVE_PNG 114 | 115 | /* Posix threads (pthreads) */ 116 | #define HAVE_PTHREAD 117 | 118 | /* parallel_for with pthreads */ 119 | #define HAVE_PTHREADS_PF 120 | 121 | /* Qt support */ 122 | /* #undef HAVE_QT */ 123 | 124 | /* Qt OpenGL support */ 125 | /* #undef HAVE_QT_OPENGL */ 126 | 127 | /* Intel Threading Building Blocks */ 128 | #define HAVE_TBB 129 | 130 | /* Ste||ar Group High Performance ParallelX */ 131 | /* #undef HAVE_HPX */ 132 | 133 | /* TIFF codec */ 134 | #define HAVE_TIFF 135 | 136 | /* Win32 UI */ 137 | /* #undef HAVE_WIN32UI */ 138 | 139 | /* Define if your processor stores words with the most significant byte 140 | first (like Motorola and SPARC, unlike Intel and VAX). */ 141 | /* #undef WORDS_BIGENDIAN */ 142 | 143 | /* VA library (libva) */ 144 | /* #undef HAVE_VA */ 145 | 146 | /* Intel VA-API/OpenCL */ 147 | /* #undef HAVE_VA_INTEL */ 148 | 149 | /* Lapack */ 150 | /* #undef HAVE_LAPACK */ 151 | 152 | /* Library was compiled with functions instrumentation */ 153 | /* #undef ENABLE_INSTRUMENTATION */ 154 | 155 | /* OpenVX */ 156 | /* #undef HAVE_OPENVX */ 157 | 158 | /* OpenCV trace utilities */ 159 | #define OPENCV_TRACE 160 | 161 | /* Library QR-code decoding */ 162 | #define HAVE_QUIRC 163 | 164 | #endif // OPENCV_CVCONFIG_H_INCLUDED 165 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/dnn.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_DNN_HPP 43 | #define OPENCV_DNN_HPP 44 | 45 | // This is an umbrella header to include into you project. 46 | // We are free to change headers layout in dnn subfolder, so please include 47 | // this header for future compatibility 48 | 49 | 50 | /** @defgroup dnn Deep Neural Network module 51 | @{ 52 | This module contains: 53 | - API for new layers creation, layers are building bricks of neural networks; 54 | - set of built-in most-useful Layers; 55 | - API to construct and modify comprehensive neural networks from layers; 56 | - functionality for loading serialized networks models from different frameworks. 57 | 58 | Functionality of this module is designed only for forward pass computations (i.e. network testing). 59 | A network training is in principle not supported. 60 | @} 61 | */ 62 | /** @example samples/dnn/classification.cpp 63 | Check @ref tutorial_dnn_googlenet "the corresponding tutorial" for more details 64 | */ 65 | /** @example samples/dnn/colorization.cpp 66 | */ 67 | /** @example samples/dnn/object_detection.cpp 68 | Check @ref tutorial_dnn_yolo "the corresponding tutorial" for more details 69 | */ 70 | /** @example samples/dnn/openpose.cpp 71 | */ 72 | /** @example samples/dnn/segmentation.cpp 73 | */ 74 | /** @example samples/dnn/text_detection.cpp 75 | */ 76 | #include 77 | 78 | #endif /* OPENCV_DNN_HPP */ 79 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/dnn/layer.details.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_DNN_LAYER_DETAILS_HPP 6 | #define OPENCV_DNN_LAYER_DETAILS_HPP 7 | 8 | #include 9 | 10 | namespace cv { 11 | namespace dnn { 12 | CV__DNN_INLINE_NS_BEGIN 13 | 14 | /** @brief Registers layer constructor in runtime. 15 | * @param type string, containing type name of the layer. 16 | * @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. 17 | * @details This macros must be placed inside the function code. 18 | */ 19 | #define CV_DNN_REGISTER_LAYER_FUNC(type, constructorFunc) \ 20 | cv::dnn::LayerFactory::registerLayer(#type, constructorFunc); 21 | 22 | /** @brief Registers layer class in runtime. 23 | * @param type string, containing type name of the layer. 24 | * @param class C++ class, derived from Layer. 25 | * @details This macros must be placed inside the function code. 26 | */ 27 | #define CV_DNN_REGISTER_LAYER_CLASS(type, class) \ 28 | cv::dnn::LayerFactory::registerLayer(#type, cv::dnn::details::_layerDynamicRegisterer); 29 | 30 | /** @brief Registers layer constructor on module load time. 31 | * @param type string, containing type name of the layer. 32 | * @param constructorFunc pointer to the function of type LayerRegister::Constructor, which creates the layer. 33 | * @details This macros must be placed outside the function code. 34 | */ 35 | #define CV_DNN_REGISTER_LAYER_FUNC_STATIC(type, constructorFunc) \ 36 | static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, constructorFunc); 37 | 38 | /** @brief Registers layer class on module load time. 39 | * @param type string, containing type name of the layer. 40 | * @param class C++ class, derived from Layer. 41 | * @details This macros must be placed outside the function code. 42 | */ 43 | #define CV_DNN_REGISTER_LAYER_CLASS_STATIC(type, class) \ 44 | Ptr __LayerStaticRegisterer_func_##type(LayerParams ¶ms) \ 45 | { return Ptr(new class(params)); } \ 46 | static cv::dnn::details::_LayerStaticRegisterer __LayerStaticRegisterer_##type(#type, __LayerStaticRegisterer_func_##type); 47 | 48 | namespace details { 49 | 50 | template 51 | Ptr _layerDynamicRegisterer(LayerParams ¶ms) 52 | { 53 | return Ptr(LayerClass::create(params)); 54 | } 55 | 56 | //allows automatically register created layer on module load time 57 | class _LayerStaticRegisterer 58 | { 59 | String type; 60 | public: 61 | 62 | _LayerStaticRegisterer(const String &layerType, LayerFactory::Constructor layerConstructor) 63 | { 64 | this->type = layerType; 65 | LayerFactory::registerLayer(layerType, layerConstructor); 66 | } 67 | 68 | ~_LayerStaticRegisterer() 69 | { 70 | LayerFactory::unregisterLayer(type); 71 | } 72 | }; 73 | 74 | } // namespace 75 | CV__DNN_INLINE_NS_END 76 | }} // namespace 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/dnn/layer.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_DNN_LAYER_HPP 43 | #define OPENCV_DNN_LAYER_HPP 44 | #include 45 | 46 | namespace cv { 47 | namespace dnn { 48 | CV__DNN_INLINE_NS_BEGIN 49 | //! @addtogroup dnn 50 | //! @{ 51 | //! 52 | //! @defgroup dnnLayerFactory Utilities for New Layers Registration 53 | //! @{ 54 | 55 | /** @brief %Layer factory allows to create instances of registered layers. */ 56 | class CV_EXPORTS LayerFactory 57 | { 58 | public: 59 | 60 | //! Each Layer class must provide this function to the factory 61 | typedef Ptr(*Constructor)(LayerParams ¶ms); 62 | 63 | //! Registers the layer class with typename @p type and specified @p constructor. Thread-safe. 64 | static void registerLayer(const String &type, Constructor constructor); 65 | 66 | //! Unregisters registered layer with specified type name. Thread-safe. 67 | static void unregisterLayer(const String &type); 68 | 69 | /** @brief Creates instance of registered layer. 70 | * @param type type name of creating layer. 71 | * @param params parameters which will be used for layer initialization. 72 | * @note Thread-safe. 73 | */ 74 | static Ptr createLayerInstance(const String &type, LayerParams& params); 75 | 76 | private: 77 | LayerFactory(); 78 | }; 79 | 80 | //! @} 81 | //! @} 82 | CV__DNN_INLINE_NS_END 83 | } 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/dnn/utils/inference_engine.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) 2018-2019, Intel Corporation, all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_DNN_UTILS_INF_ENGINE_HPP 9 | #define OPENCV_DNN_UTILS_INF_ENGINE_HPP 10 | 11 | #include "../dnn.hpp" 12 | 13 | namespace cv { namespace dnn { 14 | CV__DNN_INLINE_NS_BEGIN 15 | 16 | 17 | /** @brief Release a Myriad device (binded by OpenCV). 18 | * 19 | * Single Myriad device cannot be shared across multiple processes which uses 20 | * Inference Engine's Myriad plugin. 21 | */ 22 | CV_EXPORTS_W void resetMyriadDevice(); 23 | 24 | 25 | /* Values for 'OPENCV_DNN_IE_VPU_TYPE' parameter */ 26 | #define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_UNSPECIFIED "" 27 | /// Intel(R) Movidius(TM) Neural Compute Stick, NCS (USB 03e7:2150), Myriad2 (https://software.intel.com/en-us/movidius-ncs) 28 | #define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_2 "Myriad2" 29 | /// Intel(R) Neural Compute Stick 2, NCS2 (USB 03e7:2485), MyriadX (https://software.intel.com/ru-ru/neural-compute-stick) 30 | #define CV_DNN_INFERENCE_ENGINE_VPU_TYPE_MYRIAD_X "MyriadX" 31 | 32 | 33 | /** @brief Returns Inference Engine VPU type. 34 | * 35 | * See values of `CV_DNN_INFERENCE_ENGINE_VPU_TYPE_*` macros. 36 | */ 37 | CV_EXPORTS_W cv::String getInferenceEngineVPUType(); 38 | 39 | 40 | CV__DNN_INLINE_NS_END 41 | }} // namespace 42 | 43 | #endif // OPENCV_DNN_UTILS_INF_ENGINE_HPP 44 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/dnn/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_DNN_VERSION_HPP 6 | #define OPENCV_DNN_VERSION_HPP 7 | 8 | /// Use with major OpenCV version only. 9 | #define OPENCV_DNN_API_VERSION 20190122 10 | 11 | #if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_INLINE_NS 12 | #define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION) 13 | #define CV__DNN_INLINE_NS_BEGIN namespace CV__DNN_INLINE_NS { 14 | #define CV__DNN_INLINE_NS_END } 15 | namespace cv { namespace dnn { namespace CV__DNN_INLINE_NS { } using namespace CV__DNN_INLINE_NS; }} 16 | #else 17 | #define CV__DNN_INLINE_NS_BEGIN 18 | #define CV__DNN_INLINE_NS_END 19 | #endif 20 | 21 | #endif // OPENCV_DNN_VERSION_HPP 22 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/features2d/features2d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/features2d.hpp" 49 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/cpp/include/opencv2/flann/flann.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/flann.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/general.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_GENERAL_H_ 32 | #define OPENCV_FLANN_GENERAL_H_ 33 | 34 | #include "opencv2/core.hpp" 35 | 36 | namespace cvflann 37 | { 38 | 39 | class FLANNException : public cv::Exception 40 | { 41 | public: 42 | FLANNException(const char* message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 43 | 44 | FLANNException(const cv::String& message) : cv::Exception(0, message, "", __FILE__, __LINE__) { } 45 | }; 46 | 47 | } 48 | 49 | 50 | #endif /* OPENCV_FLANN_GENERAL_H_ */ 51 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/ground_truth.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_GROUND_TRUTH_H_ 32 | #define OPENCV_FLANN_GROUND_TRUTH_H_ 33 | 34 | #include "dist.h" 35 | #include "matrix.h" 36 | 37 | 38 | namespace cvflann 39 | { 40 | 41 | template 42 | void find_nearest(const Matrix& dataset, typename Distance::ElementType* query, int* matches, int nn, 43 | int skip = 0, Distance distance = Distance()) 44 | { 45 | typedef typename Distance::ResultType DistanceType; 46 | int n = nn + skip; 47 | 48 | std::vector match(n); 49 | std::vector dists(n); 50 | 51 | dists[0] = distance(dataset[0], query, dataset.cols); 52 | match[0] = 0; 53 | int dcnt = 1; 54 | 55 | for (size_t i=1; i=1 && dists[j] 83 | void compute_ground_truth(const Matrix& dataset, const Matrix& testset, Matrix& matches, 84 | int skip=0, Distance d = Distance()) 85 | { 86 | for (size_t i=0; i(dataset, testset[i], matches[i], (int)matches.cols, skip, d); 88 | } 89 | } 90 | 91 | 92 | } 93 | 94 | #endif //OPENCV_FLANN_GROUND_TRUTH_H_ 95 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/linear_index.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_LINEAR_INDEX_H_ 32 | #define OPENCV_FLANN_LINEAR_INDEX_H_ 33 | 34 | #include "general.h" 35 | #include "nn_index.h" 36 | 37 | namespace cvflann 38 | { 39 | 40 | struct LinearIndexParams : public IndexParams 41 | { 42 | LinearIndexParams() 43 | { 44 | (* this)["algorithm"] = FLANN_INDEX_LINEAR; 45 | } 46 | }; 47 | 48 | template 49 | class LinearIndex : public NNIndex 50 | { 51 | public: 52 | 53 | typedef typename Distance::ElementType ElementType; 54 | typedef typename Distance::ResultType DistanceType; 55 | 56 | 57 | LinearIndex(const Matrix& inputData, const IndexParams& params = LinearIndexParams(), 58 | Distance d = Distance()) : 59 | dataset_(inputData), index_params_(params), distance_(d) 60 | { 61 | } 62 | 63 | LinearIndex(const LinearIndex&); 64 | LinearIndex& operator=(const LinearIndex&); 65 | 66 | flann_algorithm_t getType() const CV_OVERRIDE 67 | { 68 | return FLANN_INDEX_LINEAR; 69 | } 70 | 71 | 72 | size_t size() const CV_OVERRIDE 73 | { 74 | return dataset_.rows; 75 | } 76 | 77 | size_t veclen() const CV_OVERRIDE 78 | { 79 | return dataset_.cols; 80 | } 81 | 82 | 83 | int usedMemory() const CV_OVERRIDE 84 | { 85 | return 0; 86 | } 87 | 88 | void buildIndex() CV_OVERRIDE 89 | { 90 | /* nothing to do here for linear search */ 91 | } 92 | 93 | void saveIndex(FILE*) CV_OVERRIDE 94 | { 95 | /* nothing to do here for linear search */ 96 | } 97 | 98 | 99 | void loadIndex(FILE*) CV_OVERRIDE 100 | { 101 | /* nothing to do here for linear search */ 102 | 103 | index_params_["algorithm"] = getType(); 104 | } 105 | 106 | void findNeighbors(ResultSet& resultSet, const ElementType* vec, const SearchParams& /*searchParams*/) CV_OVERRIDE 107 | { 108 | ElementType* data = dataset_.data; 109 | for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) { 110 | DistanceType dist = distance_(data, vec, dataset_.cols); 111 | resultSet.addPoint(dist, (int)i); 112 | } 113 | } 114 | 115 | IndexParams getParameters() const CV_OVERRIDE 116 | { 117 | return index_params_; 118 | } 119 | 120 | private: 121 | /** The dataset */ 122 | const Matrix dataset_; 123 | /** Index parameters */ 124 | IndexParams index_params_; 125 | /** Index distance */ 126 | Distance distance_; 127 | 128 | }; 129 | 130 | } 131 | 132 | #endif // OPENCV_FLANN_LINEAR_INDEX_H_ 133 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/logger.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_LOGGER_H 32 | #define OPENCV_FLANN_LOGGER_H 33 | 34 | #include 35 | #include 36 | 37 | #include "defines.h" 38 | 39 | 40 | namespace cvflann 41 | { 42 | 43 | class Logger 44 | { 45 | Logger() : stream(stdout), logLevel(FLANN_LOG_WARN) {} 46 | 47 | ~Logger() 48 | { 49 | if ((stream!=NULL)&&(stream!=stdout)) { 50 | fclose(stream); 51 | } 52 | } 53 | 54 | static Logger& instance() 55 | { 56 | static Logger logger; 57 | return logger; 58 | } 59 | 60 | void _setDestination(const char* name) 61 | { 62 | if (name==NULL) { 63 | stream = stdout; 64 | } 65 | else { 66 | #ifdef _MSC_VER 67 | if (fopen_s(&stream, name, "w") != 0) 68 | stream = NULL; 69 | #else 70 | stream = fopen(name,"w"); 71 | #endif 72 | if (stream == NULL) { 73 | stream = stdout; 74 | } 75 | } 76 | } 77 | 78 | int _log(int level, const char* fmt, va_list arglist) 79 | { 80 | if (level > logLevel ) return -1; 81 | int ret = vfprintf(stream, fmt, arglist); 82 | return ret; 83 | } 84 | 85 | public: 86 | /** 87 | * Sets the logging level. All messages with lower priority will be ignored. 88 | * @param level Logging level 89 | */ 90 | static void setLevel(int level) { instance().logLevel = level; } 91 | 92 | /** 93 | * Sets the logging destination 94 | * @param name Filename or NULL for console 95 | */ 96 | static void setDestination(const char* name) { instance()._setDestination(name); } 97 | 98 | /** 99 | * Print log message 100 | * @param level Log level 101 | * @param fmt Message format 102 | * @return 103 | */ 104 | static int log(int level, const char* fmt, ...) 105 | { 106 | va_list arglist; 107 | va_start(arglist, fmt); 108 | int ret = instance()._log(level,fmt,arglist); 109 | va_end(arglist); 110 | return ret; 111 | } 112 | 113 | #define LOG_METHOD(NAME,LEVEL) \ 114 | static int NAME(const char* fmt, ...) \ 115 | { \ 116 | va_list ap; \ 117 | va_start(ap, fmt); \ 118 | int ret = instance()._log(LEVEL, fmt, ap); \ 119 | va_end(ap); \ 120 | return ret; \ 121 | } 122 | 123 | LOG_METHOD(fatal, FLANN_LOG_FATAL) 124 | LOG_METHOD(error, FLANN_LOG_ERROR) 125 | LOG_METHOD(warn, FLANN_LOG_WARN) 126 | LOG_METHOD(info, FLANN_LOG_INFO) 127 | 128 | private: 129 | FILE* stream; 130 | int logLevel; 131 | }; 132 | 133 | } 134 | 135 | #endif //OPENCV_FLANN_LOGGER_H 136 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/matrix.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_DATASET_H_ 32 | #define OPENCV_FLANN_DATASET_H_ 33 | 34 | #include 35 | 36 | #include "general.h" 37 | 38 | namespace cvflann 39 | { 40 | 41 | /** 42 | * Class that implements a simple rectangular matrix stored in a memory buffer and 43 | * provides convenient matrix-like access using the [] operators. 44 | */ 45 | template 46 | class Matrix 47 | { 48 | public: 49 | typedef T type; 50 | 51 | size_t rows; 52 | size_t cols; 53 | size_t stride; 54 | T* data; 55 | 56 | Matrix() : rows(0), cols(0), stride(0), data(NULL) 57 | { 58 | } 59 | 60 | Matrix(T* data_, size_t rows_, size_t cols_, size_t stride_ = 0) : 61 | rows(rows_), cols(cols_), stride(stride_), data(data_) 62 | { 63 | if (stride==0) stride = cols; 64 | } 65 | 66 | /** 67 | * Convenience function for deallocating the storage data. 68 | */ 69 | CV_DEPRECATED void free() 70 | { 71 | fprintf(stderr, "The cvflann::Matrix::free() method is deprecated " 72 | "and it does not do any memory deallocation any more. You are" 73 | "responsible for deallocating the matrix memory (by doing" 74 | "'delete[] matrix.data' for example)"); 75 | } 76 | 77 | /** 78 | * Operator that return a (pointer to a) row of the data. 79 | */ 80 | T* operator[](size_t index) const 81 | { 82 | return data+index*stride; 83 | } 84 | }; 85 | 86 | 87 | class UntypedMatrix 88 | { 89 | public: 90 | size_t rows; 91 | size_t cols; 92 | void* data; 93 | flann_datatype_t type; 94 | 95 | UntypedMatrix(void* data_, long rows_, long cols_) : 96 | rows(rows_), cols(cols_), data(data_) 97 | { 98 | } 99 | 100 | ~UntypedMatrix() 101 | { 102 | } 103 | 104 | 105 | template 106 | Matrix as() 107 | { 108 | return Matrix((T*)data, rows, cols); 109 | } 110 | }; 111 | 112 | 113 | 114 | } 115 | 116 | #endif //OPENCV_FLANN_DATASET_H_ 117 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/object_factory.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 David G. Lowe (lowe@cs.ubc.ca). All rights reserved. 6 | * 7 | * THE BSD LICENSE 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | *************************************************************************/ 30 | 31 | #ifndef OPENCV_FLANN_OBJECT_FACTORY_H_ 32 | #define OPENCV_FLANN_OBJECT_FACTORY_H_ 33 | 34 | #include 35 | 36 | namespace cvflann 37 | { 38 | 39 | class CreatorNotFound 40 | { 41 | }; 42 | 43 | template 46 | class ObjectFactory 47 | { 48 | typedef ObjectFactory ThisClass; 49 | typedef std::map ObjectRegistry; 50 | 51 | // singleton class, private constructor 52 | ObjectFactory() {} 53 | 54 | public: 55 | 56 | bool subscribe(UniqueIdType id, ObjectCreator creator) 57 | { 58 | if (object_registry.find(id) != object_registry.end()) return false; 59 | 60 | object_registry[id] = creator; 61 | return true; 62 | } 63 | 64 | bool unregister(UniqueIdType id) 65 | { 66 | return object_registry.erase(id) == 1; 67 | } 68 | 69 | ObjectCreator create(UniqueIdType id) 70 | { 71 | typename ObjectRegistry::const_iterator iter = object_registry.find(id); 72 | 73 | if (iter == object_registry.end()) { 74 | throw CreatorNotFound(); 75 | } 76 | 77 | return iter->second; 78 | } 79 | 80 | static ThisClass& instance() 81 | { 82 | static ThisClass the_factory; 83 | return the_factory; 84 | } 85 | private: 86 | ObjectRegistry object_registry; 87 | }; 88 | 89 | } 90 | 91 | #endif /* OPENCV_FLANN_OBJECT_FACTORY_H_ */ 92 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/params.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_PARAMS_H_ 31 | #define OPENCV_FLANN_PARAMS_H_ 32 | 33 | #include "any.h" 34 | #include "general.h" 35 | #include 36 | #include 37 | 38 | 39 | namespace cvflann 40 | { 41 | 42 | typedef std::map IndexParams; 43 | 44 | struct SearchParams : public IndexParams 45 | { 46 | SearchParams(int checks = 32, float eps = 0, bool sorted = true ) 47 | { 48 | // how many leafs to visit when searching for neighbours (-1 for unlimited) 49 | (*this)["checks"] = checks; 50 | // search for eps-approximate neighbours (default: 0) 51 | (*this)["eps"] = eps; 52 | // only for radius search, require neighbours sorted by distance (default: true) 53 | (*this)["sorted"] = sorted; 54 | } 55 | }; 56 | 57 | 58 | template 59 | T get_param(const IndexParams& params, cv::String name, const T& default_value) 60 | { 61 | IndexParams::const_iterator it = params.find(name); 62 | if (it != params.end()) { 63 | return it->second.cast(); 64 | } 65 | else { 66 | return default_value; 67 | } 68 | } 69 | 70 | template 71 | T get_param(const IndexParams& params, cv::String name) 72 | { 73 | IndexParams::const_iterator it = params.find(name); 74 | if (it != params.end()) { 75 | return it->second.cast(); 76 | } 77 | else { 78 | throw FLANNException(cv::String("Missing parameter '")+name+cv::String("' in the parameters given")); 79 | } 80 | } 81 | 82 | inline void print_params(const IndexParams& params, std::ostream& stream) 83 | { 84 | IndexParams::const_iterator it; 85 | 86 | for(it=params.begin(); it!=params.end(); ++it) { 87 | stream << it->first << " : " << it->second << std::endl; 88 | } 89 | } 90 | 91 | inline void print_params(const IndexParams& params) 92 | { 93 | print_params(params, std::cout); 94 | } 95 | 96 | } 97 | 98 | 99 | #endif /* OPENCV_FLANN_PARAMS_H_ */ 100 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/flann/sampling.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************** 2 | * Software License Agreement (BSD License) 3 | * 4 | * Copyright 2008-2009 Marius Muja (mariusm@cs.ubc.ca). All rights reserved. 5 | * Copyright 2008-2009 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_SAMPLING_H_ 31 | #define OPENCV_FLANN_SAMPLING_H_ 32 | 33 | #include "matrix.h" 34 | #include "random.h" 35 | 36 | namespace cvflann 37 | { 38 | 39 | template 40 | Matrix random_sample(Matrix& srcMatrix, long size, bool remove = false) 41 | { 42 | Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); 43 | 44 | T* src,* dest; 45 | for (long i=0; i 63 | Matrix random_sample(const Matrix& srcMatrix, size_t size) 64 | { 65 | UniqueRandom rand((int)srcMatrix.rows); 66 | Matrix newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols); 67 | 68 | T* src,* dest; 69 | for (size_t i=0; i 35 | #include "opencv2/core.hpp" 36 | #include "opencv2/core/utility.hpp" 37 | 38 | namespace cvflann 39 | { 40 | 41 | /** 42 | * A start-stop timer class. 43 | * 44 | * Can be used to time portions of code. 45 | */ 46 | class StartStopTimer 47 | { 48 | int64 startTime; 49 | 50 | public: 51 | /** 52 | * Value of the timer. 53 | */ 54 | double value; 55 | 56 | 57 | /** 58 | * Constructor. 59 | */ 60 | StartStopTimer() 61 | { 62 | reset(); 63 | } 64 | 65 | /** 66 | * Starts the timer. 67 | */ 68 | void start() 69 | { 70 | startTime = cv::getTickCount(); 71 | } 72 | 73 | /** 74 | * Stops the timer and updates timer value. 75 | */ 76 | void stop() 77 | { 78 | int64 stopTime = cv::getTickCount(); 79 | value += ( (double)stopTime - startTime) / cv::getTickFrequency(); 80 | } 81 | 82 | /** 83 | * Resets the timer value to 0. 84 | */ 85 | void reset() 86 | { 87 | value = 0; 88 | } 89 | 90 | }; 91 | 92 | } 93 | 94 | #endif // FLANN_TIMER_H 95 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/highgui/highgui.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/highgui.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/imgcodecs/imgcodecs.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgcodecs.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/imgcodecs/imgcodecs_c.h: -------------------------------------------------------------------------------- 1 | #error "This header with legacy C API declarations has been removed from OpenCV. Legacy contants are available from legacy/constants_c.h file." 2 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/imgcodecs/ios.h: -------------------------------------------------------------------------------- 1 | 2 | /*M/////////////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 5 | // 6 | // By downloading, copying, installing or using the software you agree to this license. 7 | // If you do not agree to this license, do not download, install, 8 | // copy or use the software. 9 | // 10 | // 11 | // License Agreement 12 | // For Open Source Computer Vision Library 13 | // 14 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 15 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #import 45 | #import 46 | #import 47 | #import 48 | #include "opencv2/core/core.hpp" 49 | 50 | //! @addtogroup imgcodecs_ios 51 | //! @{ 52 | 53 | CV_EXPORTS UIImage* MatToUIImage(const cv::Mat& image); 54 | CV_EXPORTS void UIImageToMat(const UIImage* image, 55 | cv::Mat& m, bool alphaExist = false); 56 | 57 | //! @} 58 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/imgcodecs/legacy/constants_c.h: -------------------------------------------------------------------------------- 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_IMGCODECS_LEGACY_CONSTANTS_H 6 | #define OPENCV_IMGCODECS_LEGACY_CONSTANTS_H 7 | 8 | /* duplicate of "ImreadModes" enumeration for better compatibility with OpenCV 3.x */ 9 | enum 10 | { 11 | /* 8bit, color or not */ 12 | CV_LOAD_IMAGE_UNCHANGED =-1, 13 | /* 8bit, gray */ 14 | CV_LOAD_IMAGE_GRAYSCALE =0, 15 | /* ?, color */ 16 | CV_LOAD_IMAGE_COLOR =1, 17 | /* any depth, ? */ 18 | CV_LOAD_IMAGE_ANYDEPTH =2, 19 | /* ?, any color */ 20 | CV_LOAD_IMAGE_ANYCOLOR =4, 21 | /* ?, no rotate */ 22 | CV_LOAD_IMAGE_IGNORE_ORIENTATION =128 23 | }; 24 | 25 | /* duplicate of "ImwriteFlags" enumeration for better compatibility with OpenCV 3.x */ 26 | enum 27 | { 28 | CV_IMWRITE_JPEG_QUALITY =1, 29 | CV_IMWRITE_JPEG_PROGRESSIVE =2, 30 | CV_IMWRITE_JPEG_OPTIMIZE =3, 31 | CV_IMWRITE_JPEG_RST_INTERVAL =4, 32 | CV_IMWRITE_JPEG_LUMA_QUALITY =5, 33 | CV_IMWRITE_JPEG_CHROMA_QUALITY =6, 34 | CV_IMWRITE_PNG_COMPRESSION =16, 35 | CV_IMWRITE_PNG_STRATEGY =17, 36 | CV_IMWRITE_PNG_BILEVEL =18, 37 | CV_IMWRITE_PNG_STRATEGY_DEFAULT =0, 38 | CV_IMWRITE_PNG_STRATEGY_FILTERED =1, 39 | CV_IMWRITE_PNG_STRATEGY_HUFFMAN_ONLY =2, 40 | CV_IMWRITE_PNG_STRATEGY_RLE =3, 41 | CV_IMWRITE_PNG_STRATEGY_FIXED =4, 42 | CV_IMWRITE_PXM_BINARY =32, 43 | CV_IMWRITE_EXR_TYPE = 48, 44 | CV_IMWRITE_WEBP_QUALITY =64, 45 | CV_IMWRITE_PAM_TUPLETYPE = 128, 46 | CV_IMWRITE_PAM_FORMAT_NULL = 0, 47 | CV_IMWRITE_PAM_FORMAT_BLACKANDWHITE = 1, 48 | CV_IMWRITE_PAM_FORMAT_GRAYSCALE = 2, 49 | CV_IMWRITE_PAM_FORMAT_GRAYSCALE_ALPHA = 3, 50 | CV_IMWRITE_PAM_FORMAT_RGB = 4, 51 | CV_IMWRITE_PAM_FORMAT_RGB_ALPHA = 5, 52 | }; 53 | 54 | #endif // OPENCV_IMGCODECS_LEGACY_CONSTANTS_H 55 | -------------------------------------------------------------------------------- /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/cpp/include/opencv2/imgproc/imgproc.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgproc.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/ml/ml.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/ml.hpp" 49 | -------------------------------------------------------------------------------- /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/cpp/include/opencv2/objdetect/objdetect.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/objdetect.hpp" 49 | -------------------------------------------------------------------------------- /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_STITCHING 25 | #define HAVE_OPENCV_VIDEO 26 | #define HAVE_OPENCV_VIDEOIO 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/photo/legacy/constants_c.h: -------------------------------------------------------------------------------- 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_PHOTO_LEGACY_CONSTANTS_H 6 | #define OPENCV_PHOTO_LEGACY_CONSTANTS_H 7 | 8 | enum InpaintingModes 9 | { 10 | CV_INPAINT_NS =0, 11 | CV_INPAINT_TELEA =1 12 | }; 13 | 14 | #endif // OPENCV_PHOTO_LEGACY_CONSTANTS_H 15 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/photo/photo.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/photo.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/stitching/detail/autocalib.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_STITCHING_AUTOCALIB_HPP 44 | #define OPENCV_STITCHING_AUTOCALIB_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | #include "matchers.hpp" 48 | 49 | namespace cv { 50 | namespace detail { 51 | 52 | //! @addtogroup stitching_autocalib 53 | //! @{ 54 | 55 | /** @brief Tries to estimate focal lengths from the given homography under the assumption that the camera 56 | undergoes rotations around its centre only. 57 | 58 | @param H Homography. 59 | @param f0 Estimated focal length along X axis. 60 | @param f1 Estimated focal length along Y axis. 61 | @param f0_ok True, if f0 was estimated successfully, false otherwise. 62 | @param f1_ok True, if f1 was estimated successfully, false otherwise. 63 | 64 | See "Construction of Panoramic Image Mosaics with Global and Local Alignment" 65 | by Heung-Yeung Shum and Richard Szeliski. 66 | */ 67 | void CV_EXPORTS_W focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok); 68 | 69 | /** @brief Estimates focal lengths for each given camera. 70 | 71 | @param features Features of images. 72 | @param pairwise_matches Matches between all image pairs. 73 | @param focals Estimated focal lengths for each camera. 74 | */ 75 | void CV_EXPORTS estimateFocal(const std::vector &features, 76 | const std::vector &pairwise_matches, 77 | std::vector &focals); 78 | 79 | bool CV_EXPORTS_W calibrateRotatingCamera(const std::vector &Hs,CV_OUT Mat &K); 80 | 81 | //! @} stitching_autocalib 82 | 83 | } // namespace detail 84 | } // namespace cv 85 | 86 | #endif // OPENCV_STITCHING_AUTOCALIB_HPP 87 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/stitching/detail/camera.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_STITCHING_CAMERA_HPP 44 | #define OPENCV_STITCHING_CAMERA_HPP 45 | 46 | #include "opencv2/core.hpp" 47 | 48 | namespace cv { 49 | namespace detail { 50 | 51 | //! @addtogroup stitching 52 | //! @{ 53 | 54 | /** @brief Describes camera parameters. 55 | 56 | @note Translation is assumed to be zero during the whole stitching pipeline. : 57 | */ 58 | struct CV_EXPORTS_W_SIMPLE CameraParams 59 | { 60 | CameraParams(); 61 | CameraParams(const CameraParams& other); 62 | CameraParams& operator =(const CameraParams& other); 63 | CV_WRAP Mat K() const; 64 | 65 | CV_PROP_RW double focal; // Focal length 66 | CV_PROP_RW double aspect; // Aspect ratio 67 | CV_PROP_RW double ppx; // Principal point X 68 | CV_PROP_RW double ppy; // Principal point Y 69 | CV_PROP_RW Mat R; // Rotation 70 | CV_PROP_RW Mat t; // Translation 71 | }; 72 | 73 | //! @} 74 | 75 | } // namespace detail 76 | } // namespace cv 77 | 78 | #endif // #ifndef OPENCV_STITCHING_CAMERA_HPP 79 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/stitching/detail/timelapsers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | 44 | #ifndef OPENCV_STITCHING_TIMELAPSERS_HPP 45 | #define OPENCV_STITCHING_TIMELAPSERS_HPP 46 | 47 | #include "opencv2/core.hpp" 48 | 49 | namespace cv { 50 | namespace detail { 51 | 52 | //! @addtogroup stitching 53 | //! @{ 54 | 55 | // Base Timelapser class, takes a sequence of images, applies appropriate shift, stores result in dst_. 56 | 57 | class CV_EXPORTS_W Timelapser 58 | { 59 | public: 60 | 61 | enum {AS_IS, CROP}; 62 | 63 | virtual ~Timelapser() {} 64 | 65 | CV_WRAP static Ptr createDefault(int type); 66 | 67 | CV_WRAP virtual void initialize(const std::vector &corners, const std::vector &sizes); 68 | CV_WRAP virtual void process(InputArray img, InputArray mask, Point tl); 69 | CV_WRAP virtual const UMat& getDst() {return dst_;} 70 | 71 | protected: 72 | 73 | virtual bool test_point(Point pt); 74 | 75 | UMat dst_; 76 | Rect dst_roi_; 77 | }; 78 | 79 | 80 | class CV_EXPORTS_W TimelapserCrop : public Timelapser 81 | { 82 | public: 83 | virtual void initialize(const std::vector &corners, const std::vector &sizes) CV_OVERRIDE; 84 | }; 85 | 86 | //! @} 87 | 88 | } // namespace detail 89 | } // namespace cv 90 | 91 | #endif // OPENCV_STITCHING_TIMELAPSERS_HPP 92 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/stitching/detail/util_inl.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_STITCHING_UTIL_INL_HPP 44 | #define OPENCV_STITCHING_UTIL_INL_HPP 45 | 46 | #include 47 | #include "opencv2/core.hpp" 48 | #include "util.hpp" // Make your IDE see declarations 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { 53 | namespace detail { 54 | 55 | template 56 | B Graph::forEach(B body) const 57 | { 58 | for (int i = 0; i < numVertices(); ++i) 59 | { 60 | std::list::const_iterator edge = edges_[i].begin(); 61 | for (; edge != edges_[i].end(); ++edge) 62 | body(*edge); 63 | } 64 | return body; 65 | } 66 | 67 | 68 | template 69 | B Graph::walkBreadthFirst(int from, B body) const 70 | { 71 | std::vector was(numVertices(), false); 72 | std::queue vertices; 73 | 74 | was[from] = true; 75 | vertices.push(from); 76 | 77 | while (!vertices.empty()) 78 | { 79 | int vertex = vertices.front(); 80 | vertices.pop(); 81 | 82 | std::list::const_iterator edge = edges_[vertex].begin(); 83 | for (; edge != edges_[vertex].end(); ++edge) 84 | { 85 | if (!was[edge->to]) 86 | { 87 | body(*edge); 88 | was[edge->to] = true; 89 | vertices.push(edge->to); 90 | } 91 | } 92 | } 93 | 94 | return body; 95 | } 96 | 97 | 98 | ////////////////////////////////////////////////////////////////////////////// 99 | // Some auxiliary math functions 100 | 101 | static inline 102 | float normL2(const Point3f& a) 103 | { 104 | return a.x * a.x + a.y * a.y + a.z * a.z; 105 | } 106 | 107 | 108 | static inline 109 | float normL2(const Point3f& a, const Point3f& b) 110 | { 111 | return normL2(a - b); 112 | } 113 | 114 | 115 | static inline 116 | double normL2sq(const Mat &r) 117 | { 118 | return r.dot(r); 119 | } 120 | 121 | 122 | static inline int sqr(int x) { return x * x; } 123 | static inline float sqr(float x) { return x * x; } 124 | static inline double sqr(double x) { return x * x; } 125 | 126 | } // namespace detail 127 | } // namespace cv 128 | 129 | //! @endcond 130 | 131 | #endif // OPENCV_STITCHING_UTIL_INL_HPP 132 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifndef OPENCV_VIDEO_HPP 45 | #define OPENCV_VIDEO_HPP 46 | 47 | /** 48 | @defgroup video Video Analysis 49 | @{ 50 | @defgroup video_motion Motion Analysis 51 | @defgroup video_track Object Tracking 52 | @defgroup video_c C API 53 | @} 54 | */ 55 | 56 | #include "opencv2/video/tracking.hpp" 57 | #include "opencv2/video/background_segm.hpp" 58 | 59 | #endif //OPENCV_VIDEO_HPP 60 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/video/legacy/constants_c.h: -------------------------------------------------------------------------------- 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_VIDEO_LEGACY_CONSTANTS_H 6 | #define OPENCV_VIDEO_LEGACY_CONSTANTS_H 7 | 8 | enum 9 | { 10 | CV_LKFLOW_PYR_A_READY = 1, 11 | CV_LKFLOW_PYR_B_READY = 2, 12 | CV_LKFLOW_INITIAL_GUESSES = 4, 13 | CV_LKFLOW_GET_MIN_EIGENVALS = 8 14 | }; 15 | 16 | #endif // OPENCV_VIDEO_LEGACY_CONSTANTS_H 17 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/video/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/video.hpp" 49 | -------------------------------------------------------------------------------- /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 | /** @brief Returns true if backend is available */ 42 | CV_EXPORTS bool hasBackend(VideoCaptureAPIs api); 43 | 44 | //! @} 45 | }} // namespace 46 | 47 | #endif // OPENCV_VIDEOIO_REGISTRY_HPP 48 | -------------------------------------------------------------------------------- /app/src/main/cpp/include/opencv2/videoio/videoio.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/videoio.hpp" 49 | -------------------------------------------------------------------------------- /app/src/main/cpp/libs/armeabi-v7a/libopencv_java4.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danengz/OpenCVDemo/58a273c2e6ee21c8d8fb118c79f29b2d631d318f/app/src/main/cpp/libs/armeabi-v7a/libopencv_java4.so -------------------------------------------------------------------------------- /app/src/main/cpp/native-lib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "opencv2/opencv.hpp" 4 | #include 5 | ANativeWindow *window = 0; 6 | using namespace cv; 7 | 8 | DetectionBasedTracker *tracker = 0; 9 | class CascadeDetectorAdapter: public DetectionBasedTracker::IDetector 10 | { 11 | public: 12 | CascadeDetectorAdapter(cv::Ptr detector): 13 | IDetector(), 14 | Detector(detector) 15 | { 16 | } 17 | void detect(const cv::Mat &Image, std::vector &objects) 18 | { 19 | Detector->detectMultiScale(Image, objects, scaleFactor, minNeighbours, 0, minObjSize, maxObjSize); 20 | } 21 | 22 | virtual ~CascadeDetectorAdapter() 23 | { 24 | } 25 | 26 | private: 27 | CascadeDetectorAdapter(); 28 | cv::Ptr Detector; 29 | }; 30 | 31 | 32 | extern "C" 33 | JNIEXPORT void JNICALL 34 | Java_com_yu_opencvdemo_OpencvJni_init(JNIEnv *env, jobject instance, jstring path_) { 35 | const char *path = env->GetStringUTFChars(path_, 0); 36 | 37 | 38 | //创建检测器 Ptr是智能指针,不需要关心释放 39 | Ptr mainClassifier = makePtr(path); 40 | Ptr mainDetector = makePtr(mainClassifier); 41 | 42 | //创建跟踪器 43 | Ptr trackClassifier = makePtr(path); 44 | Ptr trackingDetector = makePtr(trackClassifier); 45 | 46 | //开始识别,结果在CascadeDetectorAdapter中返回 47 | DetectionBasedTracker::Parameters DetectorParams; 48 | tracker= new DetectionBasedTracker(mainDetector, trackingDetector, DetectorParams); 49 | tracker->run(); 50 | 51 | env->ReleaseStringUTFChars(path_, path); 52 | } 53 | 54 | extern "C" 55 | JNIEXPORT void JNICALL 56 | Java_com_yu_opencvdemo_OpencvJni_postData(JNIEnv *env, jobject instance, jbyteArray data_, 57 | jint width, jint height, jint cameraId) { 58 | jbyte *data = env->GetByteArrayElements(data_, NULL); 59 | 60 | // 数据的行数也就是数据高度,因为数据类型是NV21,所以为Y+U+V的高度, 也就是height + height/4 + height/4 61 | Mat src(height*3/2, width, CV_8UC1, data); 62 | 63 | // 转RGB 64 | cvtColor(src, src, COLOR_YUV2RGBA_NV21); 65 | if (cameraId == 1) {// 前置摄像头 66 | //逆时针旋转90度 67 | rotate(src, src, ROTATE_90_COUNTERCLOCKWISE); 68 | //1:水平翻转 0:垂直翻转 69 | flip(src, src, 1); 70 | } else { 71 | //顺时针旋转90度 72 | rotate(src, src, ROTATE_90_CLOCKWISE); 73 | 74 | } 75 | Mat gray; 76 | //灰度化 77 | cvtColor(src, gray, COLOR_RGBA2GRAY); 78 | //二值化 79 | equalizeHist(gray, gray); 80 | 81 | std::vector faces; 82 | //检测图片 83 | tracker->process(gray); 84 | //获取CascadeDetectorAdapter中的检测结果 85 | tracker->getObjects(faces); 86 | //画出矩形 87 | for (Rect face : faces) { 88 | rectangle(src, face, Scalar(255, 0, 0)); 89 | } 90 | 91 | //显示到serface 92 | if (window) { 93 | ANativeWindow_setBuffersGeometry(window, src.cols, src.rows, WINDOW_FORMAT_RGBA_8888); 94 | ANativeWindow_Buffer window_buffer; 95 | do { 96 | //lock失败 直接brek出去 97 | if (ANativeWindow_lock(window, &window_buffer, 0)) { 98 | ANativeWindow_release(window); 99 | window = 0; 100 | break; 101 | } 102 | 103 | uint8_t *dst_data = static_cast(window_buffer.bits); 104 | //stride : 一行多少个数据 105 | //(RGBA) * 4 106 | int dst_linesize = window_buffer.stride * 4; 107 | 108 | //一行一行拷贝,src.data是图片的RGBA数据,要拷贝到dst_data中,也就是window的缓冲区里 109 | for (int i = 0; i < window_buffer.height; ++i) { 110 | memcpy(dst_data + i * dst_linesize, src.data + i * src.cols * 4, dst_linesize); 111 | } 112 | //提交刷新 113 | ANativeWindow_unlockAndPost(window); 114 | } while (0); 115 | 116 | 117 | } 118 | src.release(); 119 | gray.release(); 120 | env->ReleaseByteArrayElements(data_, data, 0); 121 | } 122 | 123 | 124 | extern "C" 125 | JNIEXPORT void JNICALL 126 | Java_com_yu_opencvdemo_OpencvJni_setSurface(JNIEnv *env, jobject instance, jobject surface) { 127 | 128 | if (window) { 129 | ANativeWindow_release(window); 130 | window = 0; 131 | } 132 | window = ANativeWindow_fromSurface(env, surface); 133 | 134 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yu/opencvdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.yu.opencvdemo; 2 | 3 | import android.hardware.Camera; 4 | import android.os.Environment; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.view.SurfaceHolder; 8 | import android.view.SurfaceView; 9 | import android.view.View; 10 | import android.widget.TextView; 11 | 12 | import com.yu.opencvdemo.util.CameraHelper; 13 | import com.yu.opencvdemo.util.Utils; 14 | 15 | import java.io.File; 16 | 17 | public class MainActivity extends AppCompatActivity implements SurfaceHolder.Callback, Camera.PreviewCallback { 18 | 19 | 20 | private OpencvJni openCvJni; 21 | private CameraHelper cameraHelper; 22 | int cameraId = Camera.CameraInfo.CAMERA_FACING_FRONT; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | 28 | setContentView(R.layout.activity_main); 29 | openCvJni = new OpencvJni(); 30 | SurfaceView surfaceView = findViewById(R.id.surfaceView); 31 | surfaceView.getHolder().addCallback(this); 32 | cameraHelper = new CameraHelper(cameraId); 33 | cameraHelper.setPreviewCallback(this); 34 | 35 | Utils.copyAssets(this, "lbpcascade_frontalface.xml"); 36 | } 37 | 38 | @Override 39 | protected void onResume() { 40 | super.onResume(); 41 | String path = new File(Environment.getExternalStorageDirectory(), "lbpcascade_frontalface.xml").getAbsolutePath(); 42 | cameraHelper.startPreview(); 43 | openCvJni.init(path); 44 | 45 | } 46 | 47 | @Override 48 | public void surfaceCreated(SurfaceHolder holder) { 49 | 50 | } 51 | 52 | @Override 53 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { 54 | openCvJni.setSurface(holder.getSurface()); 55 | } 56 | 57 | @Override 58 | public void surfaceDestroyed(SurfaceHolder holder) { 59 | 60 | } 61 | 62 | @Override 63 | public void onPreviewFrame(byte[] data, Camera camera) { 64 | openCvJni.postData(data, CameraHelper.WIDTH, CameraHelper.HEIGHT, cameraId); 65 | } 66 | 67 | public void switchCamera(View view) { 68 | cameraHelper.switchCamera(); 69 | cameraId = cameraHelper.getCameraId(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/yu/opencvdemo/OpencvJni.java: -------------------------------------------------------------------------------- 1 | package com.yu.opencvdemo; 2 | 3 | import android.view.Surface; 4 | 5 | public class OpencvJni { 6 | static { 7 | System.loadLibrary("native-lib"); 8 | } 9 | 10 | /** 11 | * 初始化native层相关逻辑 12 | * @param path 人脸识别模型路径 13 | */ 14 | public native void init(String path) ; 15 | 16 | /** 17 | * 摄像头采集的数据发送到native层 18 | * @param data 每一帧数据(NV21) 19 | * @param width 摄像头采集图片的宽 20 | * @param height 摄像头采集图片的高 21 | * @param cameraId 摄像头ID(前置、后置) 22 | */ 23 | public native void postData(byte[] data, int width, int height, int cameraId); 24 | 25 | /** 26 | * 发送Surface到native,用于把数据后的图像数据直接显示到Surface上 27 | * @param surface 28 | */ 29 | public native void setSurface(Surface surface); 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/yu/opencvdemo/util/CameraHelper.java: -------------------------------------------------------------------------------- 1 | package com.yu.opencvdemo.util; 2 | 3 | import android.graphics.ImageFormat; 4 | import android.graphics.SurfaceTexture; 5 | import android.hardware.Camera; 6 | 7 | import java.util.List; 8 | 9 | public class CameraHelper implements Camera.PreviewCallback { 10 | 11 | private static final String TAG = "CameraHelper"; 12 | public static final int WIDTH = 640; 13 | public static final int HEIGHT = 480; 14 | private int mCameraId; 15 | private Camera mCamera; 16 | private byte[] buffer; 17 | private Camera.PreviewCallback mPreviewCallback; 18 | 19 | public CameraHelper(int cameraId) { 20 | mCameraId = cameraId; 21 | } 22 | 23 | public void switchCamera() { 24 | if (mCameraId == Camera.CameraInfo.CAMERA_FACING_BACK) { 25 | mCameraId = Camera.CameraInfo.CAMERA_FACING_FRONT; 26 | } else { 27 | mCameraId = Camera.CameraInfo.CAMERA_FACING_BACK; 28 | } 29 | stopPreview(); 30 | startPreview(); 31 | } 32 | 33 | public int getCameraId() { 34 | return mCameraId; 35 | } 36 | 37 | public void stopPreview() { 38 | if (mCamera != null) { 39 | //预览数据回调接口 40 | mCamera.setPreviewCallback(null); 41 | //停止预览 42 | mCamera.stopPreview(); 43 | //释放摄像头 44 | mCamera.release(); 45 | mCamera = null; 46 | } 47 | } 48 | 49 | public void startPreview() { 50 | try { 51 | //获得camera对象 52 | mCamera = Camera.open(mCameraId); 53 | //配置camera的属性 54 | Camera.Parameters parameters = mCamera.getParameters(); 55 | //设置预览数据格式为nv21 56 | parameters.setPreviewFormat(ImageFormat.NV21); 57 | //这是摄像头宽、高 58 | parameters.setPreviewSize(WIDTH, HEIGHT); 59 | // 设置摄像头 图像传感器的角度、方向 60 | setFocusMode(parameters); 61 | mCamera.setParameters(parameters); 62 | buffer = new byte[WIDTH * HEIGHT * 3 / 2]; 63 | //数据缓存区 64 | mCamera.addCallbackBuffer(buffer); 65 | mCamera.setPreviewCallbackWithBuffer(this); 66 | //设置预览画面 67 | SurfaceTexture surfaceTexture = new SurfaceTexture(11); 68 | mCamera.setPreviewTexture(surfaceTexture); 69 | mCamera.startPreview(); 70 | } catch (Exception ex) { 71 | ex.printStackTrace(); 72 | } 73 | } 74 | 75 | 76 | public void setPreviewCallback(Camera.PreviewCallback previewCallback) { 77 | mPreviewCallback = previewCallback; 78 | } 79 | 80 | 81 | @Override 82 | public void onPreviewFrame(byte[] data, Camera camera) { 83 | mPreviewCallback.onPreviewFrame(data, camera); 84 | camera.addCallbackBuffer(buffer); 85 | } 86 | 87 | /** 88 | * 自动对焦 89 | * @param parameters 90 | */ 91 | private void setFocusMode(Camera.Parameters parameters) { 92 | List focusModes = parameters.getSupportedFocusModes(); 93 | if (focusModes != null 94 | && focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE)) { 95 | parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); 96 | } 97 | } 98 | 99 | 100 | 101 | } 102 | -------------------------------------------------------------------------------- /app/src/main/java/com/yu/opencvdemo/util/Utils.java: -------------------------------------------------------------------------------- 1 | package com.yu.opencvdemo.util; 2 | 3 | import android.content.Context; 4 | import android.os.Environment; 5 | 6 | import java.io.File; 7 | import java.io.FileOutputStream; 8 | import java.io.InputStream; 9 | 10 | /** 11 | * @author Lance 12 | * @date 2018/10/14 13 | */ 14 | public class Utils { 15 | 16 | public static void copyAssets(Context context, String path) { 17 | File model = new File(path); 18 | File file = new File(Environment.getExternalStorageDirectory(), model.getName()); 19 | if (file.exists()) { 20 | file.delete(); 21 | } 22 | try { 23 | FileOutputStream fos = new FileOutputStream(file); 24 | InputStream is = context.getAssets().open(path); 25 | int len; 26 | byte[] b = new byte[2048]; 27 | while ((len = is.read(b)) != -1) { 28 | fos.write(b, 0, len); 29 | } 30 | fos.close(); 31 | is.close(); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 18 |