Laplacian Pyramid Filter request

Racer-x posted an example that uses this Paint.net 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:

http://gimpchat.com/viewtopic.php?f=11&t=15335&p=216780#p216777

@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.

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.

4 Likes

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 paint.net 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>")
iain_pyramid_processing2:
-repeat $! -l[$>]
-remove_opacity
-ac "
--l
dilate=1
blur=1
mix=$3
noise=$2
levels=$1
size={3^$levels}
cropwidth={w}
cropheight={h}
#-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
-l[-1]
--resize[0] 33.33333%,33.33333%,{d},{s},2
--iain_resize_x3[-1]
-blur[-1] 1
-sub[0,-1]
-endl
-done
-repeat {$!-1}
-l[{$>}]
--abs
max={iM}
-dilate[-1] $dilate
-blur[-1] $blur
-max[-1] 0.00000000000000001
--fill[-1] $max
-div[-1] [-2]
-cut[-1] -1000000000,$noise
-mul[0,-1]
-k[0]
-endl
-done
-to_rgb
-repeat {$!-1}
-iain_resize_x3[-1]
-blur[-1] 1
-add[-1,-2]
-done
-crop 0,0,{$cropwidth-1},{$cropheight-1}
-replace_nan 0
-replace_inf 255
-n 0,255
-endl
-mul[0] {1-$mix}
-mul[1] $mix
-add
-c 0,255
",$4
-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.