Photo to cartoon script

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?".
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Photo to cartoon script

Post by anthony »

What you really want is spatial segmentation. Which divides images into areas of similar color and textures.

Unfortunately this is not something IM is currently very good at. At least not yet.


For example
http://people.cs.uchicago.edu/~pff/segment/
http://civs.ucla.edu/Segmentation/Segment.htm

Each areas can then be represented by a 'average color' for that segement, to produce a very cartoon like image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Photo to cartoon script

Post by fmw42 »

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

Re: Photo to cartoon script

Post by fmw42 »

Note that http://www.caip.rutgers.edu/~comanici/segm_images.html has C++ code available and uses the Mean Shift Algorithm that seems to be a standard these days for segmentation. If the licensing permits, someone may want to incorporate this code into IM.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Photo to cartoon script

Post by anthony »

One point -- you want spatial and texture separation, not color segmentation. Thay are related by two different things.

The former divides images into regions of similar attributes. The latter only divides the colors of the images into similar colors.

The color technique is implemented in -segment whos arguments involve number of pixels involved in each color, rather than the total number of colors.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Photo to cartoon script

Post by fmw42 »

The mean shift technique includes both spatial and color distances in its approach. Also. the paper I mentioned above allows merging of small regions into larger ones, thus providing another spatial aspect. Also I have seen papers (PDF) that include an additional spatial modification as well as color approach using the mean shift technique.
johnymac

Re: Photo to cartoon script

Post by johnymac »

Sorry about slow response to this, shelved the project for a few weeks.

I wrote some more about it here:

http://www.mclear.co.uk/2009/06/how-to- ... -turn.html

I'm still not happy w/ the results I'm getting though :/
leonorax

Re: Photo to cartoon script

Post by leonorax »

How do I stop seeing cartoon face everywhere? Okay, this is weird. I keep seeing cartoon faces everywhere, even on my body. Whenever, I close my eyes or put my hand over it, it just randomly changes. How do I stop doing that?
___________
market samurai ~ marketsamurai ~ marketsamurai.com
Last edited by leonorax on 2009-08-21T04:36:52-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Photo to cartoon script

Post by anthony »

leonorax wrote:How do I stop seeing cartoon face everywhere? Okay, this is weird. I keep seeing cartoon faces everywhere, even on my body. Whenever, I close my eyes or put my hand over it, it just randomly changes. How do I stop doing that?
I think you may need to get a new interest!


As for the original cartoon face problem. I am now thinking about it in a new way.

What is needed is some way to divide the image up into specific segments which are typically seperated by strong edges.

Each segment would then get a single average color, and then a black 'edge' is overlayed.

The separation into segments is the tricky part, but can be helped by the 'edge' detection as well.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Photo to cartoon script

Post by fmw42 »

Anybody try this free software on the problem?

http://www.caip.rutgers.edu/~comanici/segm_images.html

I believe it uses the mean shift concept. http://en.wikipedia.org/wiki/Mean_shift
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Photo to cartoon script

Post by fmw42 »

Playing around with the color segmentation via the mean shift algorithm in ImageJ for cartooning. See http://rsb.info.nih.gov/ij/plugins/mean-shift.html

original
Image

mean shift
Image

original
Image

mean shift
Image

original
Image

mean shift
Image
johnymac

Re: Photo to cartoon script

Post by johnymac »

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

Re: Photo to cartoon script

Post by fmw42 »

johnymac wrote:<-- orig
What is the point of your post? There is no question and you are not showing any cartooning? Am I missing something?
festr

Re: Photo to cartoon script

Post by festr »

Hi, I've been searching for good color segmentation algorithms and noone does not sutisfied me except of http://www.caip.rutgers.edu/~comanici/segm_images.html.

I've created google code mirror to that program and modified it a little bit to allow compile on Linux and fix some bugfixes (segmentation faults). Checkout http://code.google.com/p/colorsegmenter/

There is compiled binary segm which should run on any linux with libstdc++.so.6 and it needs convert program installed.

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

Re: Photo to cartoon script

Post by fmw42 »

Hi, I've been searching for good color segmentation algorithms and noone does not sutisfied me except of http://www.caip.rutgers.edu/~comanici/segm_images.html.
Yes, I have been pushing for that open source code as well.

Have you integrated this code for use with IM? If so, post it or send it to Magick
festr

Re: Photo to cartoon script

Post by festr »

No, I didnt integrate it with IM, I'm using it on command line. Anyway the licence of this program is only for educational and research. Commercial use has to be approved by authors.

Anyway, checkout my google code page for the sourcecode or binary.
Post Reply