Image showing an overlay of a DLP printer slice image and a software parameter screenshot

3d DLP slicer image handling

On the way to improve the performance of my Monkeyprint DLP printer software I recently rewrote the code that hollows the model and generates the fill patterns. I think my method is pretty neat, so I thought I’d share it here. If you like an image processing approach to model hollowing, continue reading!

Monkeyprint includes options to model hollowing or fill the model with a rectangular pattern. Printing your models hollow or with internal grid structures can significantly reduce the peel-off forces — which increases your vat coatings life.

Image showing the slice through a monkey head model in solid, hollow or pattern filled versions
Monkeyprint gives you the choice to print solid or hollow with a definable wall thickness and with or without a fill pattern.

Hollowing a 3d model can be quite error prone and computationally expensive. So I decided against doing the model hollowing and fill structure generation on the actual 3d model. Instead, I do it virtually: My method is completely based on image processing of the slice images. This makes the procedure very robust.

The process consists of only a few very simple and common image operators.

Binary erosion: This morphological image operator shrinks all white model regions of the slice image by a user defined wall thickness. For more info check out this article on wikipedia. The result of an erode operation is illustrated below:

Image erosion


Subtract: this arithmetic image operator combines two images by simply subtracting the pixel values of one of the images from the pixel values of the other image. Where the subtracted image is black, the output is unchanged, where it is white the output will be black.

Image subtract


Multiply: another arithmetic image operator that simply multiplies the pixel values of two images and divides them by 255 afterwards. Performed on binary images this operation behaves like a binary addition. Where both images are white the result is white as well. Where one of the images is black, the result is black.

Image multiply


So how does it all come together?

The following diagram illustrates the whole process:

Monkeyprint slice image handling
The process of creating hollow or pattern filled slice images. First, the original image is eroded by the user defined wall thickness to create the region that will later be cut out from the slice image. If no fill structures are desired, this eroded image will simply be subtracted from the original image. If fill structures are desired, the cut out region will be used to mask a fill pattern image which will then be subtracted from the original image.

In addition, the fill pattern moves by one pixel in X and Y direction from each slice to the next. This ensures that the vat floor coating will be worn evenly.

Gif animation showing a stack of slice images through a monkey head including model hollowing and fill structures.
Slices of the Blender monkey head model showing model hollowing and moving fill structures.

The image operations are all done using the OpenCV 2.4 library through its Python bindings. This is very simple, for example for binary erosion:

# Import OpenCV 2.4 and Numpy.
import cv2
import numpy

# Create the erosion kernel, radius is wall thickness.
kernel = numpy.ones((radius,radius), numpy.uint8)

# Erode the image.
imageEroded = cv2.erode(inputImage, kernel, iterations=1)

It’s easy as that and the performance is extraordinarily good compared to using the Scipy binary erosion or my self made erosion code that took about 1500 times longer.

If you like this, make sure to check out Monkeyprint. You can also find the image processing sources in my Github.

In case of questions or suggestions, please comment below.

Oh, and by the way: happy new year!


3 thoughts on “3d DLP slicer image handling”

    1. Hi Bingiu,

      thanks for your comment 🙂
      If I get your question right, you want to know when it makes sense to use fill structures?
      Well, that depends on your model. If, for example, your model is very large using fill structures drastically reduces the adhesion force to the VAT floor. I would say you can safely use fill structures if a solid model is not important (which might be the case if you print transparent parts).

      Does this answer your question?
      Kind regards,

Leave a Reply

Your email address will not be published. Required fields are marked *