python app to turn a photograph into a cartoon

Overview

Draw This.

Draw This is a polaroid camera that draws cartoons. You point, and shoot - and out pops a cartoon; the camera's best interpretation of what it saw. The camera is a mash up of a neural network for object recognition, the google quickdraw dataset, a thermal printer, and a raspberry pi.

If you'd like to try it out for yourself, the good folks at Kapwing have created an online version!

photo

The software can run both on a desktop environment (OSX, Linux) such as a laptop, or an embedded environment on a raspberry pi.

Desktop installation (only tested on OSX and linux)

  • Requirements:
    • Python 2.7*
    • Cairo (on OSX brew install cairo)
  • install dependencies using pip install -r requirements_desktop.txt from the cartoonify subdirectory.
  • run app from command line using python run.py.
  • select 'yes' when asked to download the cartoon dataset (~5GB) and tensorflow model (~100MB).
  • close the app using ctrl-C once the downloads have finished.
  • start the app again using cartoonify.
  • you will be prompted to enter the filepath to an image for processing. Enter the absolute filepath surrounded by double quotes.

*Unfortunately python 2.7 is required because the correct python 3 wheels are not available for both the pi and desktop.

Raspberry pi wiring

The following wiring diagram will get you started with a shutter button and a status LED. If the software is working correctly, the status LED should light up for 2-3 seconds when the shutter is pressed while the raspi is processing an image. If the light stays on, something has gone wrong (most likely the camera is unplugged).

IMPORTANT NOTE the diagram below shows AA cells, however this is not correct. You must use eneloop cells to power the camera - these cells deliver 1.2V each, as well as enough current to drive the raspi and thermal printer.

Wiring diagram

Raspberry pi installation

  • requirements:

    • raspberry pi 3
    • rasbian stretch image on 16gb SD card (8gb too small)
    • internet access on the raspi
    • pip + python
    • raspi camera v2
    • a button, led, 220 ohm resistor and breadboard
    • (optional) Thermal printer to suit a raspi 3. I used this printer here. Note you will need to use the printer TTL serial interface as per the wiring diagram above, rather than USB.
  • install docker on the raspi by running: curl -sSL https://get.docker.com | sh

  • set up and enable the raspi camera through raspi-config

  • clone the source code from this repo

  • run ./raspi-build.sh. This will download the google quickdraw dataset and tensorflow model, then build the required docker image.

  • run ./raspi-run.sh. This will start the docker image.

Troubleshooting

  • Check the log files in the cartoonify/logs folder for any error messages.
  • The most common issue when running on a raspi is not having the camera plugged in correctly.
  • If nothing is printing, check the logs then check whether images are being saved to cartoonify/images.
  • Check that you can manually print something from the thermal printer from the command line.
Owner
Dan Macnish
Developer, Artist and Engineer.
Dan Macnish
This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

This piece of code is a User Welcomer with Image Manipulation using Python and Pillow (PIL).

Bero 4 Jan 11, 2022
Fixes 500+ mislabeled MURA images

In this repository, new csv files are provided that fixes 500+ mislabeled MURA x-rays for all categories. The mislabeled x-rays mainly had hardware in them. This project only fixes the false negative

Pieter Zeilstra 4 May 18, 2022
An API that renders HTML/CSS content to PNG using Chromium

html_png An API that renders HTML/CSS content to PNG using Chromium Disclaimer I am not responsible if you happen to make your own instance of this AP

10 Aug 08, 2022
Tools for making image cutouts from sets of TESS full frame images

Cutout tools for astronomical images Astrocut provides tools for making cutouts from sets of astronomical images with shared footprints. It is under a

Space Telescope Science Institute 20 Dec 16, 2022
🎶😤 Generate an image indicating what you are listening to 😳

I'm Listening to This (song that I've sent you an image about detailing its metadata in a nifty way) Few lines describing your project. 📝 Table of Co

Connor B - Viibrant 4 Nov 03, 2021
👾 Python project to help you convert any image into a pixel art.

👾 Pixel Art Generator Python project to help you convert any image into a pixel art. ⚙️ Developer's Guide Things you need to get started with this co

Atul Anand 6 Dec 14, 2022
CadQuery is an intuitive, easy-to-use Python module for building parametric 3D CAD models.

A python parametric CAD scripting framework based on OCCT

1.9k Dec 30, 2022
Paper backup of files using QR codes

Generate paper backups for Linux. Currently command-linux Linux only. Takes any file, and outputs a "paper backup": a printable black-and-white pdf fu

Zachary Vance 27 Dec 28, 2022
PyGtk Color - A couple of python scripts to select a color (for scripting usage)

Selection Scripts This repository contains two scripts to be used within a scripting project, to aquire a color value. Both scripts requir

Spiros Georgaras 1 Oct 31, 2021
Avatar Generator Python

This is a simple avatar generator project which uses your webcam to take pictures and saves five different types of your images into your device including the original image.

Faisal Ahmed 3 Jan 23, 2022
Program designed to mass edit and watermark all photos in a directory

Photographer-All-In-One This is a program designed for photographers to mass edit or watermark photos (.jpg || .png) You can run this program from any

Brad Martin 2 Nov 23, 2021
Napari simpleitk image processing

napari-simpleitk-image-processing (n-SimpleITK) Process images using SimpleITK in napari Usage Filters of this napari plugin can be found in the Tools

Robert Haase 11 Dec 19, 2022
:rocket: A minimalist comic reader

Pynocchio A minimalist comic reader Features | Installation | Contributing | Credits This screenshots contains a page of the webcomic Pepper&Carrot by

Michell Stuttgart 73 Aug 02, 2022
View images in the terminal using ansi escape codes and python

terminal-photo-viewer view images in the terminal using ansi escape codes and python !! Only tested on Ubuntu 20.04.3 LTS with python version 3.8.10 D

1 Nov 30, 2021
Demo of using Auto Encoder for Image Denoising

Demo of using Auto Encoder for Image Denoising

2 Aug 04, 2022
Create a static HTML/CSS image gallery from a bunch of images.

gallerize Create a static HTML/CSS image gallery from a bunch of images.

Jochen Kupperschmidt 19 Aug 21, 2022
Nutrify - take a photo of food and learn about it

Nutrify - take a photo of food and learn about it Work in progress. To make this a thing, we're going to need lots of food images... Start uploading y

Daniel Bourke 93 Dec 30, 2022
粉專/IG圖文加工器

粉專/IG圖文加工器 介紹 給PS智障(ex:我)使用,用於產生圖文 腳本省去每次重複步驟 可載入圖片(方形,請先處理過,歡迎PR) 圖片簡易套用濾鏡 可將圖片切片 要求 Python 版本 3.9 安裝 安裝最新 python pip3 install -r requirement.txt 效果

Louis Tang 7 Aug 10, 2022
This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.

Freedom to build what you want FreeCAD is an open-source parametric 3D modeler made primarily to design real-life objects of any size. Parametric modeling allows you to easily modify your design by g

FreeCAD 12.9k Jan 07, 2023
Polyfoto - Create image mosaics.

Polyfoto Create image mosaics. Showcase "Before and After Science" by Brian Eno "Scott 3" by Scott Walker Installation Clone this repository to your l

Shane Drabing 149 Dec 25, 2022