Here's a thing I played around with the other night: how do you generate graphics that look like the soft strokes of a water color painting? I started with ListDensityPlot.
img = ListDensityPlot[
Table[Sin[i - .5 + j^2], {i, 0, 3, 0.1}, {j, 0, 3, 0.1}] +
RandomReal[6, {31, 31}], Mesh -> None, PlotRangePadding -> None,
Frame -> None]
ListDensityPlot
has a "softer" feeling than ArrayPlot
.
To give an impression of strokes in the painting I "warp" the density plot with a vector field.
licPlot = LineIntegralConvolutionPlot[{{x + y, x - y}, img
}, {x, 1, 100}, {y, 1, 100}, RasterSize -> 1000,
LineIntegralConvolutionScale -> 30, PlotRangePadding -> None,
PlotRangeClipping -> False, ImageMargins -> 0, ImagePadding -> None,
Frame -> None, PlotRange -> {{1, 100}, {1, 100}},
ImageSize -> {700, 700}]
OK, that looks nice. Let's mirror it.
raw = ImageAssemble[{licPlot, ImageReflect[licPlot, Right -> Left]}]
The new image looks nice, but it's too uniform. My first idea here is to apply some digital tilt-shift photography effects, see demonstration http://demonstrations.wolfram.com/DigitalTiltShiftPhotography/ This gives the impression that some parts are more emphasized than others.
newmask =
ImageResize[ImageRotate[mask, 3 \[Pi]/2], ImageDimensions[raw]];
composed = ImageCompose[raw, SetAlphaChannel[Blur[raw, 14], newmask]]
To make it even less uniform I apply an ImageTransformation
, and remove the border.
f[x_, y_] := {x + 5 Sin[.05 x], y + 7 Sin[.1 y]}
transformed =
ImageTransformation[composed, f @@ # &, DataRange -> Full];
ImageTake[transformed, {5, -1}, {1, -5}]
There we go!
What's next? How about creating an APIFunction
that generates you a new "random" picture every day with a random PlotTheme
and then set your smartphone's wallpaper to it?
As a bonus, I tried to expand the image using Inpainting:
dims = ImageDimensions[clipped];
clippedPadded = ImageCrop[clipped, 2*dims, Padding -> White];
mask = ImageCrop[ConstantImage[Black, dims], 2*dims, Padding -> White];
Grid[{{clippedPadded, mask}}, Frame -> All]
HighlightImage[
Inpaint[clippedPadded, mask, Method -> "TextureSynthesis"],
Dilation[MorphologicalPerimeter[mask], 5], "HighlightColor" -> Brown,
Method -> "Solid"]
Read more about inpainting in this blog: Extending Van Goghs Starry Night with Inpainting