I am not familiar with the problem I am about to describe here. So sorry about the wrong terminology.
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.
Update: see example below, the goal is to identify the red part
As some pointed out that the straight part may not extactly straight, i.e. I may need some tolerance of deviations here.