The algorithm consists of four steps:
- Filter edges using a convolutional filter.
- Thin edges depending on it's gradient and direction.
- Threshold the image so all pixels where it's gradient is below a minimum threshold becomes black, all pixels where it's gradient is above a maximum threshold becomes white, and the rest becomes gray.
- Trace the edges so all gray pixels connected to white becomes white, and the rest becomes black.