Detection of simple shapes on grayscale image (homework :)