Ask Your Question

How to remove floating background?

asked 2018-12-07 03:17:41 -0500

I have images with a black figure on white background, but the brightness of the latter varies smoothly in different parts.

image description

How to make it uniform or max. white (255)? Threshold cut is not possible because at the corners brightness drops almost to the brightness of the figure.

edit retag flag offensive close merge delete



I think you can try the answers given here

LBerger gravatar imageLBerger ( 2018-12-07 03:21:41 -0500 )edit

The second method looks better because it doesn't require parameters like object's size. Any hints what it does? So far as I understand, there is no source image here. Only the background produced from it and the difference. Right?

ya_ocv_user gravatar imageya_ocv_user ( 2018-12-07 04:40:26 -0500 )edit

Method 2 is fit background with a quadric. Image can be thresholded and only white pixel can be fit

LBerger gravatar imageLBerger ( 2018-12-07 07:09:16 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-12-08 04:29:17 -0500

updated 2018-12-08 07:02:09 -0500

The solution for this particular image is to use Morphology Open method with the kernel size of line's thickness. Previously need to make the negative. Morphology Open will render pure background which may be subtracted from the image.

image description

edit flag offensive delete link more


with second method I have got this :

image description

LBerger gravatar imageLBerger ( 2018-12-08 04:36:45 -0500 )edit

And with Morph Open:

don't know how to show image here so added it to the answer

ya_ocv_user gravatar imageya_ocv_user ( 2018-12-08 07:03:34 -0500 )edit

Question Tools

1 follower


Asked: 2018-12-07 03:17:41 -0500

Seen: 105 times

Last updated: Dec 08 '18