【发布时间】:2016-01-17 17:47:31
【问题描述】:
我尝试初始化 openCv 以使用相机。库已成功初始化,但是当我尝试初始化 openCc 时,它返回此错误:
01-17 14:19:24.606 8747-8747/com.pettracker.objecttracker E/OpenCV could not be loaded!: CameraTest::CameraPreview
01-17 14:19:24.606 1267-1476/system_process W/ActivityManager: Unable to start service Intent { act=org.opencv.engine.BIND pkg=org.opencv.engine } U=0: not found
01-17 14:19:24.606 1267-1278/system_process W/ActivityManager: Unbind failed: could not find connection for android.os.BinderProxy@b15c6c98
我正在尝试使用 openCv 库来使用相机进行颜色跟踪。代码如下图:
public CameraPreview(ICameraPreviewCallback context, IFrameProcessor frameProcessor) {
super((Context)context);
mContext = context;
System.out.println(mContext);
mFrameProcessor = frameProcessor;
if (!loadOpenCV()) {
Log.e("OpenCV could not be loaded!", TAG);
}
}
private boolean loadOpenCV() {
return OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, (Context)mContext, this);
}
另外,我修改了initOpenCv,这样我就不会遇到intent的隐式调用,代码如下图:
public static boolean initOpenCV(String Version, final Context AppContext,
final LoaderCallbackInterface Callback)
{
AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
Intent intent = new Intent("org.opencv.engine.BIND");
intent.setPackage("org.opencv.engine");
if (AppContext.bindService(intent,
helper.mServiceConnection, Context.BIND_AUTO_CREATE))
{
return true;
}
else
{
AppContext.unbindService(helper.mServiceConnection);
InstallService(AppContext, Callback);
return false;
}
}
此错误的原因可能是什么?我该如何解决?
【问题讨论】:
标签: android opencv android-intent android-studio camera