Ask Your Question

How to eliminate people's shadow or light noise in background subtraction? [closed]

asked 2017-01-04 20:37:46 -0600

hoang anh tuan gravatar image

updated 2017-01-05 01:12:47 -0600

berak gravatar image

Hi everyone,

I am coding a program using background subtraction applying MoG2 method to detect moving objects. I have referred this program. However it cannot be applied if there is people's shadow or light noise. How can I remove them?


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by hoang anh tuan
close date 2018-05-09 03:37:55.229262

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-04 23:29:24 -0600

If you keep the shadow detection parameter as true, you'd get a gray area like this:

image description

Threshold this image to remove the gray areas and make it black. As for removing the noise, you'll have to try different morphological operations like dialation and erosion to get rid of it. This is the result for the image above:

image description

edit flag offensive delete link more


Hi bro, Use threshold() to remove the gray areas?

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-05 01:24:35 -0600 )edit

Successfully. I know how to remove the gray areas. Set the correct value when use threshold

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-05 01:31:33 -0600 )edit

hey thanks dude.

vinodkumars gravatar imagevinodkumars ( 2017-01-05 01:37:28 -0600 )edit

Yup,threshold(). A value of around 200 for the thresh parameter and 255 for the maxVal parameter would work.

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

And if still small light fragments occur, apply some erosion and dilation to your problem!

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-05 06:31:29 -0600 )edit

It makes thinner or fat. But How does it support?

hoang anh tuan gravatar imagehoang anh tuan ( 2017-01-05 21:50:08 -0600 )edit

Because, if you have the first image, you see this ramdomn noise spots. Some of them might also have a very high value, and thus get through your threshold. Applying a erosion+dilation combination will remove those but keep your large blob!

StevenPuttemans gravatar imageStevenPuttemans ( 2017-01-06 02:30:40 -0600 )edit

I also think so @SetevenPuttemans

hosjiu gravatar imagehosjiu ( 2017-10-23 03:44:23 -0600 )edit

Question Tools

1 follower


Asked: 2017-01-04 20:37:46 -0600

Seen: 3,601 times

Last updated: Jan 04 '17