A cartoon image filtering tool ran completely in-browser, accelerated using Web Workers and Web Assembly. Click here to try the demo!
- Choose an image either by uploading from your local filesystem or by entering its URL.
- As the filter completes each step, the step result will appear in the bar at the bottom of the page. Click on a step result in the bottom bar to magnify it in the center of the screen.
- Once the filter is complete, download the processed image by selecting it in the bottom bar, hovering over the magnified image in the center of the screen, and clicking the download icon button at the center of the image.
Not all images perform well with the default filter settings and may need to be adjusted accordingly. Use the sliders in the configuration sidebar to adjust the following settings:
- Edges - The edge detection threshold. A higher value will produce an image with more edges and a smaller value will produce an image with fewer edges.
- Blur - Adjusts the number of iterations of the bilateral filter on the colors portion of the image.
- Quantization - The factor that the colors in the image are reduced by. A large factor will replace large areas of similar colors with a single color, while a small factor will leave the original colors mostly intact.
This tool implements the Dade Toonify Algorithm using OpenCV.js, a Web Assembly binding for OpenCV. The algorithm is divided into two branches: edge detection and color processing, and are combined at the end to produce the final result.
- Apply a median filter to reduce noise
- Canny edge detection
- Apply a 2x2 morphological operation to bolden and smooth the edges
- The original algorithm includes a fourth "edge filter" step to reduce small line clutter but is not included in this tool yet.
- Apply a bilateral filter between 8-20 times (depends on user configuration) to blur the colors.
- Re-quantize the color palette by dividing number of colors by a quantization factor (24 is the default setting)
Overlay the edges onto the color image. The edges are currently drawn in black, but will eventually be configurable by the user.
TODO: showcase successfully processed images