fixed sobel edge detection algorithm to handle edge-of-photo case. all tests pass