Add code to remove noise in edge detector