This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Is there a high pass filter in krita

Tags: None
(comma "," separated)
canaldin
Registered Member
Posts
42
Karma
0
OS
High pass is very useful filter when it comes to the frequency extraction technique. This technique consists of separating the image into a low pass(blurred image) and a high pass(grey averaged image). When those two passes are combined using linear light blending mode (as photoshop calls it) they produce 99,999% identical image to the original.

Why it is useful? Applying this technique you can treat the texture and tonal content separately, for example to average the skin tones or to smooth the facial texture. In fact it is broadly used in texture creation and digital retouching.

To produce a low pass is easy, just apply a gaussian blur of a known radius.
To produce a high pass you may apply it as a filter using the same radius if there is one. Or you may(in 8bit) subtract the unblured image from the blured one(low pass) with an offset of 2 and scale at 128 which essentially mean that it's averaged on a middle grey.

You may find references to this technique at http://www.theartofretouching.com/blog/ ... d-low-pass

Linear light is a combination of linear dodge and linear burn and has this formula

if (Blend > ½) R = Target + 2x(Blend-½)
if (Blend <= ½) R = Target + 2xBlend - 1


Please let me know how and if this technique currently may be done in Krita.

Thank you

Last edited by canaldin on Mon Apr 16, 2012 10:05 pm, edited 1 time in total.
canaldin
Registered Member
Posts
42
Karma
0
OS
A kind of image produced by high pass filter, you may be familiar with it.

http://www.thesilverartifice.com/tutorials/highpass.jpg

A more detailed example of how it is done in photoshop may be found here:

http://www.youtube.com/watch?v=dMyaeZmkZD8
slangkamp
KDE Developer
Posts
607
Karma
4
The currently is no high pass filter.
User avatar
Animtim
Registered Member
Posts
259
Karma
0
OS
No auto-filter for this, but you can create the High pass layer manually:
-Duplicate it,
-Gaussian Blur 10pix on the duplicate
-Invert
-50%opacity
-Merge down

;)
User avatar
halla
KDE Developer
Posts
5092
Karma
20
OS
Actually, this sounds like a nice junior job for someone who wants to either get started writing a C++ filter for Krita, or maybe learn some OpenGTL and write an OpenGTL filter :-).
canaldin
Registered Member
Posts
42
Karma
0
OS
In fact the math beneath it is fairly simple, it is also broadly documented being a term ported from the signal processing science.

P.S. In photoshop I actually never use the filter but have an action that recreates the manual procedure, it is stated as being more accurate probably because photoshop's filter is some what antique.
canaldin
Registered Member
Posts
42
Karma
0
OS
Animtim wrote:No auto-filter for this, but you can create the High pass layer manually:
-Duplicate it,
-Gaussian Blur 10pix on the duplicate
-Invert
-50%opacity
-Merge down

;)



Very cool works nicely, thanks for the hit

I spotted a problem with the edges of the image, in fact with your technique I managed to recreate almost perfectly the image I was trying to split. But the edges had a weird artifact http://www.pasteall.org/pic/30365 . So I tried to figure out what it was, your technique is correct the problem lies actually in the gaussian blur filter that does not take the edges into consideration. This may be related to the fact that performing the gaussian transform it considers the canvas as to be finite and not extended "infinitely" in order to produce blur in the lateral areas.

It may be actually simpler, I think krita considers the out of canvas areas as to be transparent, that is what produces the artifact. Reference to spot the problem may be found here: http://www.mediafire.com/?pr75s5b3k1aq5dm
slangkamp
KDE Developer
Posts
607
Karma
4
The math behind it isn't that simply, especially if you want good results. We are already using the FFT from fftw3 in the convolution filter and that is already quite tricky.

If you want to implement that, it would of course the welcome and we could help you with the implementation.
canaldin
Registered Member
Posts
42
Karma
0
OS
This problem may be solved quite easily. It would be sufficient to extend the pixels that constitute the border of an image beyond the border for the length specified in the filter in order to produce an adequate result. In simple words every pixel on the border of the image should be considered as a line extending outside at the time the filter is applied, this way back alpha would not bleed inside the canvas.

An example of this may be found here: http://www.mediafire.com/?wg0bve448ow5zjl
canaldin
Registered Member
Posts
42
Karma
0
OS
:) I recently discovered how to rescue nvidia's bug at the startup of ubuntu with no gui OUUUhhH!!!, so to start programming would be kind of an overkill. I'm very pleased to hear that I may ask you for advice in case I would start programming, thank you indeed ;)
slangkamp
KDE Developer
Posts
607
Karma
4
Normally blur should repeat the border. Looks like there is some bug.
canaldin
Registered Member
Posts
42
Karma
0
OS
I think it has been reported here, and apparently solved ???

https://bugs.kde.org/show_bug.cgi?id=245870
slangkamp
KDE Developer
Posts
607
Karma
4
I have reopened it.
canaldin
Registered Member
Posts
42
Karma
0
OS
I just posted there, test file included.

"Hello,

I get the border's black alpha bleeding into the canvas on all sides except the left one.

reference here: http://www.mediafire.com/?vem5vjb7c7yql5v

Thank you

I'm using Krita 2.4 on ubuntu 12.04 on a Lenovo w520 (linux certified) "
canaldin
Registered Member
Posts
42
Karma
0
OS
I spotted an old conversation regarding the problem: http://mail.kde.org/pipermail/kimagesho ... 08016.html

It said that it worked previously (as boudewijn suggested) but them broke down with the new tile engine.

As suggested applying Gaussian via filter layer does the job well, but Krita crashes when trying to merge/apply filter layer.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]