Build a Cartoon Camera

3 min readFeb 28, 2021

Application to transform camera photo into cartoon image.

Cartoon Camera


In previous articles I developed a web based object detection system using YOLO and a text recognition application using Tesseract. In this article let’s build a fun cartoon camera which transforms camera photo into cartoon image.

The Application

The is a web based application built using React and FastAPI. The frontend application uses the web camera to capture photo and send to the backend through web socket. The backend application transforms it into a cartoon image, and sends the cartoon image back to the web application.

There are different styles that you can apply to the image. Below is a snapshot of a transformed photo.

Cartoon Image

Backend APIs

The backend is built using FastAPI. It hosts APIs to serve CartooGAN: Generative Adversarial Networks for Photo Cartoonization using HTTP and web socket.

You can access the APIs using FastAPI built-in Swagger UI at http://localhost:8088/docs.

Below is the image used to test the API, using the Swagger UI.

Photo by Jay Mantri on Unsplash

And below are the images with different cartoon styles.

Hayao Style
Hosoda Style
Paprika Style
Shinkai Style

Software engineer, Data Science and ML practitioner.