How to refine foreground image? [closed]

asked Feb 16 '16

Aj-611 gravatar image

updated Nov 4 '0

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?

Preview: (hide)

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

Comments

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 (Feb 16 '16)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 (Feb 17 '16)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 (Feb 17 '16)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 (Feb 17 '16)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 (Feb 17 '16)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 (Feb 17 '16)edit

blur the mask. like with a 15x15 gaussian

berak gravatar imageberak (Feb 17 '16)edit

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

Aj-611 gravatar imageAj-611 (Feb 18 '16)edit