dlopen failed: cannot locate symbol "__aeabi_memclr8" referenced by "/data/app/com.example.yy.ku-2/lib/arm/libOpenCV.so"...
不知道什么原因
C代码写成这样可以运行:
写成下面这样就会报错:
JNIEXPORT jintArray JNICALL Java_com_example_yy_ku_OpenCVHelper_gray(JNIEnv *env,jclass obj,jintArray buf,jint w,jint h)
{
jint *cbuf;
cbuf = env->GetIntArrayElements(buf,JNI_FALSE);
if (NULL == cbuf)
{
return 0;
}
Mat imgData(h,w,CV_8UC4,(unsigned char*) cbuf);
Mat now(h , w , CV_8UC3 , Scalar(0,0,0)) ;
uchar* ptr = imgData.ptr(0);
for(int i = 0; i < h; i++){
for(int j = 0 ; j < w ; j++){
//计算公式:Y(亮度) = 0.299*R + 0.587*G + 0.114*B
//对于一个int四字节,其彩色值存储方式为:BGRA
int k = i * w + j ;
now.at<Vec3b>(i,j)[0] = ptr[4*k+0] ; //B
now.at<Vec3b>(i,j)[1] = ptr[4*k+1] ; //G
now.at<Vec3b>(i,j)[2] = ptr[4*k+2] ; //R
}
}
Mat gray ;
cvtColor(now, gray, CV_BGR2GRAY);
threshold(gray, gray , 100 , 255 , 3 ) ;
for(int i = 0; i < h; i++){
for(int j = 0 ; j < w ; j++){
int k = i * w + j ;
ptr[4*k+1] = gray.at<uchar>(i,j) ;
ptr[4*k+2] = gray.at<uchar>(i,j) ;
ptr[4*k+0] = gray.at<uchar>(i,j) ;
}
}
int size = w * h;
jintArray result = env->NewIntArray(size);
env->SetIntArrayRegion(result,0,size,cbuf);
env->ReleaseIntArrayElements(buf,cbuf,0);
return result;
}
报错,时就是这样的错:
[color=#FF0000]java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__aeabi_memclr8" referenced by "/data/app/com.example.yy.ku-2/lib/arm/libOpenCV.so"...[/color]