Faster "Gaussian" Blur and Pyramidal Sharpening

I have still trouble to feel at ease with KDE4 development, and fill the need to develop against a stable environment, so from time to time I do go back to Krita 1.6 and play with it and fill again my energy bar which I can then spend on Krita2. So last week I did wrote two filters (and I am still working on two others).

Faster Gaussian Blur

Bluring has always been one of the slowest operation in Krita (especially compared to what competitors do), mostly because of my laziness and, also, because for some reason the convolution code in Krita refused to work with non-square kernel (for absolutely no good reason). So, when I wrote the filter, I wrote it as a one pass filter, with one huge kernel, which means that for a bluring of 10 pixels radius, Krita was making 441 memory access and mathematical operations, while with a two pass blur filter, only 42 memory access and mathematical operations are needed, thus reducing the cost by a factor of ten, and the needed computation time as well.

But still we can do better, in fact, I have noticed that the second pass is twice as slow as the first one, which is probably due to fact that the convolution code is optimized for working with scanning line horizontally, while the second pass scan lines vertically.

Pyramidal Sharpening

The pictures made by most of camera isn’t always of the best quality, and they especially often lack of sharpness. It can happen for various reasons, ranging from bad lens, to bad sensors or to bad focus. So, one of the basic feature in picture editing is to increase the sharpness of an image. There are quiet a few techniques for doing this, until recently Krita only included what I call the “classical sharp” (it’s the simplest way of sharpening, it’s a convolution mask, very similar to bluring) and “unsharp mask” (the wikipedia entry describes it better than I will ever be able to). I have started playing with an article which proposed to use a pyramid representation of an image to increase its sharpness.

While the “classical sharp” is clearly the worse of all, it’s quiet unclear to determine which of the other two algorithms give the best results, and it also might depends of the parameters used for each one.

This entry was posted in Krita, Open Source and tagged , , , . Bookmark the permalink.

3 Responses to Faster "Gaussian" Blur and Pyramidal Sharpening

  1. Ants Aasma says:

    Regarding sharpening, have you seen the SIGGRAPH 2006 paper about < HREF="" REL="nofollow">removing camera shake<>?

  2. Pooh22 says:

    Is something wrong with the second (pyramidal sharpening png) image?I clicked on it in akregator and gwenview showed the picture for about 1/5th while downloading and then blanked out… (using kde 3.5.7 on feisty)

  3. Cyrille Berger says:

    @pooh22 : I have no idea, I am still using kde 3.5.6 and have no problem.@ants aasma : the problem of this paper is that is panted and they limit it to non-commercial use (which makes it impossible to ship in most distributions, so until Krita gets an easy way to install new plugins, it’s unlikely I will invest much time on it), and as they admit it on their website it’s not yet fully functionnal

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>