I would like to approximate smooth lines with chain of line segments. cv2.approxPolyDP in OpenCV 3.4 made a good result in the case of closed curve. Origin close curve: Approximated close curve: But in the case of open curve, cv2.approxPolyDP did not achieve the desired effect. Origin open curve: Approximated open curve: The result I want should be one chain