I have to write my own edge detector to make it faster