Laplace shader?

hi !
in my research for shadering videos, i was wondering if anybody has created an adaption of the Laplace edge algorithm in pixelshader language ?

I had a look to Gimp sources, but really its too much difficult for me…
Sobel shader is good but let a lot of noise in the image. I was wondering about a graphical filter giving birth to lines more elegantely… or other approaches i didn t know…

anybody could help on this topic ? yours

Hi Karistouf,

According to this website Sobel gives better results than Laplace.

QUOTE: “However there is a simpler approach that you can use for edge detection. It tends to result in slightly less optimal results, but it only uses one filter (so you skip the addition phase also). This approach is referred to as Laplace.”

I have used Sobel (not realtime) before and was very happy with the results.

Maybe you should denoise your source material first?

hi FT, many thanks.
cleaning my image is more a problem of compressed image in MPEG4 ( IP CAMERA) than a real noise trouble. sorry not to have been previse.

unfotunately i m only a C guy and not C SHARP, and shaders with matrix are beyon of any of capacities… but i will have a closer look at :

SobelEdgeDetection.fx in the girlpower folder does exactly this.
Don’t let the matrices scare you, it just means you also use the values of the surrounding pixels to calculate the new value of the current pixel.

Here’s 2 other matrices that you could try out, that are very similar to Sobel. I have used them a few years ago, when I was kind of ‘reinventing’ Sobel’s algorhythm :)

0 -2  0
-2  0  2
 0  2  0

 0  2  0
 2  0 -2
 0 -2  0

This basically means, the current pixel is replaced by:
(-2 times the pixel to the left) + (-2 times the pixel above) + (2 times the pixel to the right) + (-2 times the pixel below)

  • <<>>


There’s an alternative to sobel edge.
This is Nvidia’s scene line draw.fx
Not finished…need to declare textures to get coordinates.

If anyone has time, me don’t.

edit : this won’t work for videos. Only for vvvv’s generated scenes. (16.7 kB)

merci ft. i will look inside of it. you just express it perfectly clear ;-)

merci desaxismundi, helas this shader is 3d based and not pixel based :-(