Wednesday, November 11, 2009

3D Surface Modeling

In an earlier post I wrote about how the SUMO framework could be extended and applied to classification problems. While doing that it struck me that the SUMO Toolbox could be similarly used for 3D surface modeling.

With 3D surface modeling, I mean the fitting of 3D geometric data in order to reproduce the shapes of various 3D objects like cubes, spheres, chairs, tables, dragons, etc. Ideally this leads to a closed analytic expression that fully describes the object.

Work to this end has already been done of course, using RBF models (FastRBF) and neural gas models (I cant seen to find the link right now). However, since it was quite straightforward to implement (only a new example was needed, the modeling code did not have to change) I thought I would quickly add an example and associated demo file. This will be available in 6.3.

Wat is needed is a triangular surface mesh (in standard Matlab format) and the surface normals for each triangle (can be easily calculated). Given such a mesh I added a Matlab function that can decide whether any given point is inside or outside the mesh (using the excellent InPolyhedron function by Luigi Giaccari). Putting these two together in a new 3DModel example then allows any of the SUMO toolbox model types or sample selection algorithms to be used for fitting the object.

But how does it work? Well its very simple, the idea is to regard the problem as a classification (or regression) problem: (1) fit a model on the 3D points, use -1 and 1 as output values to indicate if a point is inside or outside the object, (2) of the final model, plot the isosurface at isovalue = 0

The object should magically appear. Of course, the more complicated the model the more data will be needed to get the details right and keep things smooth. As a proof of concept example I used SVM models and a simple sphere:


Not the fanciest and shiniest example, nor the nicest visualization, but it proves the point :) Adding more complicated models (teapots, dragons, sculptures, ...) is now trivial, limited only by available computer memory and processing power...

Of course many improvements can be made to the straightforward approach described here. But that is just a matter of some spare time and motivation :)

What would be interesting (and easy) though is to couple this with the LOLA sample selection algorithm. Since it should seek out the boundary automatically. Potentially saving a lot of time...

--Dirk

PS: naturally the models need to be closed for this to work

0 comments: