Hi,
I tried to use the Stitcher in an Android project with the libraries built from the sources using the command below. But the library does not contain the Stitcher (no stitcher class or method in the java sources). Any idea if I’m missing a build flag or what I can do to get the Stitcher included in the java interface?
Thanks for the quick response. Sadly opencv fails the build process when I add the java bindings. There are 4 lines with errors, the last 3 lines I was able to fix by introducing local variables and casting the java types (e.g. jdouble) to c++ type (e.g. double) before passing it to the function.
But the first error where it says call to non-static member function without an object argument in the expression(*(cv::detail::MatchesInfo*)matches_info_nativeObj) ) I don’t understand.
It just casts the matches_info_nativeObj to a pointer to a MatchesInfo pointer, right? (sorry, my C++ is a bit rusty) Why does it complain about an object argument?
[1118/1120] Building CXX object modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/opencv_java.cpp.o
FAILED: modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/opencv_java.cpp.o
/opt/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi30 --gcc-toolchain=/opt/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/opt/android-ndk-r21e/toolchains/llvm/prebuilt/linux-x86_64/sysroot -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/root/opencv/modules/core/misc/java/src/cpp -I/root/opencv/modules/imgproc/misc/java/src/cpp -I/root/opencv/modules/ml/misc/java/src/cpp -I/root/opencv_contrib/modules/phase_unwrapping/misc/java/src/cpp -I/root/opencv/modules/photo/misc/java/src/cpp -I/root/opencv_contrib/modules/plot/misc/java/src/cpp -I/root/opencv_contrib/modules/xphoto/misc/java/src/cpp -I/root/opencv_contrib/modules/bioinspired/misc/java/src/cpp -I/root/opencv/modules/features2d/misc/java/src/cpp -I/root/opencv_contrib/modules/img_hash/misc/java/src/cpp -I/root/opencv/modules/imgcodecs/misc/java/src/cpp -I/root/opencv/modules/videoio/misc/java/src/cpp -I/root/opencv/modules/calib3d/misc/java/src/cpp -I/root/opencv/modules/objdetect/misc/java/src/cpp -I/root/opencv_contrib/modules/structured_light/misc/java/src/cpp -I/root/opencv/modules/video/misc/java/src/cpp -I/root/opencv_contrib/modules/xfeatures2d/misc/java/src/cpp -I/root/opencv_contrib/modules/ximgproc/misc/java/src/cpp -I/root/opencv_contrib/modules/aruco/misc/java/src/cpp -I/root/opencv_contrib/modules/bgsegm/misc/java/src/cpp -I/root/opencv_contrib/modules/face/misc/java/src/cpp -I/root/opencv/modules/stitching/misc/java/src/cpp -I/root/opencv_contrib/modules/tracking/misc/java/src/cpp -I/root/opencv/modules/java/generator/src/cpp -Imodules/java_bindings_generator/gen/cpp -I/root/opencv/modules/core/include -I/root/opencv/modules/flann/include -I/root/opencv/modules/imgproc/include -I/root/opencv/modules/ml/include -I/root/opencv_contrib/modules/phase_unwrapping/include -I/root/opencv/modules/photo/include -I/root/opencv_contrib/modules/plot/include -I/root/opencv_contrib/modules/xphoto/include -I/root/opencv_contrib/modules/bioinspired/include -I/root/opencv/modules/features2d/include -I/root/opencv_contrib/modules/img_hash/include -I/root/opencv/modules/imgcodecs/include -I/root/opencv/modules/videoio/include -I/root/opencv/modules/calib3d/include -I/root/opencv_contrib/modules/datasets/include -I/root/opencv/modules/objdetect/include -I/root/opencv_contrib/modules/shape/include -I/root/opencv_contrib/modules/structured_light/include -I/root/opencv/modules/video/include -I/root/opencv_contrib/modules/xfeatures2d/include -I/root/opencv_contrib/modules/ximgproc/include -I/root/opencv_contrib/modules/aruco/include -I/root/opencv_contrib/modules/bgsegm/include -I/root/opencv_contrib/modules/face/include -I/root/opencv/modules/stitching/include -I/root/opencv_contrib/modules/tracking/include -isystem . -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winconsistent-missing-override -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -fPIC -Wno-deprecated-declarations -Oz -DNDEBUG -DNDEBUG -D_FORTIFY_SOURCE=2 -fPIC -std=c++11 -MD -MT modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/opencv_java.cpp.o -MF modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/opencv_java.cpp.o.d -o modules/java/jni/CMakeFiles/opencv_java.dir/__/generator/src/cpp/opencv_java.cpp.o -c /root/opencv/modules/java/generator/src/cpp/opencv_java.cpp
In file included from /root/opencv/modules/java/generator/src/cpp/opencv_java.cpp:8:
In file included from modules/java_bindings_generator/gen/cpp/opencv_jni.hpp:22:
/root/build/modules/java_bindings_generator/gen/cpp/stitching.inl.hpp:851:38: error: call to non-static member function without an object argument
cv::detail::FeaturesMatcher::operator ()( (*(cv::detail::ImageFeatures*)features1_nativeObj), (*(cv::detail::ImageFeatures*)features2_nativeObj), (*(cv::detail::MatchesInfo*)matches_info_nativeObj) );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/root/build/modules/java_bindings_generator/gen/cpp/stitching.inl.hpp:875:46: error: non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'
cv::detail::focalsFromHomography( H, (double)f0, (double)f1, (bool)f0_ok, (bool)f1_ok );
^~~~~~~~~~
/root/opencv/modules/stitching/include/opencv2/stitching/detail/autocalib.hpp:67:62: note: passing argument to parameter 'f0' here
void CV_EXPORTS_W focalsFromHomography(const Mat &H, double &f0, double &f1, bool &f0_ok, bool &f1_ok);
^
In file included from /root/opencv/modules/java/generator/src/cpp/opencv_java.cpp:8:
In file included from modules/java_bindings_generator/gen/cpp/opencv_jni.hpp:22:
/root/build/modules/java_bindings_generator/gen/cpp/stitching.inl.hpp:5020:45: error: non-const lvalue reference to type 'float' cannot bind to a temporary of type 'float'
me->mapForward( (float)x, (float)y, (float)u, (float)v );
^~~~~~~~
/root/opencv/modules/stitching/include/opencv2/stitching/detail/warpers_inl.hpp:253:62: note: passing argument to parameter 'u' here
void SphericalProjector::mapForward(float x, float y, float &u, float &v)
^
In file included from /root/opencv/modules/java/generator/src/cpp/opencv_java.cpp:8:
In file included from modules/java_bindings_generator/gen/cpp/opencv_jni.hpp:22:
/root/build/modules/java_bindings_generator/gen/cpp/stitching.inl.hpp:5044:46: error: non-const lvalue reference to type 'float' cannot bind to a temporary of type 'float'
me->mapBackward( (float)u, (float)v, (float)x, (float)y );
^~~~~~~~
/root/opencv/modules/stitching/include/opencv2/stitching/detail/warpers_inl.hpp:266:63: note: passing argument to parameter 'x' here
void SphericalProjector::mapBackward(float u, float v, float &x, float &y)
^
4 errors generated.
ninja: build stopped: subcommand failed.