Laplacian Pyramid Filter request

(Lyle Kroll) #1

Racer-x posted an example that uses this preset. Just curious if anyone could implement such a filter in G’MIC. You can sort of get a similar effect with tone mapping preset but the tone mapping preset can leave boundary artifacts in the upper left part of the image (well complete boundary but most emphasis in the upper left; I usually just grow/heal the frame used the crop out the boundary; what a pain). Even so, the gives the Wyeth result that I like to render from time to time. :slight_smile:


@lylejk You might be interested in this. If you are feeling adventurous, you can apply the same methods in G’MIC. :wink: Pyramids are used for all sorts of things.

(Lyle Kroll) #3

Cool stuff, afre; I actually had Imagemagick installed at one time (but that was two builds ago). :slight_smile:


I have just added ‘pyramid processing’ to my testing folder.

It does local normalisation on each level of a Laplacian pyramid which can give a tone mapped type result.

(Lyle Kroll) #5

Thanks Iain; I didn’t really have a great image to test it on, but your preset worked. I wonder how would you coax more drama (no noise) like the version does though. :slight_smile:


I’m sure it would be possible. I suspect that giving different weights to each pyramid level would be a start.


Iain, your ‘Pyramid processing’ filter is very nice, thank you for this filter.

It can be used for color correcting. But then the filter must have the possibility to choose color spaces/channels.

For color correcting; a low noise value and a higher mix value (higher than is possible now), is required. With RGB [all], the results are fine.

I used the next code:

#@gui Pyramid processing2 : iain_pyramid_processing2,iain_pyramid_processing2(0)
#@gui : 1 levels = int(4,1,6)
#@gui : 2 noise = float(50,1,100)
#@gui : 3 mix = float(.5,0,3)
#@gui : sep = separator(), Channel(s) = choice(2,"All","RGBA [all]","RGB [all]","RGB [red]","RGB [green]","RGB [blue]","RGBA [alpha]","Linear RGB [all]","Linear RGB [red]","Linear RGB [green]","Linear RGB [blue]","YCbCr [luminance]","YCbCr [blue-red chrominances]","YCbCr [blue chrominance]","YCbCr [red chrominance]","YCbCr [green chrominance]","Lab [lightness]","Lab [ab-chrominances]","Lab [a-chrominance]","Lab [b-chrominance]","Lch [ch-chrominances]","Lch [c-chrominance]","Lch [h-chrominance]","HSV [hue]","HSV [saturation]","HSV [value]","HSI [intensity]","HSL [lightness]","CMYK [cyan]","CMYK [magenta]","CMYK [yellow]","CMYK [key]","YIQ [luma]","YIQ [chromas]")
#@gui : note = note("<small>Author : <i>Iain Fergusson</i>. 14 June 2017 - First release</small>")
-repeat $! -l[$>]
-ac "
#-resize {w+($size-w%$size)},{h+($size-h%$size)},{d},{s},0,1,0.5,0.5
-resize {w+($size-w%$size)},{h+($size-h%$size)},{d},{s},0,1
-repeat $levels
--resize[0] 33.33333%,33.33333%,{d},{s},2
-blur[-1] 1
-repeat {$!-1}
-dilate[-1] $dilate
-blur[-1] $blur
-max[-1] 0.00000000000000001
--fill[-1] $max
-div[-1] [-2]
-cut[-1] -1000000000,$noise
-repeat {$!-1}
-blur[-1] 1
-crop 0,0,{$cropwidth-1},{$cropheight-1}
-replace_nan 0
-replace_inf 255
-n 0,255
-mul[0] {1-$mix}
-mul[1] $mix
-c 0,255
-endl -done


That’s interesting because a ‘mix’ greater than one means you are subtracting the original image from the pyramid details. I guess would make a colour cast disappear.