Wednesday, February 16, 2011

Open Source Methods To Transform A Photograph Into An Underdrawing

As promised, set forth below are the procedures for how to transform a photograph into an underdrawing using free, open source software.

No single software package will perform all of these steps, so you will have to download and install several different programs to perform each of these steps. For the purposes of clarity, I first will present several end results, then will tell you what steps to take and why. If any of these steps call for special software, I will link you to where you can get it.

Results:


A portrait:

Beginning with this photograph:


I achieved this result with open source tools:


As opposed to this result with Photoshop CS5:


A building:

Beginning with this photograph of the Parthenon:


I achieved this result with open source tools:


as opposed this this with Photoshop:


Why We Are Taking These Steps:


Basically, we are trying to make our photographs as sharp as possible. By so doing, we are bringing the greatest possible definition into them, we are highlighting the borders. These borders constitute the residual lines, which are all we are interested in for achieving an underdrawing.

Then we strip away as much of the rest of the photograph as we can. We get rid of the colors by desaturating. We radically simplify matters with the Threshold command. Absolutely all the steps we take, all the hoops we jump through, are nothing more than efforts to soup up the image, to obtain as much definition as possible, so as to give the Threshold command the maximum punch.

One of the best ways to soup up our image is with a technology known as tone mapping. While open source tone mapping tools exist; GIMP itself lacks tone mapping. Much of the complexity of the following discussion results from steps necessary to shuttle back and forth between GIMP and the tone mapping program.

There is nothing sacred or formulaic about these procedures. I am actually already experimenting with another possible method, and each photograph is unique. These steps are simply a means to an end which I have found to be generally satisfactory.

Finally, as part of my sharpening procedure, I have been using a high-pass filter. However, the tone mapping software I am now using also has something similar, called an unsharp mask. Apparently for this reason, applying the high pass filter with GIMP can be problematic. Sometimes - but not always - it fails to help or even hurts the result. So you just have to give it a try and, if you don't like the result, undo the filter, and then apply the Threshold command without it.

The Procedure:


  1. I began with an underexposed RAW format photo of a pond that looked like this:




  2. Convert to JPEG and correct image. Our tone mapping utility cannot process RAW files, so you have to convert it to JPEG. If your image already is JPEG, you can skip this step. Often, however, your photos will be in RAW format and cannot readily otherwise be converted.

    I imported this image into UFRaw, an open source raw correction utility comparable to Adobe's Camera Raw.

    This allowed me to boost the images exposure, which was helpful.

    More importantly, it enabled me to convert the image to JPEG, which is vital. UFRaw can be installed as a GIMP plug-in. On the lower right corner of the program is a button marked with a GIMP icon. Click that to load your RAW file into GIMP. Then, in GIMP, click "File/Save As..." to save the image in JPEG format. I obtained this result:


    To download install UFRaw, click heer. For its User Guide, click here.
  3. Apply tone mapping. I imported this JPEG into LDR Tonemapping.

    I have found this program to be simpler and more reliable than Luminance / qtpfsgui ( which you nevertheless can still use so long as, in the previous step, you convert your image to TIFF rather than to JPEG. ).

    After trying to make the image as sharp as possible, I obtained the following:



    To download LDR Tonemapping, click here

  4. Import into GIMP and desaturate.. I re-imported the image back into GIMP and converted to greyscale by clicking "Colors/Desaturate..." for the following:


  5. Run the high pass filter. While GIMP itself lacks a high pass filter, you can download and install a plugin that will do that. After installing, you can click "Filters/Generic/High Pass Filter" to get it.

    Because this filter has no preview, you are shooting in the dark while applying settings. Shove the sliders back and forth to obtain various settings, which you can undo with "Edit/Undo High Pass Filter." You are attempting to make the image look more like an etching. After several attempts, choose the settings that come closest to that.

    This is what I got:


  6. Apply the Threshold CommandAfter applying the "Colors/Threshold..." command I obtained this final result:

Concluding Comments

As I noted, the high pass filter can be problematic. Omitting it entirely yielded this:



Experiment with these tools. Here are two other results I have obtained:



Saturday, February 5, 2011

The Fall of Icarus

Pieter Bruegel's Landscape with the Fall of Icarus provides us with a clue for how to go about obtaining images which, after we have converted them into underdrawings, we can thereupon paint.

We want to avoid composed, contrived settings. Sharp, well composed and focused photos are just fine as is. Why transform those into paintings? But setting up a good photo is a left brain enterprise. We are painters and - while we do use cameras to capture our image - our purpose is to draw upon if not necessarily to draw on the right side of the brain. To uncover the out of focus image that we glimpse out of the corner of our eye.

So how do we do this with a camera?

Landscape with the Fall of Icarus portrays a fine Flemish landscape:


But the real subject is Icarus' fall,  tucked away in the lower right:


We go around with the left side of our brains seeking fine Flemish landscapes to photograph. Only later do we notice that "Hey! I've got a shot of Icarus falling here." And that's what we want to paint.

For example, here we have an underexposed, poorly arranged, tilted photograph:


Certainly this is an unpromising photo. But this young lady is its Icarus:


And here is her photo converted to an underdrawing:


This means, generally speaking, you want a camera with a wide angle lens, a deep depth of field, and shutter speed fast enough to prevent blurring. This will enable you to capture as much imagery as possible. You will decide - or, rather, you will discover - what actually to display later. As for the artistic effects and visual impacts - that is what painting is for.

Tuesday, February 1, 2011

An Open Source Alternative

Following Meg's suggestion, I have explored open source alternative approaches to converting a photograph into an underdrawing.

In addition to the Gimp, I used an open source HDR prgram, Qtpfsgui.

These are simply the results. I will publish detailed procedures later.

Open Source:


Photoshop:



After being imported into Painter and further adjusted, here's how they compare

Open Source:


Photoshop:


Remember, the particular differences between the two photos here probably suggest nothing about the inherent properties of the two approaches. Do not conclude that the Open Source would always be more robust or the Photoshop more refined. Both programs could be adjusted to produce differing results; and this is the first time I have ever attempted to transform via the Open Source approach. Rather, focus on the similarities between the and the feasibility of the Open Source option. Here's another, lighter Open Source version obtained by adjusting a few controls: