edge detection appartently working, but incorrect values being produced