Edge Detection with Core Image

I sat down tonight and did a couple of edge filters, riffing off of a Prewitt and a Sobel style sampling kernel. It's not really that far off from the same kind of logic involved in doing the core image normal map filters (the 2x2 and 3x3's I put together awhile back), but seeing p_g_'s edge filter the other day got me thinking about this more.

I didn't do anything with the Sobel to do color signed gradients or anything fancy; I'm using the same calc as I'm using for the Prewitt type, changing the sampling area to a Sobel style. With the sample file, I'm introducing a threshold/smoothstep pass luminance step first, to help with noise elimination.

(Amount set at 1 and 2, with kernel 2)

With both of these bumping up the "amount" to something more than 1 is going to make the sampling kernels be inaccurate, but give a cool look, like one would expect with dilation or box blur; amount increases the pixel offset amounts. That's the one thing about both of these that's probably a little out of the norm, with both of these, and that someone that wanted to be a stickler could whine about, but I just think it looks cool, so the function is there.

These are implemented using Core Image, which... I don't use as much as GLSL. Hopefully I didn't do anything wacky, but I triple checked the code, the kernels are signed correctly, etc. There are some different methods of doing a sobel (eg., color gradients and such, as I referred to above), so be aware, these are just my interpretations.