IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit

Modules demonstrating how to estimate line 2d parameters from a cloud of points. More...

Modules demonstrating how to estimate line 2d parameters from a cloud of points.

Line2dSimpleEstimation.png

For more informations about parametric estimation features, please see Parametric estimation.

We start by importing all necessary libraries:

import PyIPSDK

Searched 2d line is defined using polar coordinates : $\theta = \frac{2\pi}{3}$ and $\rho=5$.

We then define input data points as points on previous line with perturbated ordinate :

\[ P_i = \{x_i, y_i\} \mid y_i=(rho-cos(theta)*x_i)/sin(theta) + N(0, 1) \]

with :

# we define a 2d line by its polar coordinates :
# rho = 5 and theta = 2pi/3 (roughly 2.094)
# We then use following sampled points :
# each point is defined has [x; y=(rho-cos(theta)*x)/sin(theta) + N(0, 1)]
# where N(0,1) is a random centered normal noise with unit standard deviation
ptColl = [
[-10, 1.35403297463199],
[-9, 0.467545836976205],
[-8, -0.46107136900246],
[-7, 2.88401452309772],
[-6, 1.35410194806754],
[-5, 3.42764603498653],
[-4, 2.73323167279303],
[-3, 4.22309730303385],
[-2, 4.15796800933893],
[-1, 5.65520168353248],
[0, 5.91414922631518],
[1, 5.86675394243645],
[2, 7.4151432829996],
[3, 7.82681999731427],
[4, 6.99551190321505],
[5, 8.93195534818365],
[6, 9.75159614279396],
[7, 11.116355092464],
[8, 10.3324851051409],
[9, 11.8861915791043],
[10, 10.5877158470975],
]

We then compute simple least square line estimation using following syntax :

# we can then simply compute associated least square line
line, res = PyIPSDK.line2dSimpleEstimation(ptColl)

At last we display estimation results

# display results
print("Estimated line :")
print("----------------")
print(line)
print("")
print("Estimation detailed results")
print(res)

See the full source listing