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:



1 comment: