如何使用c ++ _ static重建OpenCv? [英] How to rebuild OpenCv with c++_static?
问题描述
我是Android中的opencv的新手.我成功导入了opencv模块3.4.2. 在application.mk
I am new to opencv in android. I imported the opencv module 3.4.2 successfully. In application.mk
APP_STL:=gnustl_static
当我尝试构建应用程序时,出现了NDK生成错误,即不再支持'gnustl_static'.我将application.mk中的上述行更改为
When I tried to build the application, I got NDK build error that 'gnustl_static' is no longer supported. I changed the above line in application.mk to
APP_STL:=c++_static
根据android studio的建议.
APP_STL:=c++_static
as suggested by android studio.
构建成功,并且我成功运行了该项目.现在,我尝试使用opencv来实现人脸检测,就像opencv样本人脸检测"一样.这次我得到了错误:
The build was successful and I ran the project successfully. Now I tried to implement the face detection with opencv as like as opencv samples 'face-detection'. I got the error this time :
E:/MyOpenDetections/app/src/main/jni/com_sar_pahc_DetectionBasedTracker.cpp:37: error: undefined reference to 'cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__ndk1::vector<cv::Rect_<int>, std::__ndk1::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)'
我对此进行了搜索,并得到一些建议,我必须将APP_STL从'c ++ _ static'更改为'gnustl_static',但是当我这样做时,NDK会停止构建并显示它现在不受支持.
I searched about this and got some suggestions that I have to change the APP_STL to 'gnustl_static' from 'c++_static' but when I do this the NDK stops the build and shows that it is not supported now.
我从Alex Cohn得到了一些提示,我必须使用c ++ _ static重建Opencv. OpenCV-在NDK更新后未定义对'cv :: CascadeClassifier :: detectMultiScale()的引用
I got some hint from Alex Cohn that I have to rebuild the Opencv with c++_static OpenCV - undefined reference to 'cv::CascadeClassifier::detectMultiScale() after NDK update
但是我不知道这样做. 请帮助
But I have no idea of doing that. Please help
推荐答案
您可以尝试通过opencv bugtracker解决问题(源):
You can try solution from opencv bugtracker (source):
cmake -GNinja -DINSTALL_ANDROID_EXAMPLES = ON -DANDROID_EXAMPLES_WITH_LIBS = ON -DBUILD_EXAMPLES = ON -DBUILD_DOCS = OFF -DWITH_OPENCL = OFF -DWITH_IPP = ON -DCMAKE_TOOLCHAIN_FILE = $ {ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN =铛"-DANDROID_STL = c ++ _ static" -DANDROID_ABI = x86 -DANDROID_SDK_TARGET = 18 ../opencv
cmake -GNinja -DINSTALL_ANDROID_EXAMPLES=ON -DANDROID_EXAMPLES_WITH_LIBS=ON -DBUILD_EXAMPLES=ON -DBUILD_DOCS=OFF -DWITH_OPENCL=OFF -DWITH_IPP=ON -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_TOOLCHAIN=clang "-DANDROID_STL=c++_static" -DANDROID_ABI=x86 -DANDROID_SDK_TARGET=18 ../opencv
其次是
make&&进行安装
make && make install
这篇关于如何使用c ++ _ static重建OpenCv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!