Final AIDP algorithm for polygonal approximation.
Works on PGM images, on lines 1 pixel wide.
Test output images with varied alpha and beta values.