Open KholofeloMoyaba opened 6 years ago
"stitching" module is out of scope libopencv_java because Java bindings (Android or desktop) are disabled for stitching module (missing "WRAP Java" entry for some reason): https://github.com/opencv/opencv/blob/3.4.1/modules/stitching/CMakeLists.txt#L13
@alalek thanks for the speedy response. Is there anyway to manually include the stitching library myself? E.g. using the staticlibs included in the package?
Or are my only options to either downgrade or implement stitching from scratch?
Hi @alalek So I've been trying to implement the stitching algorithms myself and I'm having issues with DescriptorMatcher as well.
I can't call
DescriptorMatcher::match
or
DescriptorMatcher::knnMatch
Please see error below:
/Users/.../src/main/cpp/native-lib.cpp:62: undefined reference to `cv::DescriptorMatcher::match(cv::_InputArray const&, cv::_InputArray const&, std::__ndk1::vector<cv::DMatch, std::__ndk1::allocator<cv::DMatch> >&, cv::_InputArray const&) const'
I am also seeing this problem in 3.4.3 where we are unable to link from Android Studio (or command line) from OpenCV built with clang and embedded cmake file (see https://github.com/10imaging/opencv/tree/v3.4.3)
"/Users/XXX/Library/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld" --sysroot=/Users/XXX/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64 --fix-cortex-a53-843419 --eh-frame-hdr -m aarch64linux -shared -o /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libiris_native.so /Users/XXX/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib/crtbegin_so.o -L/Users/XXX/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -L/Users/XXX/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/6.0.2/lib/linux/aarch64 -L/Users/XXX/Library/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/lib/gcc/aarch64-linux-android/4.9.x -L/Users/XXX/Library/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64 -L/Users/XXX/Library/Android/sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib -L/Users/XXX/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib -soname libiris_native.so /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/zzz_native/exif_jni.o /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/zzz_native/exif.o /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/zzz_native/PanoStitch_jni.o /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/zzz_native/PerfTracker_jni.o /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/objs-debug/zzz_native/DetectionBasedTracker_jni.o /Users/XXX/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a /Users/XXX/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/arm64-v8a/libc++abi.a -lgcc --exclude-libs libgcc.a -latomic --exclude-libs libatomic.a /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libopencv_java3.so /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libc++_shared.so /Users/YYY/build/intermediates/ndkBuild/debug/obj/local/arm64-v8a/libSNPE.so --build-id --no-undefined -z noexecstack -z relro -z now --warn-shared-textrel --fatal-warnings -llog -ldl -landroid -lc -lm -lm -lgcc -ldl -lc -lgcc -ldl /Users/XXX/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-arm64/usr/lib/crtend_so.o
PanoStitchjni.o: In function `cv::Ptr
I fixed in our tree by adding java to wrappers -
set(the_description "Images stitching")
if(HAVE_CUDA)
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations -Wshadow)
endif()
set(STITCHING_CONTRIB_DEPS "opencv_xfeatures2d")
if(BUILD_SHARED_LIBS AND BUILD_opencv_world AND OPENCV_WORLD_EXCLUDE_EXTRA_MODULES)
set(STITCHING_CONTRIB_DEPS "")
endif()
ocv_define_module(stitching opencv_imgproc opencv_features2d opencv_calib3d opencv_flann opencv_objdetect
OPTIONAL opencv_cudaarithm opencv_cudawarping opencv_cudafeatures2d opencv_cudalegacy opencv_cudaimgproc ${STITCHING_CONTRIB_DEPS}
WRAP python java)
It can not be completely fixed by adding java to wrappers in opencv-3.4.x/modules/stitching/CMakelist.txt, since the script to generate Java wrapper for stitching module is missing in the source code (typically in $opencv-3.4.x/modules/$module_name/misc/java). E.g. feature2d module supports Java wrapper because it has generate script under opencv-3.4.x/modules/features2d/misc/java
System information (version)
Detailed description
Android OpenCV 3.4.1 libopencv_java3.so doesn't have
stitching/stitcher
support/symbols compiled in.More specifically, calling the Stitcher class makes the project not to compile as references to
cv::Stitcher
cannot be found.Steps to reproduce
This is my JNI
When building my android app I get these errors
Upon further I looked at the symbols inside
libopencv_java3.so
(libopencv_java3.so comes straight from the latest package served from SourceForge - https://sourceforge.net/projects/opencvlibrary/files/opencv-android/3.4.1/) by running the following command:When looking at the output I couldn't see references to any of the stitching methods.