text: Q:
  
  Robust Contour Linearity Mesurment
  
  I have extracted the contours of an image using C++ & OPENCV. I need now to check the linearity of every contour (just checking not detecting lines). So, I can eliminate some contours which are less or more than a threshold.
  I found this great paper: http://milos.stojmenovic.com/Publications_files/P0386.pdf
  However, The methods are too complex to be implemented in a robust way. It is possible to to perform the linearity check on a set of N random points which works well but without robustness.
  Any suggested solutions ? Many thanks
  
  A:
  
  use a minAreaRect function get RotatedRect. For line one of the dimensions of RotatedRect is so small. 
  
  