2D image to STL mesh

Convert 2D images to 3D stl CAD model


Updated 29 Oct 2013

View License

This is a MatLab-based tool allowing to segment and generate 3D CAD model from 2D images (.bmp image formats are supported). Iso-surfaces are detected by using a cluster¬ing algorithm: the “K-Means” clustering method is here implemented. This method operates by grouping image pixels, defined with their grey scale, into K groups/clusters. A constant pixel value (the centroid of the cluster) is associated with each cluster. By using this classification, for the i-th slice, logi¬cal matrices (pixel mask) of pixels are introduced: the value of the t-th pixel is equal to “1” if it belongs to the k-th cluster, otherwise it is as¬sumed equal to “0”. Once clustering classification have been per¬formed for all image slices, 3D tessellated surfaces are created by using the marching-cube algorithm (isosurface function available in MatLab).
Segmentation and classification algorithms are also implemented within a user-friendly MatLab Graphical User Interface (GUI), which prompted the user: (i) to load images, (ii) to apply automatic filters and segmenting algorithms, and (iii) to visualize 3D models and to export tessellated surfaces into standard .stl format. Furthermore, the Region of Interest (ROI) could be selected for processing and then 3D visualization. Tessellated models might be then imported into .slt format. NURBS surfaces can be generated, for example, in SolidWorks CAD environment, where the “SCANto3D” add-in module can be used to process and manage imported tessellated surfaces.
Please cite the following paper when use the attached toolbox:

"Ausiello, P., Franciosa, P., Martorelli, M., Watts, D., Numerical 3D-FE Modelling of Indirect Composite-Restored Posterior Teeth, Dental Materials, 10.1016/j.dental.2010.12.001 2011"

For more details on how to use the toolbox, please have a look to the attached animated gif video.

Cite As

Pasquale Franciosa (2023). 2D image to STL mesh (https://www.mathworks.com/matlabcentral/fileexchange/44103-2d-image-to-stl-mesh), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes