├── .classpath ├── .cproject ├── .gitignore ├── .project ├── AlogLogo.xcf ├── AndroidManifest.xml ├── README.md ├── TesseractProjection_700.gif ├── jni ├── Android.mk ├── Application.mk ├── Matcher.cpp ├── Matcher.h ├── SfMmatcher.i ├── SfMmatcher_wrap.cpp ├── SfMpipeline.i ├── SfMpipeline_wrap.cpp ├── data.pb.cpp ├── data.pb.h ├── data.proto ├── frame.cpp ├── frame.h ├── libopencv_nonfree.a ├── libprotobuf.so ├── matches.pb.cpp ├── matches.pb.h └── matches.proto ├── libs ├── android-support-v4.jar ├── armeabi-v7a │ ├── libpipeline_native.so │ └── libprotobuf.so └── protobuf-java-2.4.1.jar ├── logo_google_developers.svg ├── proguard-project.txt ├── project.properties ├── res ├── drawable-xhdpi │ └── ic_launcher.png ├── layout │ ├── main.xml │ └── viewmats.xml ├── menu │ └── main.xml ├── values-large │ └── dimens.xml ├── values-v11 │ └── styles.xml ├── values-v14 │ └── styles.xml └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── src ├── cvg └── sfmPipeline │ └── main │ ├── FpsMeter.java │ ├── Frame.java │ ├── FrameProcess.java │ ├── Matcher.java │ ├── MatcherFLANN.java │ ├── MatchesOutMessage.java │ ├── PipelineActivity.java │ ├── PipelineCom.java │ ├── PipelineOutMessage.java │ ├── PipelineProcess.java │ ├── PipelineSharedData.java │ ├── ProtoWriter.java │ ├── SWIGTYPE_p_cv__Mat.java │ ├── SensorService.java │ ├── TCPread.java │ ├── Timer.java │ ├── UDPsend.java │ ├── UDPthread.java │ ├── VideoGrabber.java │ ├── sfmmatcher.java │ ├── sfmmatcherJNI.java │ ├── sfmpipeline.java │ └── sfmpipelineJNI.java ├── data.proto └── matches.proto /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | protobuf/ 15 | obj/ 16 | .settings/ 17 | 18 | # Local configuration file (sdk path, etc) 19 | local.properties 20 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | SfMpipeline 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | 11 | 12 | 13 | 14 | 15 | com.android.ide.eclipse.adt.ResourceManagerBuilder 16 | 17 | 18 | 19 | 20 | com.android.ide.eclipse.adt.PreCompilerBuilder 21 | 22 | 23 | 24 | 25 | org.eclipse.jdt.core.javabuilder 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.ApkBuilder 31 | 32 | 33 | 34 | 35 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 36 | full,incremental, 37 | 38 | 39 | 40 | 41 | 42 | com.android.ide.eclipse.adt.AndroidNature 43 | org.eclipse.jdt.core.javanature 44 | org.eclipse.cdt.core.cnature 45 | org.eclipse.cdt.core.ccnature 46 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 47 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 48 | 49 | 50 | -------------------------------------------------------------------------------- /AlogLogo.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/AlogLogo.xcf -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android-SfM-client 2 | ================== 3 | 4 | Full documentation at https://wiki.cvg.ethz.ch/doku.php?id=sfm:android 5 | 6 | 7 | Application to leverage a Structure from Motion pipeline by extracting features and matching frames onboard using OpenCV 2.4.2. The data gathered along with gravity sensor data is broadcasted via UDP serialized using Google's Protobuff. Multithreaded application using native C++ openCV code for SURF detection/extraction, creating and using C++ objects from Java using SWIG. 8 | 9 | Compilation Instructions 10 | ======================== 11 | 12 | In order to be able to compile the native code found in the jni/ folder, the Android NDK framework must be present, as well as OpenCV4Android > 2.4.2, on the target and host. 13 | The JNI makefile (Android.mk) has a machine-specific path for the OpenCV location, please change that line to match the location of the required file in your machine. Additionally, 14 | since starting from OpenCV4Android 2.4.2 the nonfree module is no longer included, you must add the header files manually to your OpenCV4Android header files. The compilation will 15 | refer to those files for compilation of the extraction and detection part in "frame.cpp". The actual static library is already included in the jni/ folder (libopencv_nonfree.a). This 16 | was compiled for armv7 architecture, so if you have a different architecture please recompile the OpenCV nonfree module for your specific target. To do so, download the latest OpenCV 17 | tarball for Linux, go into the android/ folder and follow the installation instructions there. -------------------------------------------------------------------------------- /TesseractProjection_700.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/TesseractProjection_700.gif -------------------------------------------------------------------------------- /jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE := libprotobuf 5 | LOCAL_SRC_FILES := libprotobuf.so 6 | 7 | include $(PREBUILT_SHARED_LIBRARY) 8 | 9 | include $(CLEAR_VARS) 10 | 11 | LOCAL_MODULE := opencv_nonfree 12 | LOCAL_SRC_FILES := libopencv_nonfree.a 13 | 14 | include $(PREBUILT_STATIC_LIBRARY) 15 | 16 | 17 | #include protobuf/Android.mk #comment all other lines and run ndk to recompile protobuf native share library 18 | 19 | include $(CLEAR_VARS) 20 | #LOCAL_PATH := $(call my-dir) 21 | LOCAL_PATH := /home/fede/workspace2/SfMpipeline/jni 22 | 23 | OPENCV_CAMERA_MODULES:=off 24 | 25 | OPENCV_MK_PATH:=/home/fede/apps/opencvAndroid-2.4.2/sdk/native/jni/OpenCV.mk 26 | #OPENCV_MK_PATH:=/home/fede/AndroidSDK/OpenCV-2.4.1-android/OpenCV-2.4.1/share/opencv/OpenCV.mk 27 | 28 | include $(OPENCV_MK_PATH) 29 | 30 | LOCAL_MODULE := pipeline_native 31 | LOCAL_SRC_FILES := frame.cpp data.pb.cpp Matcher.cpp matches.pb.cpp SfMmatcher_wrap.cpp 32 | LOCAL_CFLAGS := -frtti -g 33 | LOCAL_STATIC_LIBRARIES := opencv_nonfree 34 | LOCAL_LDLIBS += -llog -ldl jni/libprotobuf.so 35 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/../protobuf/src 36 | APP_OPTIM = debug 37 | 38 | include $(BUILD_SHARED_LIBRARY) 39 | -------------------------------------------------------------------------------- /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | APP_CPPFLAGS := -frtti -fexceptions 3 | APP_ABI := armeabi-v7a 4 | APP_MODULES := pipeline_native libprotobuf 5 | -------------------------------------------------------------------------------- /jni/Matcher.cpp: -------------------------------------------------------------------------------- 1 | #include "Matcher.h" 2 | #include "matches.pb.h" 3 | 4 | MatcherFLANN::MatcherFLANN(Frame & frame1, Frame & frame2) 5 | { 6 | first = frame1; 7 | second = frame2; 8 | } 9 | 10 | void MatcherFLANN::match(const cv::Mat &preDesc, const cv::Mat &curDesc, 11 | std::vector& matches) 12 | { 13 | matches.clear(); 14 | 15 | std::vector< cv::DMatch > raw_matches; 16 | 17 | cv::FlannBasedMatcher flannMatcher; 18 | flannMatcher.match(preDesc, curDesc, raw_matches); 19 | double max_dist = 0; double min_dist = 100; 20 | 21 | //-- Quick calculation of max and min distances between keypoints 22 | for( int i = 0; i < preDesc.rows; i++ ) 23 | { 24 | double dist = raw_matches[i].distance; 25 | if( dist < min_dist ) min_dist = dist; 26 | if( dist > max_dist ) max_dist = dist; 27 | } 28 | 29 | for( int i = 0; i < preDesc.rows; i++ ) 30 | { 31 | if( raw_matches[i].distance < 5*min_dist ) 32 | matches.push_back( raw_matches[i]); 33 | } 34 | } 35 | 36 | 37 | bool MatcherFLANN::matchFrames(int seq1, int seq2) 38 | { 39 | if(first.Descriptors.rows > 0 && second.Descriptors.rows > 0) 40 | { 41 | firstId = seq1; 42 | secondId = seq2; 43 | match(first.Descriptors, second.Descriptors, matchesFrames); 44 | return matchesFrames.size() > 0; 45 | }else 46 | return false; 47 | } 48 | 49 | bool MatcherFLANN::buildMatchProtoMessage() 50 | { 51 | if(matchesFrames.size() > 0) 52 | { 53 | sfm::MatchesProto matchProto; 54 | matchProto.set_imagelseq(firstId); 55 | matchProto.set_imagerseq(secondId); 56 | for(int i(0); i < matchesFrames.size(); i++) 57 | { 58 | sfm::DMatches * protoDMatches = matchProto.add_matches(); 59 | protoDMatches->set_distance(matchesFrames[i].distance); 60 | protoDMatches->set_imgidx(matchesFrames[i].imgIdx); 61 | protoDMatches->set_queryidx(matchesFrames[i].queryIdx); 62 | protoDMatches->set_trainidx(matchesFrames[i].trainIdx); 63 | } 64 | int size = matchProto.ByteSize(); 65 | signed char * buffer = new signed char[size]; 66 | bool protoGood = matchProto.SerializeToArray(buffer, size); 67 | outMatch = buffer; 68 | sizeOut = (size_t)size; 69 | 70 | return protoGood; 71 | }else 72 | return false; 73 | } 74 | -------------------------------------------------------------------------------- /jni/Matcher.h: -------------------------------------------------------------------------------- 1 | #ifndef MATCHER_H_ 2 | #define MATCHER_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "frame.h" 8 | 9 | class Matcher 10 | { 11 | 12 | }; 13 | 14 | class MatcherFLANN : public Matcher 15 | { 16 | private: 17 | Frame first; 18 | Frame second; 19 | int firstId; 20 | int secondId; 21 | std::vector matchesFrames; 22 | size_t sizeOut; 23 | signed char * outMatch; 24 | void match(const cv::Mat &, const cv::Mat &, std::vector& ); 25 | 26 | public: 27 | MatcherFLANN(Frame &, Frame &); 28 | bool matchFrames(int, int); 29 | bool buildMatchProtoMessage(); 30 | signed char * getMatches(size_t *len){*len = sizeOut; return outMatch;} 31 | }; 32 | 33 | #endif /* MATCHER_H_ */ 34 | -------------------------------------------------------------------------------- /jni/SfMmatcher.i: -------------------------------------------------------------------------------- 1 | %module sfmmatcher 2 | 3 | %{ 4 | 5 | #include "Matcher.h" 6 | #include "frame.h" 7 | %} 8 | 9 | %typemap(jni) signed char *getMatches "jbyteArray" 10 | %typemap(jtype) signed char *getMatches "byte[]" 11 | %typemap(jstype) signed char *getMatches "byte[]" 12 | %typemap(javaout) signed char *getMatches { 13 | return $jnicall; 14 | } 15 | %typemap(in,numinputs=0,noblock=1) size_t *len { 16 | size_t length=0; 17 | $1 = &length; 18 | } 19 | %typemap(out) signed char *getMatches { 20 | $result = JCALL1(NewByteArray, jenv, length); 21 | JCALL4(SetByteArrayRegion, jenv, $result, 0, length, $1); 22 | } 23 | 24 | %typemap(jni) signed char *getFrame "jbyteArray" 25 | %typemap(jtype) signed char *getFrame "byte[]" 26 | %typemap(jstype) signed char *getFrame "byte[]" 27 | %typemap(javaout) signed char *getFrame { 28 | return $jnicall; 29 | } 30 | %typemap(in,numinputs=0,noblock=1) size_t *len { 31 | size_t length=0; 32 | $1 = &length; 33 | } 34 | %typemap(out) signed char *getFrame { 35 | $result = JCALL1(NewByteArray, jenv, length); 36 | JCALL4(SetByteArrayRegion, jenv, $result, 0, length, $1); 37 | } 38 | 39 | %include "Matcher.h" 40 | %include "frame.h" -------------------------------------------------------------------------------- /jni/SfMmatcher_wrap.cpp: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.4 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | #define SWIGJAVA 12 | 13 | 14 | #ifdef __cplusplus 15 | /* SwigValueWrapper is described in swig.swg */ 16 | template class SwigValueWrapper { 17 | struct SwigMovePointer { 18 | T *ptr; 19 | SwigMovePointer(T *p) : ptr(p) { } 20 | ~SwigMovePointer() { delete ptr; } 21 | SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } 22 | } pointer; 23 | SwigValueWrapper& operator=(const SwigValueWrapper& rhs); 24 | SwigValueWrapper(const SwigValueWrapper& rhs); 25 | public: 26 | SwigValueWrapper() : pointer(0) { } 27 | SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } 28 | operator T&() const { return *pointer.ptr; } 29 | T *operator&() { return pointer.ptr; } 30 | }; 31 | 32 | template T SwigValueInit() { 33 | return T(); 34 | } 35 | #endif 36 | 37 | /* ----------------------------------------------------------------------------- 38 | * This section contains generic SWIG labels for method/variable 39 | * declarations/attributes, and other compiler dependent labels. 40 | * ----------------------------------------------------------------------------- */ 41 | 42 | /* template workaround for compilers that cannot correctly implement the C++ standard */ 43 | #ifndef SWIGTEMPLATEDISAMBIGUATOR 44 | # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) 45 | # define SWIGTEMPLATEDISAMBIGUATOR template 46 | # elif defined(__HP_aCC) 47 | /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ 48 | /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ 49 | # define SWIGTEMPLATEDISAMBIGUATOR template 50 | # else 51 | # define SWIGTEMPLATEDISAMBIGUATOR 52 | # endif 53 | #endif 54 | 55 | /* inline attribute */ 56 | #ifndef SWIGINLINE 57 | # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) 58 | # define SWIGINLINE inline 59 | # else 60 | # define SWIGINLINE 61 | # endif 62 | #endif 63 | 64 | /* attribute recognised by some compilers to avoid 'unused' warnings */ 65 | #ifndef SWIGUNUSED 66 | # if defined(__GNUC__) 67 | # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 68 | # define SWIGUNUSED __attribute__ ((__unused__)) 69 | # else 70 | # define SWIGUNUSED 71 | # endif 72 | # elif defined(__ICC) 73 | # define SWIGUNUSED __attribute__ ((__unused__)) 74 | # else 75 | # define SWIGUNUSED 76 | # endif 77 | #endif 78 | 79 | #ifndef SWIG_MSC_UNSUPPRESS_4505 80 | # if defined(_MSC_VER) 81 | # pragma warning(disable : 4505) /* unreferenced local function has been removed */ 82 | # endif 83 | #endif 84 | 85 | #ifndef SWIGUNUSEDPARM 86 | # ifdef __cplusplus 87 | # define SWIGUNUSEDPARM(p) 88 | # else 89 | # define SWIGUNUSEDPARM(p) p SWIGUNUSED 90 | # endif 91 | #endif 92 | 93 | /* internal SWIG method */ 94 | #ifndef SWIGINTERN 95 | # define SWIGINTERN static SWIGUNUSED 96 | #endif 97 | 98 | /* internal inline SWIG method */ 99 | #ifndef SWIGINTERNINLINE 100 | # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE 101 | #endif 102 | 103 | /* exporting methods */ 104 | #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 105 | # ifndef GCC_HASCLASSVISIBILITY 106 | # define GCC_HASCLASSVISIBILITY 107 | # endif 108 | #endif 109 | 110 | #ifndef SWIGEXPORT 111 | # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 112 | # if defined(STATIC_LINKED) 113 | # define SWIGEXPORT 114 | # else 115 | # define SWIGEXPORT __declspec(dllexport) 116 | # endif 117 | # else 118 | # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) 119 | # define SWIGEXPORT __attribute__ ((visibility("default"))) 120 | # else 121 | # define SWIGEXPORT 122 | # endif 123 | # endif 124 | #endif 125 | 126 | /* calling conventions for Windows */ 127 | #ifndef SWIGSTDCALL 128 | # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 129 | # define SWIGSTDCALL __stdcall 130 | # else 131 | # define SWIGSTDCALL 132 | # endif 133 | #endif 134 | 135 | /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ 136 | #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) 137 | # define _CRT_SECURE_NO_DEPRECATE 138 | #endif 139 | 140 | /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ 141 | #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) 142 | # define _SCL_SECURE_NO_DEPRECATE 143 | #endif 144 | 145 | 146 | 147 | /* Fix for jlong on some versions of gcc on Windows */ 148 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) 149 | typedef long long __int64; 150 | #endif 151 | 152 | /* Fix for jlong on 64-bit x86 Solaris */ 153 | #if defined(__x86_64) 154 | # ifdef _LP64 155 | # undef _LP64 156 | # endif 157 | #endif 158 | 159 | #include 160 | #include 161 | #include 162 | 163 | 164 | /* Support for throwing Java exceptions */ 165 | typedef enum { 166 | SWIG_JavaOutOfMemoryError = 1, 167 | SWIG_JavaIOException, 168 | SWIG_JavaRuntimeException, 169 | SWIG_JavaIndexOutOfBoundsException, 170 | SWIG_JavaArithmeticException, 171 | SWIG_JavaIllegalArgumentException, 172 | SWIG_JavaNullPointerException, 173 | SWIG_JavaDirectorPureVirtual, 174 | SWIG_JavaUnknownError 175 | } SWIG_JavaExceptionCodes; 176 | 177 | typedef struct { 178 | SWIG_JavaExceptionCodes code; 179 | const char *java_exception; 180 | } SWIG_JavaExceptions_t; 181 | 182 | 183 | static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { 184 | jclass excep; 185 | static const SWIG_JavaExceptions_t java_exceptions[] = { 186 | { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, 187 | { SWIG_JavaIOException, "java/io/IOException" }, 188 | { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, 189 | { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, 190 | { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, 191 | { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, 192 | { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, 193 | { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, 194 | { SWIG_JavaUnknownError, "java/lang/UnknownError" }, 195 | { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } 196 | }; 197 | const SWIG_JavaExceptions_t *except_ptr = java_exceptions; 198 | 199 | while (except_ptr->code != code && except_ptr->code) 200 | except_ptr++; 201 | 202 | jenv->ExceptionClear(); 203 | excep = jenv->FindClass(except_ptr->java_exception); 204 | if (excep) 205 | jenv->ThrowNew(excep, msg); 206 | } 207 | 208 | 209 | /* Contract support */ 210 | 211 | #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else 212 | 213 | 214 | 215 | #include "Matcher.h" 216 | #include "frame.h" 217 | 218 | 219 | #ifdef __cplusplus 220 | extern "C" { 221 | #endif 222 | 223 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_new_1Matcher(JNIEnv *jenv, jclass jcls) { 224 | jlong jresult = 0 ; 225 | Matcher *result = 0 ; 226 | 227 | (void)jenv; 228 | (void)jcls; 229 | result = (Matcher *)new Matcher(); 230 | *(Matcher **)&jresult = result; 231 | return jresult; 232 | } 233 | 234 | 235 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_delete_1Matcher(JNIEnv *jenv, jclass jcls, jlong jarg1) { 236 | Matcher *arg1 = (Matcher *) 0 ; 237 | 238 | (void)jenv; 239 | (void)jcls; 240 | arg1 = *(Matcher **)&jarg1; 241 | delete arg1; 242 | } 243 | 244 | 245 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_new_1MatcherFLANN(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) { 246 | jlong jresult = 0 ; 247 | Frame arg1 ; 248 | Frame arg2 ; 249 | Frame *argp1 ; 250 | Frame *argp2 ; 251 | MatcherFLANN *result = 0 ; 252 | 253 | (void)jenv; 254 | (void)jcls; 255 | (void)jarg1_; 256 | (void)jarg2_; 257 | argp1 = *(Frame **)&jarg1; 258 | if (!argp1) { 259 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Frame"); 260 | return 0; 261 | } 262 | arg1 = *argp1; 263 | argp2 = *(Frame **)&jarg2; 264 | if (!argp2) { 265 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null Frame"); 266 | return 0; 267 | } 268 | arg2 = *argp2; 269 | result = (MatcherFLANN *)new MatcherFLANN(arg1,arg2); 270 | *(MatcherFLANN **)&jresult = result; 271 | return jresult; 272 | } 273 | 274 | 275 | SWIGEXPORT jboolean JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_MatcherFLANN_1matchFrames(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3) { 276 | jboolean jresult = 0 ; 277 | MatcherFLANN *arg1 = (MatcherFLANN *) 0 ; 278 | int arg2 ; 279 | int arg3 ; 280 | bool result; 281 | 282 | (void)jenv; 283 | (void)jcls; 284 | (void)jarg1_; 285 | arg1 = *(MatcherFLANN **)&jarg1; 286 | arg2 = (int)jarg2; 287 | arg3 = (int)jarg3; 288 | result = (bool)(arg1)->matchFrames(arg2,arg3); 289 | jresult = (jboolean)result; 290 | return jresult; 291 | } 292 | 293 | 294 | SWIGEXPORT jboolean JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_MatcherFLANN_1buildMatchProtoMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 295 | jboolean jresult = 0 ; 296 | MatcherFLANN *arg1 = (MatcherFLANN *) 0 ; 297 | bool result; 298 | 299 | (void)jenv; 300 | (void)jcls; 301 | (void)jarg1_; 302 | arg1 = *(MatcherFLANN **)&jarg1; 303 | result = (bool)(arg1)->buildMatchProtoMessage(); 304 | jresult = (jboolean)result; 305 | return jresult; 306 | } 307 | 308 | 309 | SWIGEXPORT jbyteArray JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_MatcherFLANN_1getMatches(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 310 | jbyteArray jresult = 0 ; 311 | MatcherFLANN *arg1 = (MatcherFLANN *) 0 ; 312 | size_t *arg2 = (size_t *) 0 ; 313 | signed char *result = 0 ; 314 | 315 | (void)jenv; 316 | (void)jcls; 317 | size_t length=0; 318 | arg2 = &length; 319 | (void)jarg1_; 320 | arg1 = *(MatcherFLANN **)&jarg1; 321 | result = (signed char *)(arg1)->getMatches(arg2); 322 | { 323 | jresult = jenv->NewByteArray(length); 324 | jenv->SetByteArrayRegion(jresult, 0, length, result); 325 | } 326 | return jresult; 327 | } 328 | 329 | 330 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_delete_1MatcherFLANN(JNIEnv *jenv, jclass jcls, jlong jarg1) { 331 | MatcherFLANN *arg1 = (MatcherFLANN *) 0 ; 332 | 333 | (void)jenv; 334 | (void)jcls; 335 | arg1 = *(MatcherFLANN **)&jarg1; 336 | delete arg1; 337 | } 338 | 339 | 340 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_new_1Frame_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { 341 | jlong jresult = 0 ; 342 | Frame *result = 0 ; 343 | 344 | (void)jenv; 345 | (void)jcls; 346 | result = (Frame *)new Frame(); 347 | *(Frame **)&jresult = result; 348 | return jresult; 349 | } 350 | 351 | 352 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_new_1Frame_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { 353 | jlong jresult = 0 ; 354 | cv::Mat *arg1 = 0 ; 355 | Frame *result = 0 ; 356 | 357 | (void)jenv; 358 | (void)jcls; 359 | arg1 = *(cv::Mat **)&jarg1; 360 | if (!arg1) { 361 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "cv::Mat & reference is null"); 362 | return 0; 363 | } 364 | result = (Frame *)new Frame(*arg1); 365 | *(Frame **)&jresult = result; 366 | return jresult; 367 | } 368 | 369 | 370 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1extractFeatures(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 371 | Frame *arg1 = (Frame *) 0 ; 372 | 373 | (void)jenv; 374 | (void)jcls; 375 | (void)jarg1_; 376 | arg1 = *(Frame **)&jarg1; 377 | (arg1)->extractFeatures(); 378 | } 379 | 380 | 381 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1addFrame(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { 382 | Frame *arg1 = (Frame *) 0 ; 383 | cv::Mat *arg2 = 0 ; 384 | 385 | (void)jenv; 386 | (void)jcls; 387 | (void)jarg1_; 388 | arg1 = *(Frame **)&jarg1; 389 | arg2 = *(cv::Mat **)&jarg2; 390 | if (!arg2) { 391 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "cv::Mat & reference is null"); 392 | return ; 393 | } 394 | (arg1)->addFrame(*arg2); 395 | } 396 | 397 | 398 | SWIGEXPORT jboolean JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1buildFrameProtoMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { 399 | jboolean jresult = 0 ; 400 | Frame *arg1 = (Frame *) 0 ; 401 | bool arg2 ; 402 | bool result; 403 | 404 | (void)jenv; 405 | (void)jcls; 406 | (void)jarg1_; 407 | arg1 = *(Frame **)&jarg1; 408 | arg2 = jarg2 ? true : false; 409 | result = (bool)(arg1)->buildFrameProtoMessage(arg2); 410 | jresult = (jboolean)result; 411 | return jresult; 412 | } 413 | 414 | 415 | SWIGEXPORT jbyteArray JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1getFrame(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 416 | jbyteArray jresult = 0 ; 417 | Frame *arg1 = (Frame *) 0 ; 418 | size_t *arg2 = (size_t *) 0 ; 419 | signed char *result = 0 ; 420 | 421 | (void)jenv; 422 | (void)jcls; 423 | size_t length=0; 424 | arg2 = &length; 425 | (void)jarg1_; 426 | arg1 = *(Frame **)&jarg1; 427 | result = (signed char *)(arg1)->getFrame(arg2); 428 | { 429 | jresult = jenv->NewByteArray(length); 430 | jenv->SetByteArrayRegion(jresult, 0, length, result); 431 | } 432 | return jresult; 433 | } 434 | 435 | 436 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1Descriptors_1set(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { 437 | Frame *arg1 = (Frame *) 0 ; 438 | cv::Mat arg2 ; 439 | cv::Mat *argp2 ; 440 | 441 | (void)jenv; 442 | (void)jcls; 443 | (void)jarg1_; 444 | arg1 = *(Frame **)&jarg1; 445 | argp2 = *(cv::Mat **)&jarg2; 446 | if (!argp2) { 447 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null cv::Mat"); 448 | return ; 449 | } 450 | arg2 = *argp2; 451 | if (arg1) (arg1)->Descriptors = arg2; 452 | } 453 | 454 | 455 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_Frame_1Descriptors_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 456 | jlong jresult = 0 ; 457 | Frame *arg1 = (Frame *) 0 ; 458 | cv::Mat result; 459 | 460 | (void)jenv; 461 | (void)jcls; 462 | (void)jarg1_; 463 | arg1 = *(Frame **)&jarg1; 464 | result = ((arg1)->Descriptors); 465 | *(cv::Mat **)&jresult = new cv::Mat((const cv::Mat &)result); 466 | return jresult; 467 | } 468 | 469 | 470 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_delete_1Frame(JNIEnv *jenv, jclass jcls, jlong jarg1) { 471 | Frame *arg1 = (Frame *) 0 ; 472 | 473 | (void)jenv; 474 | (void)jcls; 475 | arg1 = *(Frame **)&jarg1; 476 | delete arg1; 477 | } 478 | 479 | 480 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmmatcherJNI_MatcherFLANN_1SWIGUpcast(JNIEnv *jenv, jclass jcls, jlong jarg1) { 481 | jlong baseptr = 0; 482 | (void)jenv; 483 | (void)jcls; 484 | *(Matcher **)&baseptr = *(MatcherFLANN **)&jarg1; 485 | return baseptr; 486 | } 487 | 488 | #ifdef __cplusplus 489 | } 490 | #endif 491 | 492 | -------------------------------------------------------------------------------- /jni/SfMpipeline.i: -------------------------------------------------------------------------------- 1 | %module sfmpipeline 2 | 3 | %{ 4 | #include "frame.h" 5 | %} 6 | 7 | %typemap(jni) signed char *getFrame "jbyteArray" 8 | %typemap(jtype) signed char *getFrame "byte[]" 9 | %typemap(jstype) signed char *getFrame "byte[]" 10 | %typemap(javaout) signed char *getFrame { 11 | return $jnicall; 12 | } 13 | %typemap(in,numinputs=0,noblock=1) size_t *len { 14 | size_t length=0; 15 | $1 = &length; 16 | } 17 | %typemap(out) signed char *getFrame { 18 | $result = JCALL1(NewByteArray, jenv, length); 19 | JCALL4(SetByteArrayRegion, jenv, $result, 0, length, $1); 20 | } 21 | 22 | 23 | %include "frame.h" -------------------------------------------------------------------------------- /jni/SfMpipeline_wrap.cpp: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------------- 2 | * This file was automatically generated by SWIG (http://www.swig.org). 3 | * Version 2.0.4 4 | * 5 | * This file is not intended to be easily readable and contains a number of 6 | * coding conventions designed to improve portability and efficiency. Do not make 7 | * changes to this file unless you know what you are doing--modify the SWIG 8 | * interface file instead. 9 | * ----------------------------------------------------------------------------- */ 10 | 11 | #define SWIGJAVA 12 | 13 | 14 | #ifdef __cplusplus 15 | /* SwigValueWrapper is described in swig.swg */ 16 | template class SwigValueWrapper { 17 | struct SwigMovePointer { 18 | T *ptr; 19 | SwigMovePointer(T *p) : ptr(p) { } 20 | ~SwigMovePointer() { delete ptr; } 21 | SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; } 22 | } pointer; 23 | SwigValueWrapper& operator=(const SwigValueWrapper& rhs); 24 | SwigValueWrapper(const SwigValueWrapper& rhs); 25 | public: 26 | SwigValueWrapper() : pointer(0) { } 27 | SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; } 28 | operator T&() const { return *pointer.ptr; } 29 | T *operator&() { return pointer.ptr; } 30 | }; 31 | 32 | template T SwigValueInit() { 33 | return T(); 34 | } 35 | #endif 36 | 37 | /* ----------------------------------------------------------------------------- 38 | * This section contains generic SWIG labels for method/variable 39 | * declarations/attributes, and other compiler dependent labels. 40 | * ----------------------------------------------------------------------------- */ 41 | 42 | /* template workaround for compilers that cannot correctly implement the C++ standard */ 43 | #ifndef SWIGTEMPLATEDISAMBIGUATOR 44 | # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) 45 | # define SWIGTEMPLATEDISAMBIGUATOR template 46 | # elif defined(__HP_aCC) 47 | /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ 48 | /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ 49 | # define SWIGTEMPLATEDISAMBIGUATOR template 50 | # else 51 | # define SWIGTEMPLATEDISAMBIGUATOR 52 | # endif 53 | #endif 54 | 55 | /* inline attribute */ 56 | #ifndef SWIGINLINE 57 | # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) 58 | # define SWIGINLINE inline 59 | # else 60 | # define SWIGINLINE 61 | # endif 62 | #endif 63 | 64 | /* attribute recognised by some compilers to avoid 'unused' warnings */ 65 | #ifndef SWIGUNUSED 66 | # if defined(__GNUC__) 67 | # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 68 | # define SWIGUNUSED __attribute__ ((__unused__)) 69 | # else 70 | # define SWIGUNUSED 71 | # endif 72 | # elif defined(__ICC) 73 | # define SWIGUNUSED __attribute__ ((__unused__)) 74 | # else 75 | # define SWIGUNUSED 76 | # endif 77 | #endif 78 | 79 | #ifndef SWIG_MSC_UNSUPPRESS_4505 80 | # if defined(_MSC_VER) 81 | # pragma warning(disable : 4505) /* unreferenced local function has been removed */ 82 | # endif 83 | #endif 84 | 85 | #ifndef SWIGUNUSEDPARM 86 | # ifdef __cplusplus 87 | # define SWIGUNUSEDPARM(p) 88 | # else 89 | # define SWIGUNUSEDPARM(p) p SWIGUNUSED 90 | # endif 91 | #endif 92 | 93 | /* internal SWIG method */ 94 | #ifndef SWIGINTERN 95 | # define SWIGINTERN static SWIGUNUSED 96 | #endif 97 | 98 | /* internal inline SWIG method */ 99 | #ifndef SWIGINTERNINLINE 100 | # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE 101 | #endif 102 | 103 | /* exporting methods */ 104 | #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) 105 | # ifndef GCC_HASCLASSVISIBILITY 106 | # define GCC_HASCLASSVISIBILITY 107 | # endif 108 | #endif 109 | 110 | #ifndef SWIGEXPORT 111 | # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 112 | # if defined(STATIC_LINKED) 113 | # define SWIGEXPORT 114 | # else 115 | # define SWIGEXPORT __declspec(dllexport) 116 | # endif 117 | # else 118 | # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) 119 | # define SWIGEXPORT __attribute__ ((visibility("default"))) 120 | # else 121 | # define SWIGEXPORT 122 | # endif 123 | # endif 124 | #endif 125 | 126 | /* calling conventions for Windows */ 127 | #ifndef SWIGSTDCALL 128 | # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 129 | # define SWIGSTDCALL __stdcall 130 | # else 131 | # define SWIGSTDCALL 132 | # endif 133 | #endif 134 | 135 | /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ 136 | #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) 137 | # define _CRT_SECURE_NO_DEPRECATE 138 | #endif 139 | 140 | /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ 141 | #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) 142 | # define _SCL_SECURE_NO_DEPRECATE 143 | #endif 144 | 145 | 146 | 147 | /* Fix for jlong on some versions of gcc on Windows */ 148 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER) 149 | typedef long long __int64; 150 | #endif 151 | 152 | /* Fix for jlong on 64-bit x86 Solaris */ 153 | #if defined(__x86_64) 154 | # ifdef _LP64 155 | # undef _LP64 156 | # endif 157 | #endif 158 | 159 | #include 160 | #include 161 | #include 162 | 163 | 164 | /* Support for throwing Java exceptions */ 165 | typedef enum { 166 | SWIG_JavaOutOfMemoryError = 1, 167 | SWIG_JavaIOException, 168 | SWIG_JavaRuntimeException, 169 | SWIG_JavaIndexOutOfBoundsException, 170 | SWIG_JavaArithmeticException, 171 | SWIG_JavaIllegalArgumentException, 172 | SWIG_JavaNullPointerException, 173 | SWIG_JavaDirectorPureVirtual, 174 | SWIG_JavaUnknownError 175 | } SWIG_JavaExceptionCodes; 176 | 177 | typedef struct { 178 | SWIG_JavaExceptionCodes code; 179 | const char *java_exception; 180 | } SWIG_JavaExceptions_t; 181 | 182 | 183 | static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { 184 | jclass excep; 185 | static const SWIG_JavaExceptions_t java_exceptions[] = { 186 | { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, 187 | { SWIG_JavaIOException, "java/io/IOException" }, 188 | { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, 189 | { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, 190 | { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, 191 | { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, 192 | { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, 193 | { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, 194 | { SWIG_JavaUnknownError, "java/lang/UnknownError" }, 195 | { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } 196 | }; 197 | const SWIG_JavaExceptions_t *except_ptr = java_exceptions; 198 | 199 | while (except_ptr->code != code && except_ptr->code) 200 | except_ptr++; 201 | 202 | jenv->ExceptionClear(); 203 | excep = jenv->FindClass(except_ptr->java_exception); 204 | if (excep) 205 | jenv->ThrowNew(excep, msg); 206 | } 207 | 208 | 209 | /* Contract support */ 210 | 211 | #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else 212 | 213 | 214 | #include "frame.h" 215 | 216 | 217 | #ifdef __cplusplus 218 | extern "C" { 219 | #endif 220 | 221 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_new_1Frame_1_1SWIG_10(JNIEnv *jenv, jclass jcls) { 222 | jlong jresult = 0 ; 223 | Frame *result = 0 ; 224 | 225 | (void)jenv; 226 | (void)jcls; 227 | result = (Frame *)new Frame(); 228 | *(Frame **)&jresult = result; 229 | return jresult; 230 | } 231 | 232 | 233 | SWIGEXPORT jlong JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_new_1Frame_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1) { 234 | jlong jresult = 0 ; 235 | cv::Mat *arg1 = 0 ; 236 | Frame *result = 0 ; 237 | 238 | (void)jenv; 239 | (void)jcls; 240 | arg1 = *(cv::Mat **)&jarg1; 241 | if (!arg1) { 242 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "cv::Mat & reference is null"); 243 | return 0; 244 | } 245 | result = (Frame *)new Frame(*arg1); 246 | *(Frame **)&jresult = result; 247 | return jresult; 248 | } 249 | 250 | 251 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_Frame_1extractFeatures(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 252 | Frame *arg1 = (Frame *) 0 ; 253 | 254 | (void)jenv; 255 | (void)jcls; 256 | (void)jarg1_; 257 | arg1 = *(Frame **)&jarg1; 258 | (arg1)->extractFeatures(); 259 | } 260 | 261 | 262 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_Frame_1addFrame(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2) { 263 | Frame *arg1 = (Frame *) 0 ; 264 | cv::Mat *arg2 = 0 ; 265 | 266 | (void)jenv; 267 | (void)jcls; 268 | (void)jarg1_; 269 | arg1 = *(Frame **)&jarg1; 270 | arg2 = *(cv::Mat **)&jarg2; 271 | if (!arg2) { 272 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "cv::Mat & reference is null"); 273 | return ; 274 | } 275 | (arg1)->addFrame(*arg2); 276 | } 277 | 278 | 279 | SWIGEXPORT jboolean JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_Frame_1buildFrameProtoMessage(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jboolean jarg2) { 280 | jboolean jresult = 0 ; 281 | Frame *arg1 = (Frame *) 0 ; 282 | bool arg2 ; 283 | bool result; 284 | 285 | (void)jenv; 286 | (void)jcls; 287 | (void)jarg1_; 288 | arg1 = *(Frame **)&jarg1; 289 | arg2 = jarg2 ? true : false; 290 | result = (bool)(arg1)->buildFrameProtoMessage(arg2); 291 | jresult = (jboolean)result; 292 | return jresult; 293 | } 294 | 295 | 296 | SWIGEXPORT jbyteArray JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_Frame_1getFrame(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { 297 | jbyteArray jresult = 0 ; 298 | Frame *arg1 = (Frame *) 0 ; 299 | size_t *arg2 = (size_t *) 0 ; 300 | signed char *result = 0 ; 301 | 302 | (void)jenv; 303 | (void)jcls; 304 | size_t length=0; 305 | arg2 = &length; 306 | (void)jarg1_; 307 | arg1 = *(Frame **)&jarg1; 308 | result = (signed char *)(arg1)->getFrame(arg2); 309 | { 310 | jresult = jenv->NewByteArray(length); 311 | jenv->SetByteArrayRegion(jresult, 0, length, result); 312 | } 313 | return jresult; 314 | } 315 | 316 | 317 | SWIGEXPORT void JNICALL Java_cvg_sfmPipeline_main_sfmpipelineJNI_delete_1Frame(JNIEnv *jenv, jclass jcls, jlong jarg1) { 318 | Frame *arg1 = (Frame *) 0 ; 319 | 320 | (void)jenv; 321 | (void)jcls; 322 | arg1 = *(Frame **)&jarg1; 323 | delete arg1; 324 | } 325 | 326 | 327 | #ifdef __cplusplus 328 | } 329 | #endif 330 | 331 | -------------------------------------------------------------------------------- /jni/data.proto: -------------------------------------------------------------------------------- 1 | package sfm; 2 | 3 | option java_package = "cvg.sfmPipeline.main"; 4 | option java_outer_classname = "PipelineOutMessage"; 5 | 6 | message CvMatDimProto { 7 | optional int32 size = 1; 8 | optional int32 step = 2; 9 | } 10 | 11 | message cvMatProto { 12 | optional int32 n_dims = 1; 13 | repeated CvMatDimProto dims = 2; 14 | optional int32 type = 3; 15 | optional bytes bytedata = 4; 16 | enum ImageType { 17 | cvMat = 0; 18 | JPEG = 1; 19 | RAW = 2; 20 | } 21 | optional ImageType format = 5 [default = cvMat]; 22 | } 23 | 24 | message Keypoints { 25 | message cvKeypoint{ 26 | optional float ptX = 1; 27 | optional float ptY = 2; 28 | optional float size = 3; 29 | optional float angle = 4 [default = -1]; 30 | optional float response = 5; 31 | optional int32 octave = 6; 32 | optional int32 class_id = 7; 33 | } 34 | repeated cvKeypoint keypoints = 1; 35 | } 36 | 37 | message CameraMatrixProto { 38 | repeated float data = 1; 39 | } 40 | 41 | message CameraBodyTransProto { 42 | repeated float data = 1; 43 | } 44 | 45 | message MetadataProto { 46 | optional float ang_x = 1; 47 | optional float ang_y = 2; 48 | optional float ang_z = 3; 49 | optional float pos_x = 4; 50 | optional float pos_y = 5; 51 | optional float pos_z = 6; 52 | 53 | enum SensorType { 54 | ACCEL = 0; 55 | GYRO = 1; 56 | MAGNETO = 2; 57 | LINACCEL = 3; 58 | ORIENTATION = 4; 59 | GRAVITY = 5; 60 | ROTVECT = 6; 61 | } 62 | 63 | optional fixed64 timestamp = 7; 64 | optional float val_0 = 8; 65 | optional float val_1 = 9; 66 | optional float val_2 = 10; 67 | optional SensorType type = 11 [default = GRAVITY]; 68 | } 69 | 70 | message CvRectProto { 71 | optional int32 x = 1; 72 | optional int32 y = 2; 73 | optional int32 width = 3; 74 | optional int32 height = 4; 75 | } 76 | 77 | message FrameProto { 78 | repeated cvMatProto images = 1; 79 | optional CameraMatrixProto cameraMatrix = 2; 80 | optional CameraBodyTransProto cameraBodyTrans = 3; 81 | optional MetadataProto metadata = 4; 82 | optional fixed64 id = 5; 83 | optional fixed64 seq = 6; 84 | optional float baseline = 8; 85 | optional CvRectProto roi = 9; 86 | optional Keypoints keypoints = 10; 87 | optional cvMatProto descriptors = 11; 88 | 89 | } 90 | -------------------------------------------------------------------------------- /jni/frame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | 20 | #include "frame.h" 21 | #include 22 | #include 23 | #include 24 | 25 | Frame::Frame() 26 | { 27 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Constructor 1"); 28 | // initialization of some fields 29 | x_subs = 3; 30 | y_subs = 3; 31 | for (size_t i = 0; i < x_subs*y_subs; i++) 32 | { 33 | curr_hess_thresholds.push_back(3); 34 | } 35 | 36 | } 37 | 38 | Frame::Frame(cv::Mat & input) 39 | { 40 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Constructor 2"); 41 | input.copyTo(image); 42 | } 43 | 44 | void 45 | Frame::addFrame(cv::Mat & input) 46 | { 47 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Add image method."); 48 | 49 | if(!image.empty()) 50 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Image will be overwritten"); 51 | 52 | input.copyTo(image); 53 | } 54 | 55 | void 56 | Frame::extractFeatures(){ 57 | double tic = (double)cv::getCPUTickCount(); 58 | // cv::Mat imageIn = image; 59 | // float hess_thresholds[] = { 25, 50, 100, 200, 300, 400, 600, 800, 1000, 1500, 2000, 4000, 8000, 12000, 16000 }; 60 | // size_t max_thresholds = sizeof(hess_thresholds) / sizeof(hess_thresholds[0]); 61 | // 62 | // std::vector detectors(x_subs*y_subs); 63 | // 64 | // for (size_t i = 0; i < detectors.size(); i++) 65 | // { 66 | // std::vector keypoints; 67 | // detectors[i] = cv::SurfFeatureDetector(hess_thresholds[curr_hess_thresholds[i]]); 68 | // int xstart = 0 + (i%x_subs)*imageIn.cols/x_subs - (i%x_subs)*20; 69 | // int xend = 0 + ((i%x_subs)+1)*imageIn.cols/x_subs; 70 | // int ystart = 0 + (i/y_subs)*imageIn.rows/y_subs - (i/y_subs)*20; 71 | // int yend = 0 + ((i/y_subs)+1)*imageIn.rows/y_subs; 72 | // cv::Mat detImage = imageIn(cv::Range(ystart, yend), cv::Range(xstart, xend)); 73 | // 74 | // detectors[i].detect(detImage, keypoints); 75 | // 76 | // if (keypoints.size() > 100) curr_hess_thresholds[i] = (curr_hess_thresholds[i] + 1 < max_thresholds ? curr_hess_thresholds[i] + 1 : curr_hess_thresholds[i]); 77 | // if (keypoints.size() < 60) curr_hess_thresholds[i] = (curr_hess_thresholds[i] - 1 > 0 ? curr_hess_thresholds[i] - 1 : curr_hess_thresholds[i]); 78 | // 79 | // for (size_t k = 0; k < keypoints.size(); k++) 80 | // { 81 | // keypoints[k].pt.x += xstart; 82 | // keypoints[k].pt.y += ystart; 83 | // if (keypoints.at(k).pt.x > 0 && keypoints.at(k).pt.x < imageIn.cols && keypoints.at(k).pt.y > 0 && keypoints.at(k).pt.y < imageIn.cols) 84 | // { 85 | // Keypoints.push_back(keypoints.at(k)); 86 | // } 87 | // } 88 | // } 89 | // cv::SurfDescriptorExtractor extractor; 90 | // extractor.compute(imageIn, Keypoints, Descriptors); 91 | 92 | cv::SURF surfObj = cv::SURF(500); // extended SURF 93 | // surfObj.detect(image, Keypoints); 94 | surfObj.operator ()(image, cv::noArray(), Keypoints, Descriptors, false); 95 | 96 | double toc = ((double)cv::getCPUTickCount() - tic)/cv::getTickFrequency(); 97 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Keypoints %d, computed in %lf ms", Keypoints.size(), toc*1000); 98 | } 99 | 100 | 101 | void 102 | Frame::writeProtoMat(sfm::cvMatProto & proto, cv::Mat & mat) 103 | { 104 | proto.set_n_dims(mat.dims); 105 | size_t databytes = 0; 106 | for (int i = 0; i < mat.dims; i++) 107 | { 108 | sfm::CvMatDimProto *cur_dim = proto.add_dims(); 109 | cur_dim->set_size(mat.size.p[i]); 110 | cur_dim->set_step(mat.step.p[i]); 111 | databytes += mat.size.p[i]*mat.step.p[i]; 112 | } 113 | proto.set_type(mat.type()); 114 | proto.set_bytedata((char *)(mat.data), databytes); 115 | } 116 | 117 | 118 | /** 119 | * Will build a regular proto message using the last image data 120 | * */ 121 | bool 122 | Frame::buildFrameProtoMessage(bool doJPEG) 123 | { sfm::FrameProto frameProto; 124 | __android_log_print(ANDROID_LOG_ERROR, "Native","Building protobuf message"); 125 | bool jpegGood = true; 126 | bool protoGood = true; 127 | if (Keypoints.size() > 0 && Descriptors.rows > 0) 128 | { 129 | __android_log_print(ANDROID_LOG_ERROR, "Native", "First kpt: %f", Keypoints[0].pt.x); 130 | sfm::cvMatProto * descriptorsProto = frameProto.mutable_descriptors(); 131 | writeProtoMat(*descriptorsProto, Descriptors); 132 | sfm::Keypoints * keypointsProto = frameProto.mutable_keypoints(); 133 | for (int i = 0; i < Keypoints.size(); i++) 134 | { 135 | sfm::Keypoints_cvKeypoint * keypointPb = keypointsProto->add_keypoints(); 136 | cv::KeyPoint keypointCV = Keypoints[i]; 137 | keypointPb->set_ptx(keypointCV.pt.x); 138 | keypointPb->set_pty(keypointCV.pt.y); 139 | keypointPb->set_angle(keypointCV.angle); 140 | keypointPb->set_octave(keypointCV.octave); 141 | keypointPb->set_size(keypointCV.size); 142 | keypointPb->set_response(keypointCV.response); 143 | } 144 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Keypoints length bytes: %d, descr in bytes : %d", 145 | keypointsProto->ByteSize(), descriptorsProto->ByteSize()); 146 | } 147 | 148 | if(doJPEG) 149 | { 150 | double tic = (double)cv::getCPUTickCount(); 151 | sfm::cvMatProto * imgJPEG = frameProto.add_images(); 152 | imgJPEG->set_type(sfm::cvMatProto_ImageType_JPEG); 153 | std::vector buffer; 154 | std::vector params; 155 | params.push_back(CV_IMWRITE_JPEG_QUALITY); 156 | params.push_back(75); 157 | jpegGood = cv::imencode(".jpg", image, buffer, params ); 158 | imgJPEG->set_bytedata((void *)&buffer[0], buffer.size()); 159 | double toc = ((double)cv::getCPUTickCount() - tic)/cv::getTickFrequency(); 160 | __android_log_print(ANDROID_LOG_ERROR, "Native", "Compression done in %lf ms",toc*1000); 161 | } 162 | 163 | int size = frameProto.ByteSize(); 164 | signed char * buffer = new signed char[size]; 165 | protoGood = frameProto.SerializeToArray(buffer, size); 166 | outFrame = buffer; 167 | sizeOut = (size_t)size; 168 | 169 | return jpegGood && protoGood; 170 | 171 | } 172 | 173 | Frame::~Frame() 174 | { 175 | 176 | } 177 | 178 | -------------------------------------------------------------------------------- /jni/frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (C) 2012 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | 20 | #ifndef FRAME_H 21 | #define FRAME_H 22 | 23 | #include 24 | 25 | 26 | #include 27 | #include 28 | 29 | #include "data.pb.h" 30 | 31 | class Frame 32 | { 33 | private: 34 | size_t x_subs; 35 | size_t y_subs; 36 | std::vector curr_hess_thresholds; 37 | cv::Mat image; 38 | std::vector Keypoints; 39 | signed char * outFrame; 40 | size_t sizeOut; 41 | void writeProtoMat(sfm::cvMatProto &, cv::Mat &); 42 | 43 | public: 44 | Frame(); 45 | Frame(cv::Mat &); 46 | void extractFeatures(); 47 | void addFrame(cv::Mat &); 48 | bool buildFrameProtoMessage(bool doJPEG); 49 | signed char * getFrame(size_t * len){*len = sizeOut;return outFrame;} 50 | cv::Mat Descriptors; 51 | virtual ~Frame(); 52 | 53 | }; 54 | 55 | #endif // FRAME_H 56 | -------------------------------------------------------------------------------- /jni/libopencv_nonfree.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/jni/libopencv_nonfree.a -------------------------------------------------------------------------------- /jni/libprotobuf.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/jni/libprotobuf.so -------------------------------------------------------------------------------- /jni/matches.pb.cpp: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | 3 | #define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION 4 | #include "matches.pb.h" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | // @@protoc_insertion_point(includes) 15 | 16 | namespace sfm { 17 | 18 | namespace { 19 | 20 | const ::google::protobuf::Descriptor* DMatches_descriptor_ = NULL; 21 | const ::google::protobuf::internal::GeneratedMessageReflection* 22 | DMatches_reflection_ = NULL; 23 | const ::google::protobuf::Descriptor* MatchesProto_descriptor_ = NULL; 24 | const ::google::protobuf::internal::GeneratedMessageReflection* 25 | MatchesProto_reflection_ = NULL; 26 | 27 | } // namespace 28 | 29 | 30 | void protobuf_AssignDesc_matches_2eproto() { 31 | protobuf_AddDesc_matches_2eproto(); 32 | const ::google::protobuf::FileDescriptor* file = 33 | ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( 34 | "matches.proto"); 35 | GOOGLE_CHECK(file != NULL); 36 | DMatches_descriptor_ = file->message_type(0); 37 | static const int DMatches_offsets_[4] = { 38 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, queryidx_), 39 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, trainidx_), 40 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, imgidx_), 41 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, distance_), 42 | }; 43 | DMatches_reflection_ = 44 | new ::google::protobuf::internal::GeneratedMessageReflection( 45 | DMatches_descriptor_, 46 | DMatches::default_instance_, 47 | DMatches_offsets_, 48 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, _has_bits_[0]), 49 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DMatches, _unknown_fields_), 50 | -1, 51 | ::google::protobuf::DescriptorPool::generated_pool(), 52 | ::google::protobuf::MessageFactory::generated_factory(), 53 | sizeof(DMatches)); 54 | MatchesProto_descriptor_ = file->message_type(1); 55 | static const int MatchesProto_offsets_[3] = { 56 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MatchesProto, imagelseq_), 57 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MatchesProto, imagerseq_), 58 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MatchesProto, matches_), 59 | }; 60 | MatchesProto_reflection_ = 61 | new ::google::protobuf::internal::GeneratedMessageReflection( 62 | MatchesProto_descriptor_, 63 | MatchesProto::default_instance_, 64 | MatchesProto_offsets_, 65 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MatchesProto, _has_bits_[0]), 66 | GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MatchesProto, _unknown_fields_), 67 | -1, 68 | ::google::protobuf::DescriptorPool::generated_pool(), 69 | ::google::protobuf::MessageFactory::generated_factory(), 70 | sizeof(MatchesProto)); 71 | } 72 | 73 | namespace { 74 | 75 | GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_); 76 | inline void protobuf_AssignDescriptorsOnce() { 77 | ::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_, 78 | &protobuf_AssignDesc_matches_2eproto); 79 | } 80 | 81 | void protobuf_RegisterTypes(const ::std::string&) { 82 | protobuf_AssignDescriptorsOnce(); 83 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( 84 | DMatches_descriptor_, &DMatches::default_instance()); 85 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( 86 | MatchesProto_descriptor_, &MatchesProto::default_instance()); 87 | } 88 | 89 | } // namespace 90 | 91 | void protobuf_ShutdownFile_matches_2eproto() { 92 | delete DMatches::default_instance_; 93 | delete DMatches_reflection_; 94 | delete MatchesProto::default_instance_; 95 | delete MatchesProto_reflection_; 96 | } 97 | 98 | void protobuf_AddDesc_matches_2eproto() { 99 | static bool already_here = false; 100 | if (already_here) return; 101 | already_here = true; 102 | GOOGLE_PROTOBUF_VERIFY_VERSION; 103 | 104 | ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( 105 | "\n\rmatches.proto\022\003sfm\"P\n\010DMatches\022\020\n\010quer" 106 | "yIdx\030\001 \001(\r\022\020\n\010trainIdx\030\002 \001(\r\022\016\n\006imgIdx\030\003" 107 | " \001(\r\022\020\n\010distance\030\004 \001(\002\"T\n\014MatchesProto\022\021" 108 | "\n\timageLseq\030\001 \001(\006\022\021\n\timageRseq\030\002 \001(\006\022\036\n\007" 109 | "matches\030\003 \003(\0132\r.sfm.DMatchesB)\n\024cvg.sfmP" 110 | "ipeline.mainB\021MatchesOutMessage", 231); 111 | ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( 112 | "matches.proto", &protobuf_RegisterTypes); 113 | DMatches::default_instance_ = new DMatches(); 114 | MatchesProto::default_instance_ = new MatchesProto(); 115 | DMatches::default_instance_->InitAsDefaultInstance(); 116 | MatchesProto::default_instance_->InitAsDefaultInstance(); 117 | ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_matches_2eproto); 118 | } 119 | 120 | // Force AddDescriptors() to be called at static initialization time. 121 | struct StaticDescriptorInitializer_matches_2eproto { 122 | StaticDescriptorInitializer_matches_2eproto() { 123 | protobuf_AddDesc_matches_2eproto(); 124 | } 125 | } static_descriptor_initializer_matches_2eproto_; 126 | 127 | 128 | // =================================================================== 129 | 130 | #ifndef _MSC_VER 131 | const int DMatches::kQueryIdxFieldNumber; 132 | const int DMatches::kTrainIdxFieldNumber; 133 | const int DMatches::kImgIdxFieldNumber; 134 | const int DMatches::kDistanceFieldNumber; 135 | #endif // !_MSC_VER 136 | 137 | DMatches::DMatches() 138 | : ::google::protobuf::Message() { 139 | SharedCtor(); 140 | } 141 | 142 | void DMatches::InitAsDefaultInstance() { 143 | } 144 | 145 | DMatches::DMatches(const DMatches& from) 146 | : ::google::protobuf::Message() { 147 | SharedCtor(); 148 | MergeFrom(from); 149 | } 150 | 151 | void DMatches::SharedCtor() { 152 | _cached_size_ = 0; 153 | queryidx_ = 0u; 154 | trainidx_ = 0u; 155 | imgidx_ = 0u; 156 | distance_ = 0; 157 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); 158 | } 159 | 160 | DMatches::~DMatches() { 161 | SharedDtor(); 162 | } 163 | 164 | void DMatches::SharedDtor() { 165 | if (this != default_instance_) { 166 | } 167 | } 168 | 169 | void DMatches::SetCachedSize(int size) const { 170 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 171 | _cached_size_ = size; 172 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); 173 | } 174 | const ::google::protobuf::Descriptor* DMatches::descriptor() { 175 | protobuf_AssignDescriptorsOnce(); 176 | return DMatches_descriptor_; 177 | } 178 | 179 | const DMatches& DMatches::default_instance() { 180 | if (default_instance_ == NULL) protobuf_AddDesc_matches_2eproto(); return *default_instance_; 181 | } 182 | 183 | DMatches* DMatches::default_instance_ = NULL; 184 | 185 | DMatches* DMatches::New() const { 186 | return new DMatches; 187 | } 188 | 189 | void DMatches::Clear() { 190 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { 191 | queryidx_ = 0u; 192 | trainidx_ = 0u; 193 | imgidx_ = 0u; 194 | distance_ = 0; 195 | } 196 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); 197 | mutable_unknown_fields()->Clear(); 198 | } 199 | 200 | bool DMatches::MergePartialFromCodedStream( 201 | ::google::protobuf::io::CodedInputStream* input) { 202 | #define DO_(EXPRESSION) if (!(EXPRESSION)) return false 203 | ::google::protobuf::uint32 tag; 204 | while ((tag = input->ReadTag()) != 0) { 205 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 206 | // optional uint32 queryIdx = 1; 207 | case 1: { 208 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 209 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { 210 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 211 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( 212 | input, &queryidx_))); 213 | set_has_queryidx(); 214 | } else { 215 | goto handle_uninterpreted; 216 | } 217 | if (input->ExpectTag(16)) goto parse_trainIdx; 218 | break; 219 | } 220 | 221 | // optional uint32 trainIdx = 2; 222 | case 2: { 223 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 224 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { 225 | parse_trainIdx: 226 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 227 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( 228 | input, &trainidx_))); 229 | set_has_trainidx(); 230 | } else { 231 | goto handle_uninterpreted; 232 | } 233 | if (input->ExpectTag(24)) goto parse_imgIdx; 234 | break; 235 | } 236 | 237 | // optional uint32 imgIdx = 3; 238 | case 3: { 239 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 240 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { 241 | parse_imgIdx: 242 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 243 | ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>( 244 | input, &imgidx_))); 245 | set_has_imgidx(); 246 | } else { 247 | goto handle_uninterpreted; 248 | } 249 | if (input->ExpectTag(37)) goto parse_distance; 250 | break; 251 | } 252 | 253 | // optional float distance = 4; 254 | case 4: { 255 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 256 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { 257 | parse_distance: 258 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 259 | float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( 260 | input, &distance_))); 261 | set_has_distance(); 262 | } else { 263 | goto handle_uninterpreted; 264 | } 265 | if (input->ExpectAtEnd()) return true; 266 | break; 267 | } 268 | 269 | default: { 270 | handle_uninterpreted: 271 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 272 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { 273 | return true; 274 | } 275 | DO_(::google::protobuf::internal::WireFormat::SkipField( 276 | input, tag, mutable_unknown_fields())); 277 | break; 278 | } 279 | } 280 | } 281 | return true; 282 | #undef DO_ 283 | } 284 | 285 | void DMatches::SerializeWithCachedSizes( 286 | ::google::protobuf::io::CodedOutputStream* output) const { 287 | // optional uint32 queryIdx = 1; 288 | if (has_queryidx()) { 289 | ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->queryidx(), output); 290 | } 291 | 292 | // optional uint32 trainIdx = 2; 293 | if (has_trainidx()) { 294 | ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->trainidx(), output); 295 | } 296 | 297 | // optional uint32 imgIdx = 3; 298 | if (has_imgidx()) { 299 | ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->imgidx(), output); 300 | } 301 | 302 | // optional float distance = 4; 303 | if (has_distance()) { 304 | ::google::protobuf::internal::WireFormatLite::WriteFloat(4, this->distance(), output); 305 | } 306 | 307 | if (!unknown_fields().empty()) { 308 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( 309 | unknown_fields(), output); 310 | } 311 | } 312 | 313 | ::google::protobuf::uint8* DMatches::SerializeWithCachedSizesToArray( 314 | ::google::protobuf::uint8* target) const { 315 | // optional uint32 queryIdx = 1; 316 | if (has_queryidx()) { 317 | target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->queryidx(), target); 318 | } 319 | 320 | // optional uint32 trainIdx = 2; 321 | if (has_trainidx()) { 322 | target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->trainidx(), target); 323 | } 324 | 325 | // optional uint32 imgIdx = 3; 326 | if (has_imgidx()) { 327 | target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->imgidx(), target); 328 | } 329 | 330 | // optional float distance = 4; 331 | if (has_distance()) { 332 | target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(4, this->distance(), target); 333 | } 334 | 335 | if (!unknown_fields().empty()) { 336 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( 337 | unknown_fields(), target); 338 | } 339 | return target; 340 | } 341 | 342 | int DMatches::ByteSize() const { 343 | int total_size = 0; 344 | 345 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { 346 | // optional uint32 queryIdx = 1; 347 | if (has_queryidx()) { 348 | total_size += 1 + 349 | ::google::protobuf::internal::WireFormatLite::UInt32Size( 350 | this->queryidx()); 351 | } 352 | 353 | // optional uint32 trainIdx = 2; 354 | if (has_trainidx()) { 355 | total_size += 1 + 356 | ::google::protobuf::internal::WireFormatLite::UInt32Size( 357 | this->trainidx()); 358 | } 359 | 360 | // optional uint32 imgIdx = 3; 361 | if (has_imgidx()) { 362 | total_size += 1 + 363 | ::google::protobuf::internal::WireFormatLite::UInt32Size( 364 | this->imgidx()); 365 | } 366 | 367 | // optional float distance = 4; 368 | if (has_distance()) { 369 | total_size += 1 + 4; 370 | } 371 | 372 | } 373 | if (!unknown_fields().empty()) { 374 | total_size += 375 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( 376 | unknown_fields()); 377 | } 378 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 379 | _cached_size_ = total_size; 380 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); 381 | return total_size; 382 | } 383 | 384 | void DMatches::MergeFrom(const ::google::protobuf::Message& from) { 385 | GOOGLE_CHECK_NE(&from, this); 386 | const DMatches* source = 387 | ::google::protobuf::internal::dynamic_cast_if_available( 388 | &from); 389 | if (source == NULL) { 390 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); 391 | } else { 392 | MergeFrom(*source); 393 | } 394 | } 395 | 396 | void DMatches::MergeFrom(const DMatches& from) { 397 | GOOGLE_CHECK_NE(&from, this); 398 | if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { 399 | if (from.has_queryidx()) { 400 | set_queryidx(from.queryidx()); 401 | } 402 | if (from.has_trainidx()) { 403 | set_trainidx(from.trainidx()); 404 | } 405 | if (from.has_imgidx()) { 406 | set_imgidx(from.imgidx()); 407 | } 408 | if (from.has_distance()) { 409 | set_distance(from.distance()); 410 | } 411 | } 412 | mutable_unknown_fields()->MergeFrom(from.unknown_fields()); 413 | } 414 | 415 | void DMatches::CopyFrom(const ::google::protobuf::Message& from) { 416 | if (&from == this) return; 417 | Clear(); 418 | MergeFrom(from); 419 | } 420 | 421 | void DMatches::CopyFrom(const DMatches& from) { 422 | if (&from == this) return; 423 | Clear(); 424 | MergeFrom(from); 425 | } 426 | 427 | bool DMatches::IsInitialized() const { 428 | 429 | return true; 430 | } 431 | 432 | void DMatches::Swap(DMatches* other) { 433 | if (other != this) { 434 | std::swap(queryidx_, other->queryidx_); 435 | std::swap(trainidx_, other->trainidx_); 436 | std::swap(imgidx_, other->imgidx_); 437 | std::swap(distance_, other->distance_); 438 | std::swap(_has_bits_[0], other->_has_bits_[0]); 439 | _unknown_fields_.Swap(&other->_unknown_fields_); 440 | std::swap(_cached_size_, other->_cached_size_); 441 | } 442 | } 443 | 444 | ::google::protobuf::Metadata DMatches::GetMetadata() const { 445 | protobuf_AssignDescriptorsOnce(); 446 | ::google::protobuf::Metadata metadata; 447 | metadata.descriptor = DMatches_descriptor_; 448 | metadata.reflection = DMatches_reflection_; 449 | return metadata; 450 | } 451 | 452 | 453 | // =================================================================== 454 | 455 | #ifndef _MSC_VER 456 | const int MatchesProto::kImageLseqFieldNumber; 457 | const int MatchesProto::kImageRseqFieldNumber; 458 | const int MatchesProto::kMatchesFieldNumber; 459 | #endif // !_MSC_VER 460 | 461 | MatchesProto::MatchesProto() 462 | : ::google::protobuf::Message() { 463 | SharedCtor(); 464 | } 465 | 466 | void MatchesProto::InitAsDefaultInstance() { 467 | } 468 | 469 | MatchesProto::MatchesProto(const MatchesProto& from) 470 | : ::google::protobuf::Message() { 471 | SharedCtor(); 472 | MergeFrom(from); 473 | } 474 | 475 | void MatchesProto::SharedCtor() { 476 | _cached_size_ = 0; 477 | imagelseq_ = GOOGLE_ULONGLONG(0); 478 | imagerseq_ = GOOGLE_ULONGLONG(0); 479 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); 480 | } 481 | 482 | MatchesProto::~MatchesProto() { 483 | SharedDtor(); 484 | } 485 | 486 | void MatchesProto::SharedDtor() { 487 | if (this != default_instance_) { 488 | } 489 | } 490 | 491 | void MatchesProto::SetCachedSize(int size) const { 492 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 493 | _cached_size_ = size; 494 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); 495 | } 496 | const ::google::protobuf::Descriptor* MatchesProto::descriptor() { 497 | protobuf_AssignDescriptorsOnce(); 498 | return MatchesProto_descriptor_; 499 | } 500 | 501 | const MatchesProto& MatchesProto::default_instance() { 502 | if (default_instance_ == NULL) protobuf_AddDesc_matches_2eproto(); return *default_instance_; 503 | } 504 | 505 | MatchesProto* MatchesProto::default_instance_ = NULL; 506 | 507 | MatchesProto* MatchesProto::New() const { 508 | return new MatchesProto; 509 | } 510 | 511 | void MatchesProto::Clear() { 512 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { 513 | imagelseq_ = GOOGLE_ULONGLONG(0); 514 | imagerseq_ = GOOGLE_ULONGLONG(0); 515 | } 516 | matches_.Clear(); 517 | ::memset(_has_bits_, 0, sizeof(_has_bits_)); 518 | mutable_unknown_fields()->Clear(); 519 | } 520 | 521 | bool MatchesProto::MergePartialFromCodedStream( 522 | ::google::protobuf::io::CodedInputStream* input) { 523 | #define DO_(EXPRESSION) if (!(EXPRESSION)) return false 524 | ::google::protobuf::uint32 tag; 525 | while ((tag = input->ReadTag()) != 0) { 526 | switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { 527 | // optional fixed64 imageLseq = 1; 528 | case 1: { 529 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 530 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { 531 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 532 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>( 533 | input, &imagelseq_))); 534 | set_has_imagelseq(); 535 | } else { 536 | goto handle_uninterpreted; 537 | } 538 | if (input->ExpectTag(17)) goto parse_imageRseq; 539 | break; 540 | } 541 | 542 | // optional fixed64 imageRseq = 2; 543 | case 2: { 544 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 545 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) { 546 | parse_imageRseq: 547 | DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< 548 | ::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_FIXED64>( 549 | input, &imagerseq_))); 550 | set_has_imagerseq(); 551 | } else { 552 | goto handle_uninterpreted; 553 | } 554 | if (input->ExpectTag(26)) goto parse_matches; 555 | break; 556 | } 557 | 558 | // repeated .sfm.DMatches matches = 3; 559 | case 3: { 560 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 561 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { 562 | parse_matches: 563 | DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( 564 | input, add_matches())); 565 | } else { 566 | goto handle_uninterpreted; 567 | } 568 | if (input->ExpectTag(26)) goto parse_matches; 569 | if (input->ExpectAtEnd()) return true; 570 | break; 571 | } 572 | 573 | default: { 574 | handle_uninterpreted: 575 | if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == 576 | ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { 577 | return true; 578 | } 579 | DO_(::google::protobuf::internal::WireFormat::SkipField( 580 | input, tag, mutable_unknown_fields())); 581 | break; 582 | } 583 | } 584 | } 585 | return true; 586 | #undef DO_ 587 | } 588 | 589 | void MatchesProto::SerializeWithCachedSizes( 590 | ::google::protobuf::io::CodedOutputStream* output) const { 591 | // optional fixed64 imageLseq = 1; 592 | if (has_imagelseq()) { 593 | ::google::protobuf::internal::WireFormatLite::WriteFixed64(1, this->imagelseq(), output); 594 | } 595 | 596 | // optional fixed64 imageRseq = 2; 597 | if (has_imagerseq()) { 598 | ::google::protobuf::internal::WireFormatLite::WriteFixed64(2, this->imagerseq(), output); 599 | } 600 | 601 | // repeated .sfm.DMatches matches = 3; 602 | for (int i = 0; i < this->matches_size(); i++) { 603 | ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( 604 | 3, this->matches(i), output); 605 | } 606 | 607 | if (!unknown_fields().empty()) { 608 | ::google::protobuf::internal::WireFormat::SerializeUnknownFields( 609 | unknown_fields(), output); 610 | } 611 | } 612 | 613 | ::google::protobuf::uint8* MatchesProto::SerializeWithCachedSizesToArray( 614 | ::google::protobuf::uint8* target) const { 615 | // optional fixed64 imageLseq = 1; 616 | if (has_imagelseq()) { 617 | target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(1, this->imagelseq(), target); 618 | } 619 | 620 | // optional fixed64 imageRseq = 2; 621 | if (has_imagerseq()) { 622 | target = ::google::protobuf::internal::WireFormatLite::WriteFixed64ToArray(2, this->imagerseq(), target); 623 | } 624 | 625 | // repeated .sfm.DMatches matches = 3; 626 | for (int i = 0; i < this->matches_size(); i++) { 627 | target = ::google::protobuf::internal::WireFormatLite:: 628 | WriteMessageNoVirtualToArray( 629 | 3, this->matches(i), target); 630 | } 631 | 632 | if (!unknown_fields().empty()) { 633 | target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( 634 | unknown_fields(), target); 635 | } 636 | return target; 637 | } 638 | 639 | int MatchesProto::ByteSize() const { 640 | int total_size = 0; 641 | 642 | if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { 643 | // optional fixed64 imageLseq = 1; 644 | if (has_imagelseq()) { 645 | total_size += 1 + 8; 646 | } 647 | 648 | // optional fixed64 imageRseq = 2; 649 | if (has_imagerseq()) { 650 | total_size += 1 + 8; 651 | } 652 | 653 | } 654 | // repeated .sfm.DMatches matches = 3; 655 | total_size += 1 * this->matches_size(); 656 | for (int i = 0; i < this->matches_size(); i++) { 657 | total_size += 658 | ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( 659 | this->matches(i)); 660 | } 661 | 662 | if (!unknown_fields().empty()) { 663 | total_size += 664 | ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( 665 | unknown_fields()); 666 | } 667 | GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); 668 | _cached_size_ = total_size; 669 | GOOGLE_SAFE_CONCURRENT_WRITES_END(); 670 | return total_size; 671 | } 672 | 673 | void MatchesProto::MergeFrom(const ::google::protobuf::Message& from) { 674 | GOOGLE_CHECK_NE(&from, this); 675 | const MatchesProto* source = 676 | ::google::protobuf::internal::dynamic_cast_if_available( 677 | &from); 678 | if (source == NULL) { 679 | ::google::protobuf::internal::ReflectionOps::Merge(from, this); 680 | } else { 681 | MergeFrom(*source); 682 | } 683 | } 684 | 685 | void MatchesProto::MergeFrom(const MatchesProto& from) { 686 | GOOGLE_CHECK_NE(&from, this); 687 | matches_.MergeFrom(from.matches_); 688 | if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { 689 | if (from.has_imagelseq()) { 690 | set_imagelseq(from.imagelseq()); 691 | } 692 | if (from.has_imagerseq()) { 693 | set_imagerseq(from.imagerseq()); 694 | } 695 | } 696 | mutable_unknown_fields()->MergeFrom(from.unknown_fields()); 697 | } 698 | 699 | void MatchesProto::CopyFrom(const ::google::protobuf::Message& from) { 700 | if (&from == this) return; 701 | Clear(); 702 | MergeFrom(from); 703 | } 704 | 705 | void MatchesProto::CopyFrom(const MatchesProto& from) { 706 | if (&from == this) return; 707 | Clear(); 708 | MergeFrom(from); 709 | } 710 | 711 | bool MatchesProto::IsInitialized() const { 712 | 713 | return true; 714 | } 715 | 716 | void MatchesProto::Swap(MatchesProto* other) { 717 | if (other != this) { 718 | std::swap(imagelseq_, other->imagelseq_); 719 | std::swap(imagerseq_, other->imagerseq_); 720 | matches_.Swap(&other->matches_); 721 | std::swap(_has_bits_[0], other->_has_bits_[0]); 722 | _unknown_fields_.Swap(&other->_unknown_fields_); 723 | std::swap(_cached_size_, other->_cached_size_); 724 | } 725 | } 726 | 727 | ::google::protobuf::Metadata MatchesProto::GetMetadata() const { 728 | protobuf_AssignDescriptorsOnce(); 729 | ::google::protobuf::Metadata metadata; 730 | metadata.descriptor = MatchesProto_descriptor_; 731 | metadata.reflection = MatchesProto_reflection_; 732 | return metadata; 733 | } 734 | 735 | 736 | // @@protoc_insertion_point(namespace_scope) 737 | 738 | } // namespace sfm 739 | 740 | // @@protoc_insertion_point(global_scope) 741 | -------------------------------------------------------------------------------- /jni/matches.pb.h: -------------------------------------------------------------------------------- 1 | // Generated by the protocol buffer compiler. DO NOT EDIT! 2 | // source: matches.proto 3 | 4 | #ifndef PROTOBUF_matches_2eproto__INCLUDED 5 | #define PROTOBUF_matches_2eproto__INCLUDED 6 | 7 | #include 8 | 9 | #include 10 | 11 | #if GOOGLE_PROTOBUF_VERSION < 2004000 12 | #error This file was generated by a newer version of protoc which is 13 | #error incompatible with your Protocol Buffer headers. Please update 14 | #error your headers. 15 | #endif 16 | #if 2004001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 17 | #error This file was generated by an older version of protoc which is 18 | #error incompatible with your Protocol Buffer headers. Please 19 | #error regenerate this file with a newer version of protoc. 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | // @@protoc_insertion_point(includes) 27 | 28 | namespace sfm { 29 | 30 | // Internal implementation detail -- do not call these. 31 | void protobuf_AddDesc_matches_2eproto(); 32 | void protobuf_AssignDesc_matches_2eproto(); 33 | void protobuf_ShutdownFile_matches_2eproto(); 34 | 35 | class DMatches; 36 | class MatchesProto; 37 | 38 | // =================================================================== 39 | 40 | class DMatches : public ::google::protobuf::Message { 41 | public: 42 | DMatches(); 43 | virtual ~DMatches(); 44 | 45 | DMatches(const DMatches& from); 46 | 47 | inline DMatches& operator=(const DMatches& from) { 48 | CopyFrom(from); 49 | return *this; 50 | } 51 | 52 | inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { 53 | return _unknown_fields_; 54 | } 55 | 56 | inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { 57 | return &_unknown_fields_; 58 | } 59 | 60 | static const ::google::protobuf::Descriptor* descriptor(); 61 | static const DMatches& default_instance(); 62 | 63 | void Swap(DMatches* other); 64 | 65 | // implements Message ---------------------------------------------- 66 | 67 | DMatches* New() const; 68 | void CopyFrom(const ::google::protobuf::Message& from); 69 | void MergeFrom(const ::google::protobuf::Message& from); 70 | void CopyFrom(const DMatches& from); 71 | void MergeFrom(const DMatches& from); 72 | void Clear(); 73 | bool IsInitialized() const; 74 | 75 | int ByteSize() const; 76 | bool MergePartialFromCodedStream( 77 | ::google::protobuf::io::CodedInputStream* input); 78 | void SerializeWithCachedSizes( 79 | ::google::protobuf::io::CodedOutputStream* output) const; 80 | ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; 81 | int GetCachedSize() const { return _cached_size_; } 82 | private: 83 | void SharedCtor(); 84 | void SharedDtor(); 85 | void SetCachedSize(int size) const; 86 | public: 87 | 88 | ::google::protobuf::Metadata GetMetadata() const; 89 | 90 | // nested types ---------------------------------------------------- 91 | 92 | // accessors ------------------------------------------------------- 93 | 94 | // optional uint32 queryIdx = 1; 95 | inline bool has_queryidx() const; 96 | inline void clear_queryidx(); 97 | static const int kQueryIdxFieldNumber = 1; 98 | inline ::google::protobuf::uint32 queryidx() const; 99 | inline void set_queryidx(::google::protobuf::uint32 value); 100 | 101 | // optional uint32 trainIdx = 2; 102 | inline bool has_trainidx() const; 103 | inline void clear_trainidx(); 104 | static const int kTrainIdxFieldNumber = 2; 105 | inline ::google::protobuf::uint32 trainidx() const; 106 | inline void set_trainidx(::google::protobuf::uint32 value); 107 | 108 | // optional uint32 imgIdx = 3; 109 | inline bool has_imgidx() const; 110 | inline void clear_imgidx(); 111 | static const int kImgIdxFieldNumber = 3; 112 | inline ::google::protobuf::uint32 imgidx() const; 113 | inline void set_imgidx(::google::protobuf::uint32 value); 114 | 115 | // optional float distance = 4; 116 | inline bool has_distance() const; 117 | inline void clear_distance(); 118 | static const int kDistanceFieldNumber = 4; 119 | inline float distance() const; 120 | inline void set_distance(float value); 121 | 122 | // @@protoc_insertion_point(class_scope:sfm.DMatches) 123 | private: 124 | inline void set_has_queryidx(); 125 | inline void clear_has_queryidx(); 126 | inline void set_has_trainidx(); 127 | inline void clear_has_trainidx(); 128 | inline void set_has_imgidx(); 129 | inline void clear_has_imgidx(); 130 | inline void set_has_distance(); 131 | inline void clear_has_distance(); 132 | 133 | ::google::protobuf::UnknownFieldSet _unknown_fields_; 134 | 135 | ::google::protobuf::uint32 queryidx_; 136 | ::google::protobuf::uint32 trainidx_; 137 | ::google::protobuf::uint32 imgidx_; 138 | float distance_; 139 | 140 | mutable int _cached_size_; 141 | ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32]; 142 | 143 | friend void protobuf_AddDesc_matches_2eproto(); 144 | friend void protobuf_AssignDesc_matches_2eproto(); 145 | friend void protobuf_ShutdownFile_matches_2eproto(); 146 | 147 | void InitAsDefaultInstance(); 148 | static DMatches* default_instance_; 149 | }; 150 | // ------------------------------------------------------------------- 151 | 152 | class MatchesProto : public ::google::protobuf::Message { 153 | public: 154 | MatchesProto(); 155 | virtual ~MatchesProto(); 156 | 157 | MatchesProto(const MatchesProto& from); 158 | 159 | inline MatchesProto& operator=(const MatchesProto& from) { 160 | CopyFrom(from); 161 | return *this; 162 | } 163 | 164 | inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { 165 | return _unknown_fields_; 166 | } 167 | 168 | inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { 169 | return &_unknown_fields_; 170 | } 171 | 172 | static const ::google::protobuf::Descriptor* descriptor(); 173 | static const MatchesProto& default_instance(); 174 | 175 | void Swap(MatchesProto* other); 176 | 177 | // implements Message ---------------------------------------------- 178 | 179 | MatchesProto* New() const; 180 | void CopyFrom(const ::google::protobuf::Message& from); 181 | void MergeFrom(const ::google::protobuf::Message& from); 182 | void CopyFrom(const MatchesProto& from); 183 | void MergeFrom(const MatchesProto& from); 184 | void Clear(); 185 | bool IsInitialized() const; 186 | 187 | int ByteSize() const; 188 | bool MergePartialFromCodedStream( 189 | ::google::protobuf::io::CodedInputStream* input); 190 | void SerializeWithCachedSizes( 191 | ::google::protobuf::io::CodedOutputStream* output) const; 192 | ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; 193 | int GetCachedSize() const { return _cached_size_; } 194 | private: 195 | void SharedCtor(); 196 | void SharedDtor(); 197 | void SetCachedSize(int size) const; 198 | public: 199 | 200 | ::google::protobuf::Metadata GetMetadata() const; 201 | 202 | // nested types ---------------------------------------------------- 203 | 204 | // accessors ------------------------------------------------------- 205 | 206 | // optional fixed64 imageLseq = 1; 207 | inline bool has_imagelseq() const; 208 | inline void clear_imagelseq(); 209 | static const int kImageLseqFieldNumber = 1; 210 | inline ::google::protobuf::uint64 imagelseq() const; 211 | inline void set_imagelseq(::google::protobuf::uint64 value); 212 | 213 | // optional fixed64 imageRseq = 2; 214 | inline bool has_imagerseq() const; 215 | inline void clear_imagerseq(); 216 | static const int kImageRseqFieldNumber = 2; 217 | inline ::google::protobuf::uint64 imagerseq() const; 218 | inline void set_imagerseq(::google::protobuf::uint64 value); 219 | 220 | // repeated .sfm.DMatches matches = 3; 221 | inline int matches_size() const; 222 | inline void clear_matches(); 223 | static const int kMatchesFieldNumber = 3; 224 | inline const ::sfm::DMatches& matches(int index) const; 225 | inline ::sfm::DMatches* mutable_matches(int index); 226 | inline ::sfm::DMatches* add_matches(); 227 | inline const ::google::protobuf::RepeatedPtrField< ::sfm::DMatches >& 228 | matches() const; 229 | inline ::google::protobuf::RepeatedPtrField< ::sfm::DMatches >* 230 | mutable_matches(); 231 | 232 | // @@protoc_insertion_point(class_scope:sfm.MatchesProto) 233 | private: 234 | inline void set_has_imagelseq(); 235 | inline void clear_has_imagelseq(); 236 | inline void set_has_imagerseq(); 237 | inline void clear_has_imagerseq(); 238 | 239 | ::google::protobuf::UnknownFieldSet _unknown_fields_; 240 | 241 | ::google::protobuf::uint64 imagelseq_; 242 | ::google::protobuf::uint64 imagerseq_; 243 | ::google::protobuf::RepeatedPtrField< ::sfm::DMatches > matches_; 244 | 245 | mutable int _cached_size_; 246 | ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; 247 | 248 | friend void protobuf_AddDesc_matches_2eproto(); 249 | friend void protobuf_AssignDesc_matches_2eproto(); 250 | friend void protobuf_ShutdownFile_matches_2eproto(); 251 | 252 | void InitAsDefaultInstance(); 253 | static MatchesProto* default_instance_; 254 | }; 255 | // =================================================================== 256 | 257 | 258 | // =================================================================== 259 | 260 | // DMatches 261 | 262 | // optional uint32 queryIdx = 1; 263 | inline bool DMatches::has_queryidx() const { 264 | return (_has_bits_[0] & 0x00000001u) != 0; 265 | } 266 | inline void DMatches::set_has_queryidx() { 267 | _has_bits_[0] |= 0x00000001u; 268 | } 269 | inline void DMatches::clear_has_queryidx() { 270 | _has_bits_[0] &= ~0x00000001u; 271 | } 272 | inline void DMatches::clear_queryidx() { 273 | queryidx_ = 0u; 274 | clear_has_queryidx(); 275 | } 276 | inline ::google::protobuf::uint32 DMatches::queryidx() const { 277 | return queryidx_; 278 | } 279 | inline void DMatches::set_queryidx(::google::protobuf::uint32 value) { 280 | set_has_queryidx(); 281 | queryidx_ = value; 282 | } 283 | 284 | // optional uint32 trainIdx = 2; 285 | inline bool DMatches::has_trainidx() const { 286 | return (_has_bits_[0] & 0x00000002u) != 0; 287 | } 288 | inline void DMatches::set_has_trainidx() { 289 | _has_bits_[0] |= 0x00000002u; 290 | } 291 | inline void DMatches::clear_has_trainidx() { 292 | _has_bits_[0] &= ~0x00000002u; 293 | } 294 | inline void DMatches::clear_trainidx() { 295 | trainidx_ = 0u; 296 | clear_has_trainidx(); 297 | } 298 | inline ::google::protobuf::uint32 DMatches::trainidx() const { 299 | return trainidx_; 300 | } 301 | inline void DMatches::set_trainidx(::google::protobuf::uint32 value) { 302 | set_has_trainidx(); 303 | trainidx_ = value; 304 | } 305 | 306 | // optional uint32 imgIdx = 3; 307 | inline bool DMatches::has_imgidx() const { 308 | return (_has_bits_[0] & 0x00000004u) != 0; 309 | } 310 | inline void DMatches::set_has_imgidx() { 311 | _has_bits_[0] |= 0x00000004u; 312 | } 313 | inline void DMatches::clear_has_imgidx() { 314 | _has_bits_[0] &= ~0x00000004u; 315 | } 316 | inline void DMatches::clear_imgidx() { 317 | imgidx_ = 0u; 318 | clear_has_imgidx(); 319 | } 320 | inline ::google::protobuf::uint32 DMatches::imgidx() const { 321 | return imgidx_; 322 | } 323 | inline void DMatches::set_imgidx(::google::protobuf::uint32 value) { 324 | set_has_imgidx(); 325 | imgidx_ = value; 326 | } 327 | 328 | // optional float distance = 4; 329 | inline bool DMatches::has_distance() const { 330 | return (_has_bits_[0] & 0x00000008u) != 0; 331 | } 332 | inline void DMatches::set_has_distance() { 333 | _has_bits_[0] |= 0x00000008u; 334 | } 335 | inline void DMatches::clear_has_distance() { 336 | _has_bits_[0] &= ~0x00000008u; 337 | } 338 | inline void DMatches::clear_distance() { 339 | distance_ = 0; 340 | clear_has_distance(); 341 | } 342 | inline float DMatches::distance() const { 343 | return distance_; 344 | } 345 | inline void DMatches::set_distance(float value) { 346 | set_has_distance(); 347 | distance_ = value; 348 | } 349 | 350 | // ------------------------------------------------------------------- 351 | 352 | // MatchesProto 353 | 354 | // optional fixed64 imageLseq = 1; 355 | inline bool MatchesProto::has_imagelseq() const { 356 | return (_has_bits_[0] & 0x00000001u) != 0; 357 | } 358 | inline void MatchesProto::set_has_imagelseq() { 359 | _has_bits_[0] |= 0x00000001u; 360 | } 361 | inline void MatchesProto::clear_has_imagelseq() { 362 | _has_bits_[0] &= ~0x00000001u; 363 | } 364 | inline void MatchesProto::clear_imagelseq() { 365 | imagelseq_ = GOOGLE_ULONGLONG(0); 366 | clear_has_imagelseq(); 367 | } 368 | inline ::google::protobuf::uint64 MatchesProto::imagelseq() const { 369 | return imagelseq_; 370 | } 371 | inline void MatchesProto::set_imagelseq(::google::protobuf::uint64 value) { 372 | set_has_imagelseq(); 373 | imagelseq_ = value; 374 | } 375 | 376 | // optional fixed64 imageRseq = 2; 377 | inline bool MatchesProto::has_imagerseq() const { 378 | return (_has_bits_[0] & 0x00000002u) != 0; 379 | } 380 | inline void MatchesProto::set_has_imagerseq() { 381 | _has_bits_[0] |= 0x00000002u; 382 | } 383 | inline void MatchesProto::clear_has_imagerseq() { 384 | _has_bits_[0] &= ~0x00000002u; 385 | } 386 | inline void MatchesProto::clear_imagerseq() { 387 | imagerseq_ = GOOGLE_ULONGLONG(0); 388 | clear_has_imagerseq(); 389 | } 390 | inline ::google::protobuf::uint64 MatchesProto::imagerseq() const { 391 | return imagerseq_; 392 | } 393 | inline void MatchesProto::set_imagerseq(::google::protobuf::uint64 value) { 394 | set_has_imagerseq(); 395 | imagerseq_ = value; 396 | } 397 | 398 | // repeated .sfm.DMatches matches = 3; 399 | inline int MatchesProto::matches_size() const { 400 | return matches_.size(); 401 | } 402 | inline void MatchesProto::clear_matches() { 403 | matches_.Clear(); 404 | } 405 | inline const ::sfm::DMatches& MatchesProto::matches(int index) const { 406 | return matches_.Get(index); 407 | } 408 | inline ::sfm::DMatches* MatchesProto::mutable_matches(int index) { 409 | return matches_.Mutable(index); 410 | } 411 | inline ::sfm::DMatches* MatchesProto::add_matches() { 412 | return matches_.Add(); 413 | } 414 | inline const ::google::protobuf::RepeatedPtrField< ::sfm::DMatches >& 415 | MatchesProto::matches() const { 416 | return matches_; 417 | } 418 | inline ::google::protobuf::RepeatedPtrField< ::sfm::DMatches >* 419 | MatchesProto::mutable_matches() { 420 | return &matches_; 421 | } 422 | 423 | 424 | // @@protoc_insertion_point(namespace_scope) 425 | 426 | } // namespace sfm 427 | 428 | #ifndef SWIG 429 | namespace google { 430 | namespace protobuf { 431 | 432 | 433 | } // namespace google 434 | } // namespace protobuf 435 | #endif // SWIG 436 | 437 | // @@protoc_insertion_point(global_scope) 438 | 439 | #endif // PROTOBUF_matches_2eproto__INCLUDED 440 | -------------------------------------------------------------------------------- /jni/matches.proto: -------------------------------------------------------------------------------- 1 | package sfm; 2 | 3 | option java_package = "cvg.sfmPipeline.main"; 4 | option java_outer_classname = "MatchesOutMessage"; 5 | 6 | message DMatches { 7 | optional uint32 queryIdx = 1; 8 | optional uint32 trainIdx = 2; 9 | optional uint32 imgIdx = 3; 10 | optional float distance =4; 11 | } 12 | 13 | message MatchesProto { 14 | optional fixed64 imageLseq = 1; 15 | optional fixed64 imageRseq = 2; 16 | repeated DMatches matches = 3; 17 | } 18 | -------------------------------------------------------------------------------- /libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/libs/android-support-v4.jar -------------------------------------------------------------------------------- /libs/armeabi-v7a/libpipeline_native.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/libs/armeabi-v7a/libpipeline_native.so -------------------------------------------------------------------------------- /libs/armeabi-v7a/libprotobuf.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/libs/armeabi-v7a/libprotobuf.so -------------------------------------------------------------------------------- /libs/protobuf-java-2.4.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/libs/protobuf-java-2.4.1.jar -------------------------------------------------------------------------------- /logo_google_developers.svg: -------------------------------------------------------------------------------- 1 | 2 | 21 | Google Developers Logo 23 | 25 | 26 | 28 | image/svg+xml 29 | 31 | Google Developers Logo 32 | en 33 | 35 | 36 | 37 | Misha M.-Kupriyanov aka @russenreaktor 38 | 39 | 40 | https://plus.google.com/111395306401981598462/posts 41 | Google Developers Logo 42 | 43 | 44 | https://plus.google.com/104512463398531242371 45 | 46 | 47 | 48 | 49 | The copyright of Google Developers logo belongs to Google 50 | 51 | 52 | 53 | 55 | 57 | 59 | 61 | 63 | 65 | 66 | 67 | 68 | 70 | 73 | 77 | 81 | 82 | 84 | 88 | 92 | 93 | 104 | 115 | 118 | 122 | 126 | 127 | 138 | 149 | 150 | 170 | 184 | 189 | 192 | 196 | 200 | 201 | 206 | 210 | 216 | 217 | 223 | 227 | 233 | 234 | 238 | 244 | 245 | 247 | 253 | 254 | 257 | 263 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-15 15 | android.library.reference.1=../../apps/opencvAndroid-2.4.2/sdk/java 16 | -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danylaksono/Android-SfM-client/a53e818f2d70215f66b39c2f78b53d27b377546b/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 21 | 22 | 23 | 24 | 28 | 29 | 33 | 34 | 41 | 42 | 45 | 46 |