Please refer to the following document: https://www.tutorialspoint.com/dip/concept_of_edge_detection.htm