0

I would like to remove the background light gradient from the following image, such that the lightening would become more homogeneous, the interesting objects being the kind of "cones" seen from the top.

Image:

enter image description here

I also have an image "background" without the cones :

enter image description here

I tried the simplest thing , which is to convert these images in grayscale and the substracting it but the result is pretty ... (really) bad, using :

img = np.array(Image.open('../Pics/image.png').convert('L'))
background = np.array(Image.open('../Pics/background.JPG').convert('L'))
img_filtered = img - background

What could you advise me ? The ideal would be to stay in RGB, though I don't know almost anything about image processing, filters, etc ...

1 Answer 1

1

By "the result is pretty ... (really) bad", i assume, you see a picture like this: bad picture...

This seems to be due to the fact, that subtracting images, which could produce negative numbers instead starts "from the top" of the brightness-scale, like this: 4-5 = 255 instead of -1.

This is a byproduct, on how the pictures are loaded. If i use "plain numpy array", get a picture like this: good picture

So maybe try handling your pictures as numpy arrays: take a look over here

[Edit: This is due to the dtype uint8 of the numpy arrays. Changing to int should already be enough]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.