<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>Any suggestions of the best way to go?</p>

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

<p><a href="https://i.sstatic.net/mUC7H.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mUC7H.jpg" alt="enter image description here"></a></p>

<p>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.</p>

<p><a href="https://i.sstatic.net/hFsnV.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hFsnV.jpg" alt="Sample photo - it&#39;s a mammogram, showing a tumour"></a></p>

CC BY-SA 3.0
2016-09-10T16:47:19.610Z
I'm so sorry, I'm an idiot. I thought it was there..
Peter Brooks
CC BY-SA 3.0
2016-09-10T17:59:10.450Z
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.
Peter Brooks
CC BY-SA 3.0
2016-09-10T19:10:11.877Z
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?
Peter Brooks
CC BY-SA 3.0
2016-09-10T20:51:10.810Z
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.
Peter Brooks
CC BY-SA 3.0
2016-09-10T22:23:32.250Z
Ah I see - you have a practical real world problem rather than a computer graphics problem. This sounds like it will be off topic. Image processing is on topic here, but this sounds like it would need a sophisticated computer vision/machine learning approach, which goes outside our scope.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-09-10T22:26:05.573Z
It's difficult to judge what is simple image processing and what is far more complex. [This xkcd](http://xkcd.com/1425/) sums it up well.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-09-11T01:54:08.837Z
LOL! Yes, xkcd nails it (as it does so many things) brilliantly. I do understand. I'll look for a good representative image.
Peter Brooks
CC BY-SA 3.0
2016-09-11T02:09:53.470Z
I've added a representative image - it doesn't show any clips, but the straight-edged areas it show are probably better, if I could remove them, then a rectangle, or perfect circle / ellipse, should be easy.
Peter Brooks
CC BY-SA 3.0
2016-09-11T15:24:44.723Z
It's worth reading about the [XY problem](http://meta.stackexchange.com/a/66378/258647).
trichoplax is on Codidact now
CC BY-SA 3.0
2016-09-11T15:25:50.683Z
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.
trichoplax is on Codidact now
CC BY-SA 3.0
2016-09-11T15:38:40.540Z
To summarise, I suspect that the only part of the solution that will be on topic here may turn out to be unnecessary. It may be worth having a look at [Data Science Stack Exchange](http://datascience.stackexchange.com/help/on-topic), where machine learning questions are on topic.
trichoplax is on Codidact now
<opengl><gpu><computational-geometry><image-processing><mathematics>
Image cleaning - removing all regular shapes ( circles, squares, text, icons etc. )
Peter Brooks
# Image cleaning - removing all regular shapes ( circles, squares, text, icons etc. )

(Asked by: username_0 on 2016-09-10)

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](https://i.sstatic.net/mUC7H.jpg)](https://i.sstatic.net/mUC7H.jpg)

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](https://i.sstatic.net/hFsnV.jpg)](https://i.sstatic.net/hFsnV.jpg)

**Tags:** opengl, gpu, computational-geometry, image-processing, mathematics

> **Comments:**
> **username_0**: I'm so sorry, I'm an idiot. I thought it was there..  
> **username_0**: 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.  
> **username_0**: 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?  
> **username_0**: 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.  
> **username_1**: Ah I see - you have a practical real world problem rather than a computer graphics problem. This sounds like it will be off topic. Image processing is on topic here, but this sounds like it would need a sophisticated computer vision/machine learning approach, which goes outside our scope.  
> **username_1**: It's difficult to judge what is simple image processing and what is far more complex. [This xkcd](http://xkcd.com/1425/) sums it up well.  
> **username_0**: LOL! Yes, xkcd nails it (as it does so many things) brilliantly. I do understand. I'll look for a good representative image.  
> **username_0**: I've added a representative image - it doesn't show any clips, but the straight-edged areas it show are probably better, if I could remove them, then a rectangle, or perfect circle / ellipse, should be easy.  
> **username_1**: It's worth reading about the [XY problem](http://meta.stackexchange.com/a/66378/258647).  
> **username_1**: 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.  
> **username_1**: To summarise, I suspect that the only part of the solution that will be on topic here may turn out to be unnecessary. It may be worth having a look at [Data Science Stack Exchange](http://datascience.stackexchange.com/help/on-topic), where machine learning questions are on topic.  

---

## 0 answers

