c++ - OpenCV Image Manipulation -


I'm trying to find the difference between 2 images.

Scenario: Suppose I have 2 images, one background in front of the background and one person's second, I want to subtract two images in such a way that I get this condition in person, that program Is where the person stood and could give the image reduced as output.

The code I have succeeded is taking two pictures from the camera and re-shaping them and converting both images into a gray scale. I wanted to know what to do after this, I examined the decreasing work provided by OpenCV, but it takes the form of input, so I do not know about progress.

The code I have written is:

  cap> & Gt; Frame; // The first image becomes cv :: cvtColor (frame, frame, CV_RGB2GRAY); // it converts the gray scale cv :: resize (frame, frame, size (30,30)); // re-size it into Cap & gt; Frame2; // second image CV :: CVT color (frame 2, frame2, cv_rgb2gra); // it converts the gray scale cv :: resize (frame 2, frame 2, size (30,30)); // resize   

Now I just use the subtract just like function:

  cv :: subtract (frame_grey, frame, frame);   

Or do I apply some filters first and then use the subtract function?

As others have seen, this is a difficult problem: easy to come up with a hack Which will sometimes work hard, it will be difficult to come up with solutions that will work most of the time with minimal human intervention. In addition, if you can tightly control the content and background light, then it is very easy to do. Business applications are known as "chromeizing" (specialized in TV industry), "bluesing", "matting" or "matte travel" (in cinematography), in computer vision, "background removal".

Semi-uniform backdrops were very important work for the mat several years ago. Patents have already ended in their original algorithm, so you can go to the city with them (and get different quality open source implementations). Needless to say, IANL, then do their homework on the patent issue.

The matrix of more complex backgrounds is still an active research area, especially for the case when no 3D information is available. You want to see some research papers that have come from semi-recent past from MS Research (A.Criminci did some work in that area).

Comments