done based on cs663 : Fundamentals of Digital Image Processing