Source: https://uotechnology.edu.iq/ce/lecture 2013n/4th Image Processing _Lectures/DIP_Lecture15.pdf