# How to generate a cartoon of a face

I want to use Mathematica to generate a cartoon of a face. For example, some thing like this: I think it can be done using Mathematica, but I really don't know how to do it. How can it be done, and what kind of a cartoon can Mathematica generate?

• Have a look at MeanShiftFilter to get you started. Sep 23, 2014 at 6:41
• Havw a look at Michael Trott's post on the Wolfram Blog. Sep 23, 2014 at 11:09
• Also, note that Mathematica won't zip up the guy's hoodie for you. The pictures don't match. Sep 23, 2014 at 11:45
• @Verbeia I know that. what I am looking at is the face only. Sep 23, 2014 at 13:28
• stat.ucla.edu/~mtzhao/research/nprbookchapter/… Jan 9, 2018 at 18:53

Here is an idea based on MeanShiftFilter:

start = ImageCrop[ExampleData[{"TestImage", "Girl3"}], 200, Left];
step1 = MeanShiftFilter[start, 3, 0.05, MaxIterations -> 10] step2 = Binarize[ColorNegate[DerivativeFilter[step1, {0, 1}]], 0.95] ImageMultiply[step1, step2] Obviously you can play with filters to get a different outline effect. Here is a quick Manipulate:

Manipulate[
With[{colorversion =
MeanShiftFilter[start, ms1, ms2, MaxIterations -> 10]},
ImageMultiply[colorversion,
ImageMultiply[
Binarize[ColorNegate[DerivativeFilter[colorversion, {0, 1}]], v1],
Binarize[ColorNegate[DerivativeFilter[colorversion, {1, 0}]],
h1]]] ], {ms1, 1, 6, 1}, {ms2, 0.01, 0.1}, {v1, 0.8, 0.999}, {h1, 0.8, 0.999}] 