Have I opened a can of worms? :-D
The basic theory behind edge detection is that you are looking for a substantial change in color as you move from one pixel to the next, and to link these changes together. Think of it as trying to draw an outline of the image, much as you would have in coloring book, before the image is colored. You trying to define the edges, or the various shapes that make up the image.
What defines "substantial" is subjective and I would suggest that it be a parameter because if you too fine, you get too many edges to be useful, and if not fine enough, then you won't get enough edges.
Due to the proprietary nature of the code, I cannot post any of it, but to get started, try to implement the following algorithm.
Firstly, convert the image to a BMP format where you can address each pixel individually. Get the dimenstions of the image, then
for each line of the image
read the first byte
split into individual RGB components
set to current R,G, and B values
for the rest of the pixels on that line
read that pixel
split into RGB components
compare to the current color values
if any color change > some threshhold
write black pixel to file
else
write white pixel to fil
end if
loop
loop
Trying to give you a general idea of a faily simple approach. You'll need to tweek your threshhold value to get the fineness of your detected edges, but what you should end up with is a black/white representative image.
Once your satisfied with that, then you can move onto the next stage of comparing the two B/W shape representations.
Now, there are more sophistocated edge detection filters, but they (at least the couple that I'm somewhat familiar with) require calculus, specifically finding the min and max value of the 1st derivative, or dealing with 2nd derivative gradiants, and if you need to go in this direction, we'll deal with that later on.
Its also quite possible that you might be able to find the source code for an edge filter by doing a google search. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein