generate a smooth polygon from a png image in c++