3

I didn't find clear answer on that: I have some dots and stains on my lens. It's not so visible on some pictures but when I take shot at sky or something bright, the image is spoiled by stain and spots. So the question "Extract similarities between bunch of image to remove stains on gimp or imagemagick" You see, I want to extract similarities ie : the dots and stain from differents images.

After that when I get my image with only the dots and stains, I can make a substraction on the spoiled images

Thanks for help and advices

edit: I maybe need to reformulate a bit. All my pictures are spoiled with smudges. My Idea was actually to takes (or a bunch of) all these picture to detect what it remains the same and create a picture of that.

This extracted picture will be the smudges only.

Then I can substract it from the spoiled image. Spot the Idea?

It's like background substraction on video. Imagine a car park. We want only the the background (said, the landmarks). We take many pictures with some car at random places. And I beleive there is an algorithm that can extact only the background by creating and image of what remain the same (the soil of the car park)

Imagemagick can do something like that ? Or another app ?

4
  • 1
    They are not on your lens but on your sensor (stains on a lens aren't visible unless you have a macro lens with an extremely short focus distance, otherwise they just cause a global loss of contrast). if this is a DSLR you can clean you sensor.
    – xenoid
    Commented May 31, 2017 at 11:51
  • @xenoid seems you're right, that sounds logical indeed -but not a actual answer ;)- Commented May 31, 2017 at 13:20
  • That's why it's a comment ... Also, some cameras can map the sensor stains and remove them from the picture they take. RTFM :)
    – xenoid
    Commented May 31, 2017 at 15:39
  • @xenoid No intention to be rude ;) thanks for the comment. Yes I've read the manual. The problem comes from my Xperia Z5. No clue on how to correct that technically. Brought to repair with no succes. Commented Jun 1, 2017 at 8:23

1 Answer 1

3

To always remove stains or dust from the exact same areas of several images the following workflow using Gimp may lead to satisfactory (but not perfect) results.

Obtain despeckle mask

  1. Take an image from an even grey background to reveal artifacts

    enter image description here Source: Wikimedia

  2. Select artifacts (using Select by Color-tool or manually)

    enter image description here
    The more you select here the more is going to be repaired later.

  3. Convert selection to a path

  4. Save this path as .SVG

Despeckle from mask

  1. Load image to enhance

    enter image description here

  2. Load path from above

  3. Convert path to selection

    enter image description here

  4. Apply Heal Selection tool

    ![enter image description here
    Heal Selection: 10 px | All around | Random
    To avoid artifacts from healing (see bottom right) deselect areas from step 3.

1
  • 1
    @yeah - that's what I said in my last sentence. This was only a very quick demonstration on how to do that. If for real I would probably remove the whole bottom corner from the selection to leave the artifacts untouched - it got completely selected on automatic selection by color.
    – Takkat
    Commented May 31, 2017 at 18:59

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.