Ask Your Question
0

Why does the foreground image from background subtraction look transparent?

asked 2017-01-05 02:50:53 -0600

updated 2017-01-05 04:52:25 -0600

Hello!

I've been working on background subtraction techniques to detect and track humans in a scene. Because I don't want the background to change, and just subtract the frames from the first reference frame, so I've tried both the OpenCV MOG2(with learning parameter set to zero) and using the first frame and using the absdiff() to find the difference. But the foreground images I get from both techniques looks transparent as in, part of the background can be seen through the person as shown below:

Results with the absdiff() technique:

-Original Image:

image description

-Foreground Image:

image description

Results with the MOG2:

-Original Image:

image description

-Foreground Image:

image description

And this is the background(reference) image for both the methods:

image description

Does anyone know why this happens? I need to detect and track the people for which I find the blobs and because of the transparency the blobs are pretty much detected as two blobs which messes up everything else.

Thanks in advance!

edit retag flag offensive close merge delete

Comments

1

try without the black sweater ;)

(it can't see any difference between black chairs and black sweater)

berak gravatar imageberak ( 2017-01-05 03:10:09 -0600 )edit

Ah! Can't believe I hadn't thought of that! I feel silly now! Thanks anyways!

abhijith gravatar imageabhijith ( 2017-01-05 03:47:09 -0600 )edit
1

ofc, that's not the cure, just meant for a better understanding the situation.

actually, i'd think yours is quite a typical, real life case.

berak gravatar imageberak ( 2017-01-05 03:57:40 -0600 )edit

I know but this acts as another argument, a strong one, against not using background subtraction for human detection.

That is, of course, if there is no solution to overcome this problem right?

abhijith gravatar imageabhijith ( 2017-01-05 04:02:07 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-05 04:23:00 -0600

berak gravatar image

it's kind of unavoidable, that parts of the body will look very similar to the background, and will result in a poor subtraction (you can't command ppl to wear all yellow ;)

but at least, if the majority of the figure is detected, you can exploit that, and use some post-processing.

here's some very simple approach, alternate blurring/thresholding:

blur(ocv,ocv, Size(12,12));
threshold(ocv,ocv,15,255,0); // below 15 will show shadows again.

ugly, but at least it's a single blob.

image description

there's also morphological operations for this, you'll have to derive your own mix, which quite depends on your actual situation.

edit flag offensive delete link more

Comments

1

This is what I'm working on. With tracking into play, I think I need some other heuristic especially if the shapes of my blobs change from one frame to another and the morphological operations don't always give a single blob.

Anyhoo, Thanks for your help!:)

abhijith gravatar imageabhijith ( 2017-01-05 05:01:38 -0600 )edit

maybe use those blobs only as a hint, which region to search with a more refined pass, e.g. take the boundingbox of it (findContours), and feed that roi to HOG person detection

berak gravatar imageberak ( 2017-01-05 05:08:35 -0600 )edit
1

I've been avoiding HOG because we have a whole bunch of processing on the detected person(age detection, gender detection, gesture detection) which are all, already computationally expensive and we need to run this code on a GPU. And also, HOG doesn't always detect people when only half their body is in frame

abhijith gravatar imageabhijith ( 2017-01-05 05:16:11 -0600 )edit

Your case is the exact reason why most academics working on pedestrian detection moved away from background subtraction and started using more advanced techniques like ICF, ACF, CNN's, ... I know they are computationally expensive, but most of them can already be heavily optimized to run real time!

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-05 06:04:33 -0600 )edit

I faced a similar situation i.e multiple blobs for same person, one above waist and another below. Use of morphological operations and filling with holes solved the problem.

ManuVISION gravatar imageManuVISION ( 2017-01-10 08:39:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-05 02:50:53 -0600

Seen: 2,035 times

Last updated: Jan 05 '17