Enhanced edge detection method based on a threshold function for discrete data