Ask Your Question
1

Retrieving Foreground from static background

asked 2013-02-23 05:14:42 -0600

ranger gravatar image

0 down vote favorite

I am working on a video processing project which involves tracking objects which can be stationary or moving. The actual static background is available at the beginning. I have writeen a simple code for getting the foreground :

cv::Mat temp;
cv::absdiff(background,camFrame,temp);
threshold(temp, temp, 128, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
cv::erode(temp,temp,cv::Mat());

But unfortunately the code doesnt seem to work well in retrieving the foreground objects...I will be glab if someboday provide me with some suggestions and bits of code...

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-02-25 08:29:54 -0600

Try the background subtract methods of OpenCV here and specially the Mixture of Gaussian here, and the associated sample (cpp/segment_object.cpp) for an example.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-23 05:14:42 -0600

Seen: 1,508 times

Last updated: Feb 25 '13