It is somewhat difficult to debug your example without installing the mathvisiontools package. However, since you mention edge detection, you may wan to explore the many image processing functions that are part of Mathematica. For example:
http://reference.wolfram.com/mathematica/ref/EdgeDetect.html
And part of your example might go like this:
image = Image[
Table[If[x^2 + y^2 < 7000, 100, 0], {x, -128, 127}, {y, -128, 127}]];
EdgeDetect[image]
Which yields
