AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

How to do Background subtraction with Aforge?

The forum is to discuss topics related to different areas of image processing and computer vision.

How to do Background subtraction with Aforge?

Postby snk » Sat Feb 21, 2009 5:01 am

How to do Background subtraction with Aforge?

I want to key a person in any other scenes using background subtraction. However, there are many noises in the output images, e.g.: noises, shadows.

My current implementation is as followings:
1.Background


2.Foreground with a person


3. Keyed image


However, as you can see, the keyed image has shadow and noises which broke the keyed image.

So, are there any way to do with Aforge to tackle the shadow and noises such that the image will be very beautiful?

Thanks.

Edit: Image deleted
Last edited by snk on Mon Feb 23, 2009 8:12 am, edited 1 time in total.
snk
 
Posts: 10
Joined: Wed Feb 04, 2009 9:05 am

Re: How to do Background subtraction with Aforge?

Postby andrew.kirillov » Sat Feb 21, 2009 3:59 pm

Hello,

snk wrote:However, there are many noises in the output images,

In order to remove small unwanted objects, you may use BlobsFiltering filter, for example. Or you may use BlobCounter class filtering and sorting blobs by size and find the biggest one.

Unfortunately it is harder with shadows. You may need to play with treshold. But it may result in removing some object's parts together with shadows.

If you have some specific task, then I would recommend changing your setup. Solution of Computer Vision problem is not only some application, which does image processing. Equipment setup is also very important. Around 80% of successful solution of computer vision problem depends on illumination and light conditions. But what you have now looks just like generic case (which leads to all sorts of issues of course).
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3437
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: How to do Background subtraction with Aforge?

Postby snk » Mon Feb 23, 2009 8:15 am

andrew.kirillov wrote:Hello,

snk wrote:However, there are many noises in the output images,

In order to remove small unwanted objects, you may use BlobsFiltering filter, for example. Or you may use BlobCounter class filtering and sorting blobs by size and find the biggest one.

Unfortunately it is harder with shadows. You may need to play with treshold. But it may result in removing some object's parts together with shadows.

If you have some specific task, then I would recommend changing your setup. Solution of Computer Vision problem is not only some application, which does image processing. Equipment setup is also very important. Around 80% of successful solution of computer vision problem depends on illumination and light conditions. But what you have now looks just like generic case (which leads to all sorts of issues of course).


Thanks for your reply.
In fact, my project can't change the environment.
So, I have to tackle the problems of shadows and noises.
Would you suggest any idea regarding this issues?

thx
snk
 
Posts: 10
Joined: Wed Feb 04, 2009 9:05 am

Re: How to do Background subtraction with Aforge?

Postby andrew.kirillov » Mon Feb 23, 2009 9:57 am

Hello,

Well, regarding noise I've already mentioned - try blobs counting routines. It is possible to do a lot of things with that.

Regarding shadows. One of the ideas is to try switching to another color space, where it could be possible to separate illumination. For example, you may try using HSL color space. Using Hue or Saturation channels may be a good way of trying to avoid shadows influence.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3437
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: How to do Background subtraction with Aforge?

Postby snk » Wed Feb 25, 2009 7:35 pm

I found rg chromaticity in wiki but I haven't implemented it.

http://en.wikipedia.org/wiki/Rg_chromaticity

"Notably, where a scene viewed by a camera is not lit evenly – for example if lit by a spotlight – then an object of a given color will change in apparent color as it moves across the scene. Where color is being used to track an object in an RGB image, this can cause problems. The lack of intensity information in rg chromaticity images removes this problem, and the apparent color remains constant.", quote from Wiki.

If I change all the RGB value to Rg_chromaticity and compare the background and current image, can the shadow problem be solved?
snk
 
Posts: 10
Joined: Wed Feb 04, 2009 9:05 am

Re: How to do Background subtraction with Aforge?

Postby andrew.kirillov » Wed Feb 25, 2009 9:16 pm

snk wrote:I found rg chromaticity in wiki but I haven't implemented it.

http://en.wikipedia.org/wiki/Rg_chromaticity

In many papers it is known as normalized RGB, where:
Code: Select all
r = R / ( R + G + B )
g = G / ( R + G + B )
b = B / ( R + G + B )

Usually the b component is not taken into account, since r + g + b = 1.

snk wrote:If I change all the RGB value to Rg_chromaticity and compare the background and current image, can the shadow problem be solved?

It should help. As an example, white color, gray color, dark gray and light gray will all have the same value in normalized RGB color space. Similar with other colors ...
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3437
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Image Processing and Computer Vision

cron