Page 2 of 2

Re: most colors used (color analysis)

Posted: 2009-07-31T08:10:24-07:00
by rudi
I was searching for some information about how the -segment option works and found this thread...
The -segment option does do this but is very hard to use.
Is there any information around that explains the output from -segment ?

What I'm trying to do is find areas of black text on a colour-indexed geographical map and obscure them. This is for a map-reading game where players are supposed to find a location by using the map information but without having placenames printed on the map to help them.

I can get the output from convert -segment using -verbose but it isn't all that meaningful to me.

Re: most colors used (color analysis)

Posted: 2009-07-31T14:34:31-07:00
by fmw42
What I'm trying to do is find areas of black text on a colour-indexed geographical map and obscure them. This is for a map-reading game where players are supposed to find a location by using the map information but without having placenames printed on the map to help them.
Perhaps you could explain this in more detail with an example. You may not need -segment as there may be easier ways to do what you want, for example using -fuzz XX% -fill some color -opaque black

Re: most colors used (color analysis)

Posted: 2009-07-31T20:04:30-07:00
by anthony
You may even be able replace the text with transparency and then use some 'hole filling' type algorithm.

Re: most colors used (color analysis)

Posted: 2009-08-01T04:40:36-07:00
by rudi
fmw42
The map comes as a png file and has labels (e.g. placenames and names of other geographical features) printed on them. The players are meant to identify the location just by looking at the topography displayed on the map (contour lines representing hills and valleys, river courses, coastline, alignment of roads, tracks and railways etc.) without knowing the names of the features (as it would be possible to look them up and therefore spoil the point of the game). Either putting a bar across any names or blurring them would be fine - it doesn't have to be pretty or disguise the fact that a name is printed on the original map.
The names are printed in black but blend gradually into the surrounding colours. I was trying to find a way to locate dark pixels (i.e. those near to fuzzy black text), then to feather the selected area (to make it unreadable), and replace it with pure black.
It's the locating pixels by colour that I'm struggling with.

anthony
Do you mean hole filling in the sense of filling up the inner boundaries of a selected pattern, such as the inside of an 'o'? I would still have to do something about the outer boundary as well, as the text would still be legible with filled-in o's and p's etc - just like pages typed energetically on an old mechanical typewriter...

Thank you both for taking the trouble!

Re: most colors used (color analysis)

Posted: 2009-08-01T18:17:36-07:00
by anthony
rudi wrote:anthony
Do you mean hole filling in the sense of filling up the inner boundaries of a selected pattern, such as the inside of an 'o'? I would still have to do something about the outer boundary as well, as the text would still be legible with filled-in o's and p's etc - just like pages typed energetically on an old mechanical typewriter...
In a way yes. You remove the text making a 'hole' (meaning it plays no part in the
final results - it is NOT PRESENT) then you fill in the hole based on the surrounding image. There are anumber of ways to do this, the best methods using only the
colors immediatally adjacent to the 'hole'.

One example of this is in IM Examples Photo Handling, removing text and logos
http://www.imagemagick.org/Usage/photos/#removing

There are also many other methods and techniques as well (morphology, FFT, sparse color filling), but these have not been developed exampled in IM as yet.

See the old discussion of this topic in...
viewtopic.php?p=41498#p41498

Re: most colors used (color analysis)

Posted: 2009-08-02T12:32:08-07:00
by fmw42
you can remove text from an image via morphologic operators in particular the bottom hat.

see the topic at viewtopic.php?p=41498#p41498 for an example.