Creating flat-texture cartoonish images with total variation denoising

Total variation denoising can be used to produce cartoonish images; that is, piecewise-constant images, as demonstrated. The more we increase the weight, the flatter the textures (at the expense of fidelity to the input image):

image = io.imread('../images/me18.jpg')pylab.figure(figsize=(10,14))pylab.subplot(221), pylab.imshow(image), pylab.axis('off'), pylab.title('original', size=20)denoised_img = denoise_tv_chambolle(image, weight=0.1, multichannel=True)pylab.subplot(222), pylab.imshow(denoised_img), pylab.axis('off'), pylab.title('TVD (wt=0.1)', size=20)denoised_img = denoise_tv_chambolle(image, weight=0.2, multichannel=True)pylab.subplot(223), pylab.imshow(denoised_img), ...

Get Hands-On Image Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.