通过OpenCV的3.0 RC1创建Android中BackgroundSubtractorMOG2 [英] Creating BackgroundSubtractorMOG2 in Android by OpenCV 3.0 RC1

查看:2322
本文介绍了通过OpenCV的3.0 RC1创建Android中BackgroundSubtractorMOG2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做背景减法MOG2在OpenCV中3.0我的Andr​​oid手机上。然而,似乎没有合适的构造在3.0版中创建一个新的BackgroundSubtractorMOG2。我的code在这里躺下。

I'm trying to do background subtraction with MOG2 in OpenCV 3.0 on my android phone. However, it seems that there are no suitable constructor to create a new BackgroundSubtractorMOG2 in version 3.0. My code lies down here.

@Override
public void onCameraViewStarted(int width, int height) {
    mFrame = new Mat(height, width, CvType.CV_8UC4);
    mFgMaskMOG = new Mat(height, width, CvType.CV_8UC1);
    pMOG2 = new BackgroundSubtractorMOG2();
}

使用这些codeS的Andr​​oid工作室提醒我,的构造函数保护访问即可。此外,当我读到BackgroundSubtractorMOG2 java的SRC code我觉得有一个为构造一个参数:长地址即可。在src code如下:

With these codes Android studio reminds me that the constructor has protected access. Besides, when I read java src code of BackgroundSubtractorMOG2 I find that there's one parameter for the constructor: long addr. The src code as following:

protected BackgroundSubtractorMOG2(long addr) { super(addr); }

我是新来OpenCV4Android因此不知道如何构建在Java code这样的类。除了使用OpenCV4Android旧版本的任何解决方案?

I'm new to OpenCV4Android thus don't know how to construct such a class in java code. Any solution besides using older version of OpenCV4Android?

推荐答案

您可以在OpenCV中3.0.0使用code:

You can use this code in OpenCV 3.0.0:

BackgroundSubtractorMOG2 pMOG2 = Video.createBackgroundSubtractorMOG2();

这篇关于通过OpenCV的3.0 RC1创建Android中BackgroundSubtractorMOG2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