Ashwinning / libmv

Automatically exported from code.google.com/p/libmv
MIT License
0 stars 0 forks source link

LensDistortion::ComputeUndistortedCoordinates seems wrong #27

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The tangential distortion code seems wrong to me but I don't want to commit a 
fix without testing.

It defines "double radius_squared = radius * radius" when radius is actually 
already squared, so I think we need to remove this and rename radius to 
radius_squared.

Since we only input the first 2 tangential coefficient, maybe we could also 
remove the loop which is supposed to compute higher orders.

I think using tangential_distortion_[0] and tangential_distortion_[1] would be 
clearer than tangential_distortion_.x() and tangential_distortion_.y().

Besides, the radial_distortion code is quite unclear, Since this code shouldn't 
be performance critial, I propose using:
for (int i = 0; i < radial_distortion_.size(); ++i)
 coef_radial += radial_distortion_[i] * pow(radius,i+1);

Original issue reported on code.google.com by Matthias.Fauconneau@gmail.com on 17 Jun 2011 at 3:24