IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
# [DocSampleImports]
import PyIPSDK
# [DocSampleImports]
# [DocSampleInputDataSet]
# 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
# Coordinates of two points have been modified to introduce outliers
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, 10], # outlier !
[-1, 5.65520168353248],
[0, 5.91414922631518],
[1, 5.86675394243645],
[2, 0], # outlier !
[3, 7.82681999731427],
[4, 6.99551190321505],
[5, 8.93195534818365],
[6, 9.75159614279396],
[7, 11.116355092464],
[8, 10.3324851051409],
[9, 11.8861915791043],
[10, 10.5877158470975],
]
# [DocSampleInputDataSet]
# [DocSampleEstimation]
# we can then simply compute robust least square line
cfg = PyIPSDK.EstimationConfig()
cfg.initLMS(0.40)
line, res = PyIPSDK.line2dEstimation(ptColl, cfg)
# [DocSampleEstimation]
# [DocSampleDisplayResults]
# display results
print("Estimated line :")
print("----------------")
print(line)
print("")
print("Estimation detailed results")
print(res)
# [DocSampleDisplayResults]