Wednesday, July 18, 2018

The Watercolorist - New York skyline


Source photograph: a photo of New York's skyline.

I am gonna run "The Cartoonist" to get an abstracted image ("abstracted_image_after_oabf2.png") as well as an edges image ("edges_image.png").


This is the abstracted image after oabf2.


The is the edges image.

I am gonna run "The Watercolorist" using that abstracted image.


Rendered watercolor.

I am now gonna load up the rendered watercolor and the edges image in gimp and use the multiplier mode to combine the 2. This will give me a look of a watercolor where all the lines were first rendered using non water-soluble ink (frequently done for architecture renderings).


Rendered watercolor multiplied by the edges image.

Now, I am gonna play with the saturation and value a bit to jazz up the whole thing.


Final product.

The Watercolorist - Mary Poppins


Source photo: still of "Mary Poppins" featuring Julie Andrews.

Let's get an abstracted image using "The Cartoonist".


Abstracted image after quantize.

Let's run "The Watercolorist" and see what we get.


Watercolor image obtained from the abstracted image after quantize.

Yeah, it 's quite clear that when you use a quantize abstracted image for portraits, the effect can be quite harsh and not very pleasing. Let's see if we can soften the painting by combining it with a watercolor rendering where the input image is not the abstracted image after quantize but the abstracted image after oabf2 ("abstracted_image_after_oabf2.png").


Abstracted image after oabf2.

Let's run "The Watercolorist" and see what we get now.


Watercolor image obtained from the abstracted image after oabf2.

You don't get the edge darkening between shades this time and this rendering doesn't look half bad on its own, to be honest. What I am going to do is load up the 2 paintings as layers and put the 1st painting on top of the other, add an alpha channel to the 1st painting, use the eraser tool on that 1st painting in areas where I think the transitions between colors should be smoother and simulate wet-on-wet watercoloring.


Watercolor rendering resulting from the combination of the 2 previous watercolors.

The Watercolorist - Alpine Renault A110


Source photo: Alpine Renault A110 rallying somewhere in snow covered mounting roads.

The input to "The Watercolorist" is an abstracted image that's produced by "The Cartoonist" (the one obtained after color quantization).


Abstracted image after quantize.

Then, all you have to do is run "The Watercolorist".


Rendered watercolor. Courtesy of "The Watercolorist".

The Watercolorist - Steve McQueen in the movie "Le Mans"


Source photo: still of Steve McQueen in the movie "Le Mans".

To get the abstracted image, I run "The Cartoonist" with the default parameters. The abstracted image after quantize is called "abstracted_image_after_quantize.png".


Abstracted image after quantize.


Rendered watercolor image.

Looks a bit too washed up. That's coming from when we apply the paper texture. An easy fix is to darken the input image to "The Watercolorist", that is, the abstracted image after quantize.


Darkened abstracted image after quantize.


Rendered watercolor image.

Tuesday, July 17, 2018

The Watercolorist - Françoise Hardy in the movie "Grand Prix"


Source photograph: still from the movie "Grand Prix" starring James Garner.

I ran "The Cartoonist" with the default settings to get an abstracted image. That abstracted image is going to be the input to "The Watercolorist".


Abstracted version of the source photograph.

You can play around with parameter "quant_levels" to change the cel shading before watercolorizing it.

Let's run "The Watercolorist" using the default setting. That's our reference.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's change the paper texture beta from -2.0 to -1.0. This will make the paper texture effect less pronounced.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -1
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the paper texture from -2.0 to -3.0. This will make the paper texture effect more pronounced.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -3
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the turbulent flow beta from -4.0 to -2.0. This will make the turbulent flow effect weaker.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -2
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the turbulent flow beta from -4.0 to -6.0. This will make the turbulent flow effect stronger.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -6
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the gradient convolution kernel size (edge darkening) from 5 to 21. This will make the edge darkening effect less steep (more smooth).

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 21
beta (edge_darkening) = -4
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the edge darkening beta from -4.0 to -2.0. This will make the edge darkening effect weaker.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -2
output image = watercolor_image.png

Rendered image:


Let's go back to the default settings and change the edge darkening beta from -4.0 to -6.0. This will make the edge darkening effect stronger.

Input to "The Watercolorist":

image = abstracted_image_after_quantize.png
paper texture = ../texture/free-vector-watercolor-paper-texture.jpg
beta (paper texture) = -2
beta (turbulent flow) = -4
gradient convolution kernel size (edge darkening) = 5
beta (edge_darkening) = -6
output image = watercolor_image.png

Rendered image:


I think it's probably a good idea to soften the edge darkening effect on Miss Hardy's face.

Monday, July 16, 2018

