I'd like an automatic method to clean images. I've been looking at the GIMP, and its command line (cli) interface, in scheme / lisp. It looks very promising, but I'm a complete novice, so I'd be grateful for advice.

I'm, essentially, wanting to remove all man-made artefacts from a large number of photos - which is why I need to automate it, it's easy enough with just the one.

I'd like to remove anything with a hard-edge (square, rectangle, or part of one), or with a smooth curve (circle, ellipse, or part of one), but not remove naturally curved things, like leaves, or fronds.

I've attached a before and after photo. In a perfect world, I'd like a script that takes the image on the left, and leaves the image on the right.

Any suggestions of the best way to go?

It'd be nice if the method could be one that can use a GPU.

enter image description here

Here's a representative image. In this, I'd be wanting to exclude the straight-edged areas on the top right, and the straight-edged white blocks on the top left. What I'd be not wanting to exclude, but would actually be looking for (a separate problem) would be the white mass that's just to the bottom-right of the centre of the image. As you can see, it has nothing like a straight-edge or arc about it.

Sample photo - it's a mammogram, showing a tumour

  • $\begingroup$ I'm so sorry, I'm an idiot. I thought it was there.. $\endgroup$ Sep 10, 2016 at 16:47
  • $\begingroup$ OK. What's special about the areas removed is one of: There is a straight edged border (at least one). There is a border that is the arc of a circle - an interior or exterior border. The items left have irregular borders, with no straight edges and no arcs. $\endgroup$ Sep 10, 2016 at 17:59
  • $\begingroup$ OK, thank you, that's a fair comment. Would it help the straight edge, or arc, will be at least x pixels or cm long? This will be the case, what I'm wanting to keep will never have a straight border, or a proper arc, more than .5 cm long. Does that make it easier? $\endgroup$ Sep 10, 2016 at 19:10
  • $\begingroup$ I am searching medical images that have things like clips that I need to eliminate, so I can concentrate on the anatomy - our anatomy doesn't have straight lines, or, at the level I'm working at, arcs. $\endgroup$ Sep 10, 2016 at 20:51
  • 2
    $\begingroup$ I suspect that the overall problem of finding dense masses will require a sophisticated machine learning approach, which may render the initial removal of smooth edges redundant. $\endgroup$ Sep 11, 2016 at 15:25


Your Answer

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