title: Straight section of a digital curve
body: <p>I have continuous digital curves that are close to a line segment, except maybe at both ends.</p>
  
  <p>How would you delimit the linear section (say remove the red parts) ? The solution needn't be very accurate, but fast.</p>
  
  <p><a href="https://i.stack.imgur.com/1eHvr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1eHvr.png" alt="enter image description here"></a></p>