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?
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}]
MeanShiftFilter
to get you started. $\endgroup$