How would you go about separating elements from their background?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
coloring
Posts: 69
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

How would you go about separating elements from their background?

Post by coloring » 2019-01-09T14:16:17-07:00

I would like to separate "islands" (icons) from a "sea" (background). The difficulty is that the background can have more than one color depending on the area.

In other words, I need to make "islands of content" stand out from the "background sea".

I suppose the technique would be somewhat similar to how scanned documents are post-processed to whiten the page and darken the fonts.

The idea is to later quickly determine the coordinates of those "islands" by scanning for a single color.

I cannot upload any images right now, but I may do so later on when I get better internet.

snibgo
Posts: 11095
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How would you go about separating elements from their background?

Post by snibgo » 2019-01-09T16:15:14-07:00

coloring wrote:I suppose the technique would be somewhat similar to how scanned documents are post-processed to whiten the page and darken the fonts.
Yeah, maybe.

The trick is to define what visually distinguishes foreground and background.

For more specific advice, you know what to do.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 24334
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How would you go about separating elements from their background?

Post by fmw42 » 2019-01-09T17:38:53-07:00

Background foreground separation can be very hard unless the background is a relatively constant color.

User avatar
anthony
Posts: 8875
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How would you go about separating elements from their background?

Post by anthony » 2019-01-14T22:21:22-07:00

Also how 'fuzzy' and 'shaped' the border is between background and foreground. For example rotated square images? Or other odd shapes.
What other 'junk' is on the page... Text?

It is all a matter of defining what is foreground and background in a way the computer can understand.
The trouble with computers, of course,
is that they're very sophisticated idiots. -- Doctor Who, "Robot"
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply