Page 1 of 1

Mapping Central color to areas covered by edges

Posted: 2017-08-01T13:34:00-07:00
by aigo
Hi Everyone,

I am working on some images and would like to create an effect using an edge representation/skeleton of an image based on un-similar (unique) colours in the original image.

After which I will like to superimpose this edge mask on the original image and color the individual areas, one color (as dictated by the average/central of the colors present) per area.

I would appreciate any point in the right direction.

Cheers!

Aigo.

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-01T13:36:35-07:00
by aigo
My IM version is 7.0.6-0 Q16 X86_64

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-01T14:55:02-07:00
by snibgo
Edges and skeletons are two different effects.

Sample inputs and outputs might help us understand what you want.

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-01T15:45:27-07:00
by aigo
Hi,

my bad.

what I aim to achieve is a skeleton-like mask of an image derived from the distribution of colours which can be used to create a representation of the original image but with one colour, for each area. Akin to the technique used in creating in cartoons I guess, where whole sections of an image is represented with a single colour.

Thanks!

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-01T16:17:28-07:00
by snibgo
That seems similar to:
Flat-colour cartoons
Partition boundary masks
Cartoon and texture
But perhaps not exactly the same?

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-01T18:21:02-07:00
by fmw42
You have not said what OS you are using. If on Unix-like systems, see my kmeans script at the link below. Also for any OS, see IM -mean-shift. Examples of the latter are at viewtopic.php?f=4&t=25504

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-03T09:21:39-07:00
by aigo
fmw42 wrote: 2017-08-01T18:21:02-07:00 You have not said what OS you are using. If on Unix-like systems, see my kmeans script at the link below. Also for any OS, see IM -mean-shift. Examples of the latter are at viewtopic.php?f=4&t=25504
Yeah I am on UNIX, and both the k-means and mean-shift helped me with the investigation.
And just as is mentioned on the site, they are quite slow for obvious reasons.

Thanks!

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-03T09:26:23-07:00
by aigo
snibgo wrote: 2017-08-01T16:17:28-07:00 That seems similar to:
Flat-colour cartoons
Partition boundary masks
Cartoon and texture
But perhaps not exactly the same?
Yeah, the partition boundary masks are exactly what I am looking for.
Sadly, for a newbie to IM like myself the tutorials are not easy to follow plus they are bat files.

Is there an equivalent tutorial but for Unix Systems?
Or an inbuilt function in IM that can help me with this, I don't want to do much. Just have a decent boundary mask that I can superimpose on the original image to trace.

Thank you for you help so far.

Best!

Aigo.

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-03T10:19:04-07:00
by fmw42
Perhaps you can provide an example input image. You can post to some free hosting service such as dropbox.com and put your URL here.

Please always provide your IM version and platform when asking questions, since syntax may vary.

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-04T03:40:59-07:00
by aigo
Hi there.

Sorry about that.

Here's the sample image https://drive.google.com/file/d/0B3sq7o ... sp=sharing
IM version is 7.0.6-0, Mac-OS Sierra

Thanks!

Aigo

Re: Mapping Central color to areas covered by edges

Posted: 2017-08-04T09:26:39-07:00
by fmw42

Code: Select all

convert faces.png -canny 0x1+10%+30% faces_canny.png
Image

Or perhaps a combination of kmeans and canny edges.

Code: Select all

kmeans -n 10 -m 10 faces.png tmp.png
convert tmp.png \( +clone -canny 0x1+10%+30% -negate \)  -compose multiply -composite faces_kmeans_canny.png
Image


Or

Code: Select all

kmeans -n 10 -m 10 faces.png tmp.png
convert tmp.png \( +clone -canny 0x1+5%+10% -negate \)  -compose multiply -composite faces_kmeans_canny2.png
Image