As in the title, I want to fit a cylinder to a group of 3D points with Python. This is a nice solution with MATLAB. How can we do it with Python?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Using scipy.optimize.leastsq, we can create an error function in which the difference between the observed cylinder radius and the modelled radius is minimized. The following is an example of fitting a vertical cylinder
There is paper at David Eberly site "Fitting 3D Data with a Cylinder" that describes math basics and shows pseudocode.
You can also refer to C++ code in Geometric Tools Engine at the same site. I think that some auxiliary math functions like matrix inverse etc could be implemented in NymPy.