I am trying to perform background subtraction using MOG2 in OpenCV 3.0 on my Android phone. However, it seems that there is no suitable constructor to create a new BackgroundSubtractorMOG2 in version 3.0. Here is my code.
@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();
}
Using these codes, Android Studio reminds me that the designer protected access . Also, when I read java src code for BackgroundSubtractorMOG2, I find that there is one parameter for the constructor: long addr . The src code is as follows:
protected BackgroundSubtractorMOG2(long addr) { super(addr); }
I am new to OpenCV4Android, so I don’t know how to build such a class in Java code. Any solution other than using an older version of OpenCV4Android?