title: Algorithm to identify the straight portion of a curved line
body: <p>I am not familiar with the problem I am about to describe here. So sorry about the wrong terminology. </p>
  
  <p>What I am looking for is an algorithm (preferably a library in C/C++) to identify the straight part out of a curved line. Input curved line is defined using a set of ordered points in (x,y) form. I found some articles about Hough transform and one libray OpenCV. It seems to be possible to use OpenCV but looks a overkill. What I need is a very efficient algorithm to handle one simple curved line. Any ideas how to do it? Thanks.</p>
  
  <p>Update: see example below, the goal is to identify the red part <a href="https://i.stack.imgur.com/ugRRS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ugRRS.png" alt="enter image description here"></a>
  <br>
  As some pointed out that the straight part may not extactly straight, i.e. I may need some tolerance of deviations here. </p>