I suggest to begin with a crude distinction :
- Define a system of axes in order to compute the (x,y) coordinates of the pixels of the line.
- Perform an orthogonal linear regression, i.e. perpendicular offsets (not a common regression) Refences below.
- Compute the mean squares of the orthogonal distances.
- Standardize the mean sq. versus the extend of the data.
- Compare the standardised mean sq. to a threshold (previously experimentaly chosen) in order to qualify the line.
The orthogonal regression can be done thanks to the "principal components analysis" method :
Principal component analysis - Wikipedia, the free encyclopedia
or alternatively, thanks to the formulas given §.3.3, page 8, in the pdf "Régressions Conique, Quadrique, Circulaire, Sphérique,..." published on :
JJacquelin's Documents | Scribd