Background subtraction to create chroma key effect with live webcam stream [closed]

asked 2015-09-04 14:24:40 -0600

eco_bach gravatar image

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...

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by sturkmen
close date 2020-10-18 10:40:35.647211

Comments

"I am correctly getting contours or very rough outlines of any moving objects." - yes, that's expected. do : findContours() -> approxPoly() -> floodfill() to get a solid object for masking.

berak gravatar imageberak ( 2015-09-05 02:56:16 -0600 )edit