How to refine foreground image? [closed]
I work with background subtraction using MOG2 method & obtained as the foreground image below:
As shows above, I fail to get exact pixel as the original frame. What should I do?
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 suppose the original is RGB. only the background is in black, but the foreground should be in color as original as captured by camera.
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 thank you for noticing the ring anyway. Can't I get smooth foreground btw? Where there is no black pixel on the foreground?
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.
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.
blur the mask. like with a 15x15 gaussian
thanks @Tetragramm. @berak what is the reason of applying Gaussian blur in this case?