The Cartoonist - Ford GT40 at Le Mans 24 hours race in 1968


Input photograph: Lucien Bianchi/Pedro Rodriguez Ford GT40 number 9 at the 1968 24 hours of Le Mans.

Let's do a base run using the default parameters.

Input to "The Cartoonist":

input rgb image = Le_Mans_1968_1.jpg
tensor_sigma = 3
n_e = 2
n_a = 4
sigma_d = 3
sigma_r = 4.25
fdog_n = 1
fdog_sigma_e = 1
fdog_tau = 0.99
fdog_sigma_m = 3
fdog_phi = 2
phi_q = 3
quant_levels = 8
output rgb image = cartoon_image.jpg

Detected edges:


Resulting rendered image:


Let's change n_e from 2 to 4 and n_a from 4 to 8, which means a lot more bilateral filtering is going to occur.

Input to "The Cartoonist":

input rgb image = Le_Mans_1968_1.jpg
tensor_sigma = 3
n_e = 4
n_a = 8
sigma_d = 3
sigma_r = 4.25
fdog_n = 1
fdog_sigma_e = 1
fdog_tau = 0.99
fdog_sigma_m = 3
fdog_phi = 2
phi_q = 3
quant_levels = 8
output rgb image = cartoon_image.jpg

Detected edges:


Resulting rendered image:


Let's go back to the default settings and change fdog_n from 1 to 2. This should make the edges much more defined.

Input to "The Cartoonist":

input rgb image = Le_Mans_1968_1.jpg
tensor_sigma = 3
n_e = 2
n_a = 4
sigma_d = 3
sigma_r = 4.25
fdog_n = 2
fdog_sigma_e = 1
fdog_tau = 0.99
fdog_sigma_m = 3
fdog_phi = 2
phi_q = 3
quant_levels = 8
output rgb image = cartoon_image.jpg

Detected edges:


Resulting rendered image:


Let's go back to the default setting and change fdog_sigma_e from 1 to 0.5. This should make the edges thinner.

Input to "The Cartoonist":

input rgb image = Le_Mans_1968_1.jpg
tensor_sigma = 3
n_e = 2
n_a = 4
sigma_d = 3
sigma_r = 4.25
fdog_n = 1
fdog_sigma_e = 0.5
fdog_tau = 0.99
fdog_sigma_m = 3
fdog_phi = 2
phi_q = 3
quant_levels = 8
output rgb image = cartoon_image.jpg

Detected edges:


Resulting rendered image:


Personally, I like the rendered image using fdog_n = 2 best, but that's just me.

Friday, July 13, 2018

The Painter - Blade Runner

I am going to use "The Painter" to simulate digital painting. The input photo is from the movie "Blade Runner", the original, of course.


Original photograph we are gonna turn into a digital painting.

Input to the "The Painter":

source rgb image = blade-runner-sean-young-rachael-hd-wallpaper.jpg
brush radius, opacity strength, and bumpity strength = 64 0.5 1.0 32 0.5 1.0 16 0.5 1.0 8 0.5 1.0 4 0.5 1.0 2 0.5 1.0
f_sigma = 0.1
error_threshold = 60
canvas rgb image = canvas_rgb_image.png
canvas bumpity image = canvas_bumpity_image.png

The two values after each brush radius are the opacity strength and the bumpity strength. The bumpity strength is not a factor in digital painting since there is no height associated with the paint. In digital painting, you usually want the colors to blend together so a value of 0.5 for the opacity is chosen (initially). Depending on the size of the input photo, you may want to get rid of the smaller brushes right off the bat. The larger the input photo, the less you want the smaller brushes to be included (unless you dramatically reduce their associated opacity).

Resulting painting:


Painting 1.

I really don't like Deckard's rendering as it is way too coarse. Also, the small paint brushes left smidgens of paint on Rachel's face, which doesn't look good. Let's get rid of the small brushes (radius 4 and 2) and make the rendered painting finer by decreasing error_threshold (from 60.0 to 20.0). Hopefully, we will get a better render of Deckard's face. We'll worry about Rachel later. Note that instead of getting rid of the smaller brushes, I could have decreased their opacity (use an opacity of 0.1 instead of 0.5).

Input to "The Painter":

source rgb image = blade-runner-sean-young-rachael-hd-wallpaper.jpg
brush radius, opacity strength, and bumpity strength = 64 0.5 1.0 32 0.5 1.0 16 0.5 1.0 8 0.5 1.0
f_sigma = 0.1
error_threshold = 20
canvas rgb image = canvas_rgb_image.png
canvas bumpity image = canvas_bumpity_image.png

Resulting painting:


Painting 2.

