Saturday, December 17, 2011

Matching image colors with Texturewerke

In the last post I demonstrated how to use TextureWerke for masked polynome high-pass filtering. In addition to that, TextureWerke 0.1 has another feature - matching colors between two (masked) images.

Workflow

Let's start with two images of stone wall we want to merge into one texture:

First image - a plain wall

Second image - a corner made of bricks

As you can see (among other things) the images have a bit different colors - the first one has more contrast and red. The bright background of the second picture influenced camera color adjustment logic so that the wall is more gray and has less contrast.
We will correct this automatically. First we move both photos to the same image (not necessary, but easier to compare) and add masks. We mask out all details that we do not want to influence final color - i.e. roof, shaded areas, brick structures, grass and background.

Masked images on top to each other.

Next we select the masked layer whose colors we want to change (Layer 2), invoke TextureWerke and choose color matching mode.

TextureWerke dialog window in color mode

Template is the (masked) layer whose color profile we want to emulate in selected layer.
Blurring reduces the noisiness of distribution curves and thus helps to overcome artefacts resulting from different sharpness of images. On the other hand it may mask out certain differences in color distribution and thus reduce the matching quality. You can always try and use what gives the best results.
And at last we apply the filter.

Image with adjusted colors

As you can see, the overall color and contrast of the (stone part of) wall matches with template image. On the other hand the areas that were masked out (bricks, backround...) are now completely off. But probably we did not want to use these anyways - except bricks maybe - but these can easily be copied and pasted from the original, and adjusted separately.

FYI: Internally the algorithm works by comparing pairwise the cumulative distributions of each image channel (R,G,B,A) and building a transfer function that translates the values with one distribution to the values with another (template) distribution.

And that's all. Have fun!

5 comments:

  1. Hi,
    I've installed textureworke with

    make
    make install

    but I can't find it under any gimp menus - have I missed something?

    thanks for any help
    Tim

    ReplyDelete
  2. Hello!

    It should appear under Filters->Map
    The only thing "make install" does is to copy the binary to the .gimp/plugins in you home directory. You may verify that it is indeed copied, or alternately try to copu it into system-wide GIMP plugins directory.
    If it still does not work, chances are, that it crashes during plugin registering for some reason...

    Best wishes,
    Lauris Kaplinski

    ReplyDelete
  3. The most vital thing learning gives you are a skill to know life and your point in the world more kindly. You learn how to wait for, evade and put off sure events. You learn to see the involved fibers of the world more clearly. The attained knowledge and skills help you lead a more kind life with others, but yourself, as well. This should allow you with skills and talents one needs to become a happy person in control of his/her ego (advice vs. reason) and actions. The downside to learning and having knowledge is that you begin to see its lack in others more clearly, which begins bothering you as, for most people, “ignorance is bliss” (not always by their own fault). The more you know about the world and our the past as a species, the more sad you become, since you see the everlasting foolishness and ignore in human actions, which always without doubt leads to recurring handling by those with power over the weak and unskillful. It is a vicious cycle, seen too many times. People driven by greed, power, destructiveness and not public issues trying to rise above all others (wars, genocide, political control), crushing their victims during the rampage. The worst thing is that there are some entire values, truths and lessons too many generations throughout history have learned the hardest way, which remain hidden to those inexpert. Teaching smooths the progress of learning those truths, which helps put off handling. That is why teachers and thinkers (the great storytellers) are always oppressed, marginalized and controlled by those in power. Learning sets you free, set frees your mind. It is both a blessing, as much as a curse. One could say, it is like the Matrix- you become aware that we all are just sets.

    ReplyDelete
  4. Dentistry Research Paper Writing Services have come up with Dentistry Writing Services for dentistry coursework writing service students in order for them to score straight A’s in their dentistry paper writing services.

    ReplyDelete