# Distinguish if a line is almost straight or a curve

• Jan 15th 2013, 02:54 AM
giannos
Distinguish if a line is almost straight or a curve
Hello people,
I am a computer science student I am trying to find a way to distinguish the shape between lines in a program I am developing. For example, in the image below the connected pixels represent lines. The two colours, white and yellow, are used in this example to depict which lines need to be considered as straight lines and which as curves. After making this distinction, the "curved lines" will be erased. Can anyone help me in archiving this?

Attachment 26570

Thank you
• Jan 15th 2013, 04:18 AM
JJacquelin
Re: Distinguish if a line is almost straight or a curve
Hello,

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