This normalization procedure was suggested in:: “Multiple view geometry in computer vision” by Hartley and Zisserman, and is needed to make the problem of finding the direct linear transform converge better
The idea is transforming the set of points so that their average is zero and their distance to the origin is in average sqrt(nb. of coordinates).
Parameters : | pointslist: numpy.ndarray :
|
---|---|
Returns : | normalized_points: numpy.ndarray :
T: numpy.array :
|
Examples
>>> pointslist = np.array([[0,0],
... [0,1],
... [1,1],
... [1,0]])
>>> [normpoints, T] = DLTnormalization(pointslist)
>>> (np.mean(normpoints,0) == 0).all()
True
>>> homogeneouspoints = np.ones((4,3)) #must convert to homog. coords.
>>> homogeneouspoints[:,:-1] = normpoints
>>> np.dot(np.linalg.inv(T),homogeneouspoints.T).T[:,:-1] #inverse transform
array([[ 0., 0.],
[ 0., 1.],
[ 1., 1.],
[ 1., 0.]])