Hi there,
I am an Android Developer, and new to OpenCV, we are creating an application that people can take photos and stitch them into a Panorama picture, so we are trying to integrate the OpenCV Android SDK into our project, but there is problem when I am trying it.
I download the SDK from https://github.com/opencv/opencv/releases/tag/4.5.0, after importing the project into my Android Studio, it can run well, but if I add some code about the stitching interface in the face-detection project, the compile is fine but there are some link errors. What I did is to create a new file named stitching.cpp in the same folder of DetectionBasedTracker_jni.cpp.
#include <opencv2/stitching.hpp>
using namespace cv;
cv::Mat stitch (std::vector cv::Mat& images, cv::Stitcher::Status* status)
{
Mat pano;
Ptr stitcher = Stitcher::create();
Stitcher::Status s = stitcher->stitch(images, pano);
*status = s;
return pano;
}
The error log is:
CMakeFiles/detection_based_tracker.dir/stitching.cpp.o /Users/dantezhang/MyWorkspace/AndroidStudio/OpenCV-android-sdk/sdk/native/libs/x86_64/libopencv_java4.so -ljnigraphics -llog -ldl -lz -latomic -lm && :
/Users/dantezhang/MyWorkspace/AndroidStudio/OpenCV-android-sdk/samples/face-detection/jni/stitching.cpp:6: error: undefined reference to ‘cv::Stitcher::create(cv::Stitcher::Mode)’
/Users/dantezhang/MyWorkspace/AndroidStudio/OpenCV-android-sdk/samples/face-detection/jni/stitching.cpp:7: error: undefined reference to ‘cv::Stitcher::stitch(cv::_InputArray const&, cv::_OutputArray const&)’
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
Any help is appreciated.