I have several images, each of which has the same artifact/defect. Does anybody have a suggestion to remove such an artifact?

The images are disordered arrays of dots. The artifacts include the 'squiggly worm' and the 'circular ripples' that you can hopefully identify by eye.

I tried using the pixel median of all the images, like in this post, but I was unsuccessful.

The following code will quickly import all the images.

names = 
  {"DgkH6V5", "QHgATwh", "CWMkitU", "IymdBJM", 
   "BxkbVOj", "qyanXWZ", "6Wlvnr1", "upxv4EH"};
frames = Import["https://imgur.com/" <> # <> ".png"] & /@ names;

enter image description here

  • $\begingroup$ Do you have an image with only the artefact and a flat background? $\endgroup$
    – rhermans
    Jul 17, 2018 at 15:18
  • $\begingroup$ Unfortunately not :( $\endgroup$
    – Tom
    Jul 17, 2018 at 15:22
  • $\begingroup$ Consider ImageAdjust@Mean[EdgeDetect /@ frames] $\endgroup$
    – kirma
    Jul 17, 2018 at 15:32

1 Answer 1


For a start, you could consider that your artifacts are of a different frequency than the dots in the background which are slightly blurred:

img = Import["https://i.stack.imgur.com/lTMs1.png"];
LowpassFilter[img, .4]

Mathematica graphics

  • $\begingroup$ Also: Import["https://i.stack.imgur.com/lTMs1.png"] // HighpassFilter[#, .5] & // ImageAdjust ... but this is also kind of "tuning" regarding the parameter that makes me a bit uneasy, but so are all somewhat arbitrary constructs that bring out details for a specific set of samples. $\endgroup$
    – kirma
    Jul 17, 2018 at 17:05
  • $\begingroup$ A useful approach. Perhaps I can use the HighpassFiler selectively in the regions that contain an artefact, to minimise the image processing done to regions with no defects. $\endgroup$
    – Tom
    Jul 18, 2018 at 9:25
  • $\begingroup$ @Tom That would be a better approach. You weren't clear what you would like to do with the images, but repairing them completely is (a) not possible and (b) nothing you should consider when you want to quantify the data. There are cases in science where you need to reconstruct data to quantify it, but in your case, I would also vote to create regions from the artifacts and exclude them. $\endgroup$
    – halirutan
    Jul 18, 2018 at 11:38

Your Answer

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

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