I am using OpenCV 3.0 in Java, I want to use BackgroundSubtractor
to get foreground objects and also I want to get the background image, but when I call getBackgroundImage()
method of BackgroundSubtractor
return me an empty image. The code is bellow:
Mat backgroundImage = new Mat();
mog2.getBackgroundImage(backgroundImage);
According to the OpenCV Documentation this method can return the background image and put the data to the given Mat:
Computes a background image. C++: void BackgroundSubtractor::getBackgroundImage(OutputArray backgroundImage) const Parameters: backgroundImage – The output background image.
What will be the problem? If anyone knows about this, please let me know.
Thanks in advance!