toSTL - Convert Images to STLs

10/2018 – 11/2018

Introduction

toSTL converts images to STL files which can then be 3D printed.

Background

I created toSTL as a way to convert images (such as the examples above) into STL files which I could then 3D print. While this project initially seemed simple, I ended up adding several function in order to make it work well.

How it Works

The basic idea behind toSTL was: take an image, find the edges of the image, pathfind around the image, and then write an STL file that describes the edges of the image, and finally use an external program to fill in the model. However, as I worked on the project, I found several things made it more complicated. For example:
  • Converting from the descrete representation of coordinates used for pixels to the continuous representation used in STL files.
  • Determining where the edges of an image are (especially if the image is not pure black and white).
  • Tracing the outline of the edges (which is a P vs NP pathfinding problem).
  • Using curve fitting to smooth out the edges of the STL file.
  • Triangulating the polygons that represnt the top and bottom of the image (so that the STL file isn't just edges).
To address these challenges, I added a variety of settings which can be customized to best suit each image used. Some of these settings inlcude:
  • Offering multiple customizable methods for determining what should be considered part of the image. For example, this program can use regular color distance or delta E with a customized threshold.
  • Offering multiple pathfining mechanisms to maximize tracing speed.
  • Using a curve fitting library with a customizable curve length to determine how to smooth the edges of the STL files.
  • Using a triangulation library to build the top and bottom of each shape.
  • Adding a setting to blur the image.
  • A setting which highlights areas of the image that could cause potential issues during the conversion.
  • A setting which attempts to fix the potential issues found.
  • Customizable STL file height.
  • The ability to slow down and animate the pathfinding process to try to debug potential issues with it.

Specifications

Language(s):Java
Relevant Topics:Pathfinding
STL Files