How to refine foreground image? [closed]

asked 2016-02-15 21:56:01 -0500

Aj-611 gravatar image

updated 2020-11-04 10:01:51 -0500

I work with background subtraction using MOG2 method & obtained as the foreground image below:

image description

As shows above, I fail to get exact pixel as the original frame. What should I do?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-03 08:35:44.357169


What does the original frame look like? What is different? Just the fingers?

How long a history did you give it?

Unfortunately, there's not really enough information here to help.

Tetragramm gravatar imageTetragramm ( 2016-02-16 17:54:11 -0500 )edit

@Tetragramm suppose the original is RGB. only the background is in black, but the foreground should be in color as original as captured by camera.

Aj-611 gravatar imageAj-611 ( 2016-02-16 20:02:29 -0500 )edit

Well, what is the problem then? Your image there appears to be in color. I pretty clearly see some blue, red and gold where the ring is on the finger.

Tetragramm gravatar imageTetragramm ( 2016-02-16 21:02:11 -0500 )edit

@Tetragramm thank you for noticing the ring anyway. Can't I get smooth foreground btw? Where there is no black pixel on the foreground?

Aj-611 gravatar imageAj-611 ( 2016-02-16 21:24:21 -0500 )edit

There are a couple of things you can do.

First, make a better background, whether that is more images, denoising, or whatever else.

Second, morphological operations can fill in the small gaps and remove the small speckles.

Third, You can use segmentation to separate the image into parts, and segments with many foreground pixels in them can simply be filled solid, while those with only a few are called background.

Tetragramm gravatar imageTetragramm ( 2016-02-16 22:34:45 -0500 )edit

I should point out that making a better background is your best option, but it depends a lot upon the specifics of your scenario, so I can't help you without more information about what you are doing and what you want.

Tetragramm gravatar imageTetragramm ( 2016-02-16 22:35:35 -0500 )edit

blur the mask. like with a 15x15 gaussian

berak gravatar imageberak ( 2016-02-17 02:07:38 -0500 )edit

thanks @Tetragramm. @berak what is the reason of applying Gaussian blur in this case?

Aj-611 gravatar imageAj-611 ( 2016-02-17 20:25:38 -0500 )edit