Tôi đã tải xuống dự án OpenCV dành cho Android và các dự án mẫu đi kèm với nó chứa nhiều lỗi .... Chỉ những dự án có chứa mã NDK mới có lỗi .... vấn đề là các mã C++ cho thấy nhiều lỗi ... các từ khóa như jstring không được công nhận .. Vui lòng giúp tôi giải quyết vấn đề này ... Cám ơn bạn trước cho thời gian quý báu của bạnOpenCV cho các chương trình mẫu Android hiển thị lỗi
#include <jni.h>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <vector>
using namespace std;
using namespace cv;
extern "C" {
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial3_Sample3View_FindFeatures(JNIEnv* env, jobject, jint width, jint height, jbyteArray yuv, jintArray bgra)
{
jbyte* _yuv = env->GetByteArrayElements(yuv, 0);
jint* _bgra = env->GetIntArrayElements(bgra, 0);
Mat myuv(height + height/2, width, CV_8UC1, (unsigned char *)_yuv);
Mat mbgra(height, width, CV_8UC4, (unsigned char *)_bgra);
Mat mgray(height, width, CV_8UC1, (unsigned char *)_yuv);
//Please make attention about BGRA byte order
//ARGB stored in java as int array becomes BGRA at native level
cvtColor(myuv, mbgra, CV_YUV420sp2BGR, 4);
vector<KeyPoint> v;
FastFeatureDetector detector(50);
detector.detect(mgray, v);
for(size_t i = 0; i < v.size(); i++)
circle(mbgra, Point(v[i].pt.x, v[i].pt.y), 10, Scalar(0,0,255,255));
env->ReleaseIntArrayElements(bgra, _bgra, 0);
env->ReleaseByteArrayElements(yuv, _yuv, 0);
}
}
lỗi ..
Unresolved inclusion: <vector>
Symbol 'std' could not be resolved
Bạn nên đăng thông báo lỗi và mã tương ứng. – Michael
@Michael ... vui lòng xem các chỉnh sửa .. –
Bạn đang sử dụng Eclipse? Nếu vậy, bạn đã thử điều này chưa: http://stackoverflow.com/questions/9375708/eclipse-indexer-errors-when-using-stl-with-android-ndk? – Michael