Hilarious implementation of edge detection using a neighbors dictionary. Can wrap edges or truncate them. Implementation uses a single buffer array instead of 2D array.