[Numpy-discussion] 3d ODR

Robert Kern robert.kern@gmail....
Thu Jun 16 11:39:16 CDT 2011


On Thu, Jun 16, 2011 at 06:28, Christian K. <ckkart@hoc.net> wrote:
> Hi,
>
> I need to do fit a 3d surface to a point cloud. This sounds like a job for 3d
> orthogonal distance regression. Does anybody know of an implementation?

As eat points out, scipy.odr should do the job nicely. You should read
at least part of the ODRPACK User's Guide in addition to the scipy
docs for it:

  http://docs.scipy.org/doc/external/odrpack_guide.pdf

The FORTRAN examples there have scipy.odr translations in the unit tests:

  https://github.com/scipy/scipy/blob/master/scipy/odr/tests/test_odr.py

Exactly what you need to do depends on the details of your problem. If
your surface is of the form z=f(x,y), that's a pretty straightforward
multidimensional model. If you have a closed surface, however, you
will need to use an implicit model of the form f(x,y,z)=0, which may
or may not be easy to formulate. The unit test for the implicit case
fits a general 2D ellipse to a 2D cloud of points, as described in the
User's Guide.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list