I like Deckard's rendering but I think Rachel's could be a little bit coarser. Let's raise error_threshold from 20.0 to 30.0 leaving the brushes alone.

Input to "The Painter":

source rgb image = blade-runner-sean-young-rachael-hd-wallpaper.jpg
brush radius, opacity strength, and bumpity strength = 64 0.5 1.0 32 0.5 1.0 16 0.5 1.0 8 0.5 1.0
f_sigma = 0.1
error_threshold = 30
canvas rgb image = canvas_rgb_image.png
canvas bumpity image = canvas_bumpity_image.png

Resulting painting:


Painting 3.

Now, I like Rachel's rendering but I think Deckard's rendering is too coarse. This happens often but there is an easy solution: simply combine the two paintings into one. How do you do that? In Gimp, you load the two paintings as layers, turn on layer transparency (click on "Layer", "Transparency", and "Add Alpha Channel"), erase what you don't like on the top layer with a soft brush, and export the result.

This a combo of painting 2 and painting 3 (I put painting 3 on top of painting 2 and erased Deckard's face to reveal the one underneath):


Combo painting 2 and painting 3.

Just for giggles, this a combo of painting 1 and painting 2 (I put painting 1 on top of painting 2 and erased Deckard's face to reveal the one underneath):


Combo painting 1 and painting 2.

Personally, I like the coarser look on Rachel better (although I should have removed or muted those small brushes) but it's really a matter of taste.

Monday, July 9, 2018

Non Photorealistic Rendering Software - The Watercolorist

"The Watercolorist" is software to watercolorize a photograph. "The Watercolorist" simulates/fakes wet-on-dry watercolor effects. See Non Photorealistic Rendering - Watercolor rendering (watercolorization) for the methodology that's behind it.

When you extract thewatercolorist-x64.rar, you should get something like this:


The directory "barn1024" shows you how to use the software. The "texture" directory contains the watercolor paper textures.

When you go into the directory "barn1024", you should see something like this:


The file called "thewatercoloris.bat" is the one you will double-click to run the software. It tells windows where the executable is. You need to edit the file so that the location of the executable is the correct one for your installation. I use notepad++ to edit text files but I am sure you can use notepad or wordpad with equal success.

The file "thewatercolorist_input.txt" is the input file for the software. It should look like this:

abstracted_image_after_quantize.png
../texture/free-vector-watercolor-paper-texture.jpg
-2.0
-4.0
5
-4.0
watercolor_image.png

Line 1: input image. The input image should be the abstracted image called "abstracted_image_after_quantize.png" that comes from Non Photorealistic Rendering Software - The Cartoonist. You could also use "abstracted_image_after_oabf2.png" for a more wet-on-wet look if you prefer. It's quite possible to use something other than "The Cartoonist" to generate a good abstracted image. As a matter of fact, you should be able to use gimp or photoshop to get it.

Line 2: paper texture. I conveniently placed a few watercolor paper textures in the "texture" directory. You can use those or your own. There should be no spaces in the file name.

Line 3: paper texture beta (here, -2.0)

Line 4: turbulent flow beta (here, -4.0)

Line 5: edge darkening gradient convolution kernel size (here, 5)

Line 6: edge darkening beta (here, -4.0)

Line 7: output image (here, "watercolor_image.png"). There should be no spaces in the image name.

"The Watercolorist" simulates the following watercolor effects: watercolor paper texture (watercolor paint pigments have a tendency to deposit into the cavities of the paper), turbulent flow (in watercolors, there is a low frequency pigment density variation whenever waterlogged paint pigments are deposited on the paper), and edge darkening (paint pigments have a natural tendency to migrate to edges and deposit there in greater numbers). All those watercolor effects are simulated using the same technique: the current color is darkened/lightened according to a grayscale image that's supposed to represent pigment density. The higher the pigment density, the darker the color is going to be as more pigments get deposited onto the paper. The parameter "beta" (there is one for each watercolor effect) is used to scale that grayscale image so that the effect can be amplified/muted. The lower the beta, the more extreme the darkening/lightening will be.

"The Watercolorist" outputs images after each watercolor effect has been applied:
- image_after_paper_texture.png. This is the rendered image after the paper texture watercolor effect has been applied.
- image_after_turbulent_flow.png. This is the rendered image after the turbulent flow watercolor effect has been applied.
- image_after_edge_darkening.png. This is the rendered image after the edge darkening watercolor effect has been applied. It should the same as the output image by the way (here, watercolor_image.png).


image_after_paper_texture.png


image_after_turbulent_flow.png


image_after_edge_darkening.png

"The Watercolorist" is free to download at Painting Software.

Source code: thewatercolorist on github.