[Kde-graphics-devel] Sobel edge detection

Mosfet dan.duley at verizon.net
Sun Dec 19 04:04:13 CET 2004


Edge detection may not sound too important unless your dealing with computer 
vision,  but it can be used in other filters like charcoal and is the basis 
for the image comparision algorithm that findimagedupes originated. So I 
wanted to speed it up.

I decided on to Sobel algorithm.  This is a gradient method that applies two 
3x3 matrixes then sums their absolute value. It's a quick integer-only 
algorithm. In contrast the convolve() based edge detect we do now is based on 
a 5x5 floating point matrix. So we end up with 18 integer operations vs 25 
floating point ones. Since it's only a 3x3 matrix I was also able to unroll 
the loop processing the pixel neighbors on a scanline.

I coded this last night and today and added inline MMX, (only normal MMX is 
needed - the convolve() method uses 3dnow! because it's floating point). So 
it should be pretty speedy.

This will be the default edge detect in my code. It will be in my next tarball 
or you can email me if your interested and want an early copy.


More information about the Kde-graphics-devel mailing list