我已经使用 openCV 和 native 代码编写了一个 android 应用程序,但是当我尝试为 Unity 提取库时,它在加载 OpenCV 库时崩溃。
public class MainActivity extends UnityPlayerActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!OpenCVLoader.initDebug()) {
Log.e(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), not working.");
} else {
Log.d(this.getClass().getSimpleName(), " OpenCVLoader.initDebug(), working.");
}
//This doesn't work either
//OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_1_0, this, mLoaderCallback);
}
}
有没有办法克服这个问题并加载 OpenCV 库?或者我应该为 Unity 创建另一个接口(interface)并加载 .jar 而不扩展 UnityPlayerActivity?
最佳答案
您将花费时间来实现并将其转换为插件是不值得的。已使用 plugin从 Assets 商店。不是免费的,但值得,因为它也支持其他平台。
关于android - 有没有人使用 OpenCV 实现了一个用于统一的 android 插件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36712588/