I'm quite new to OpenCV and having trouble using BackGround substration.
I want to recognize the figure of a person, having a picture of the background and the same picture with the person.
I tried the grab cut algorithm, the substraction also and none of it worked. Now I'm trying to use the background substraction, but I can't seem to understand it. Here's my code :
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat PersonImage=Highgui.imread("boardWithMe.jpg");
Mat Image = Highgui.imread("boardWithoutMe.jpg");
BackgroundSubtractorMOG b = new BackgroundSubtractorMOG();
Mat output = new Mat();
b.apply(PersonImage, output,0.0);
Highgui.imwrite("outputImage.jpg", output);
}
I always get a black picture. What should I change to make it work ? (By the way, I'm using openCV 2.4.13 so there is a constructor for BackgroundSubstractorMOG)