extern "C"
JNIEXPORT void JNICALL
Java_com_itrace_itrace_12dmi_Utils_HoughUtils_testFunction(JNIEnv *env, jobject thiz,
jlong val) {
Mat &img = (Mat ) val;
int chan=img.channels();
cvtColor(img,img,COLOR_RGBA2GRAY);
// TODO: implement testFunction()
}
下面是函数调用
testFunction(mat.getNativeObjAddr());
这不能正常工作。
如果从“ onCameraFrame”调用本机函数“ testFunction”,则它将按预期工作。
尽管从写在“ onCameraFrame”内部的另一个函数调用本机函数“ testFunction”不起作用。
以下是错误
CvException [org.opencv.core.CvException:cv :: Exception:OpenCV(3.4.6)/build/3_4_pack-android/opencv/modules/imgproc/src/color.simd_helpers.hpp:88:错误:( [cv :: impl :: {anonymous} :: CvtHelper :: CvtHelper(cv :: InputArray,cv :: OutputArray,int)中的-2:未指定错误)[with VScn = cv :: impl :: {anonymous} :: Set <3,4>; VDcn = cv :: impl :: {anonymous} :: Set <1>; VDepth = cv :: impl :: {anonymous} :: Set <0,2,5>; cv :: impl :: {{anonymous} :: SizePolicy sizePolicy =(cv :: impl :::: SizePolicy)2u; cv :: InputArray = const cv :: _ InputArray&; cv :: OutputArray = const cv :: _ OutputArray&]'
输入图像中无效的通道数: 'VScn :: contains(scn)' 哪里 'scn'是1 ]