I wrote some perl code which uses the Sobel scheme to detect edges in an image. here is the source code. Be forewarned: it only inputs and outputs images which are in the "PNM" format. It is easy to convert in and out of this format using the GIMP. (Make sure you choose the ASCII version, not the raw)
Run the program as follows:
./sobel.pl input-file output-file
Here are some demos:






