Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Background subtraction to create chroma key effect with live webcam stream

I've implemented a C# based OpenCV demo using BackgroundSubtractorMOG. The C# code is exactly based on the Java port of OpenCV. I am correctly getting contours or very rough outlines of any moving objects.

However, the effect I am more interested in is a 'chromakey' or 'green screen' type effect on a live webcam stream without using green screen. The way it works is that a 'reference' frame is grabbed when the live web cam stream starts and then this frame is used to create a difference matte to mask out any moving objects(people) and then composited with another static or moving background image. A simple threshold is used to adjust the matte.

I've compiled a demo of this in OpenFrameworks but am having a problem finding any OpenCV Java code to reference. Part of the problem is perhaps I'm not using the correct search terms. Can any OpenCV gurus at least point me in the right direction?Just searching for 'background subtraction + OpenCV + java" isn't getting me anywhere...