Giter Club home page Giter Club logo

cartoonify's Introduction

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.

cartoonify's People

Contributors

danmacnish avatar gkdoc avatar pageman avatar ulve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cartoonify's Issues

Cheaper Hardware

Hello,

I like this project and I want to build it to offer as gift. :)

I have questions about hardware requirement. Actually the rpi 3 cost 40$, thermal printer 50$ and the pi camera v2 25$ => a total base of 115$ and need to add additionnal equipments (battery, button, etc.). I want if possible to reduce the global price, idea :

  • Can we use any thermal printer TTL, or cartoonify is specific to the Adafruit Tiny Printer? I can found other TTL printer at 20$.
  • rpi3 is the best powered rpi but we need this version? rpi0 can do the same job? 6$
  • same question about pi camera v2, a more cheaper camera can do the job? 5$

Cheaper base 20 + 6 + 5 = 31$ ! Much less than compared to 115$. More attractive...

Freeze on "loading cartoon dataset..."

Hello,

Today I have try to start this project with a raspberry pi 3B :)
HDMI outuput is breaking, so i proceed only via ssh connection.
I think the hardware look's good, no error during installation.
But impossible de get print, picture file, or anything else.
I check the logs/, every minutes a new file are created :

-rw-r--r-- 1 root root   64 Jan 19 00:40 20190119-0040.log
-rw-r--r-- 1 root root   96 Jan 19 00:41 20190119-0041.log
-rw-r--r-- 1 root root   64 Jan 19 00:42 20190119-0042.log
-rw-r--r-- 1 root root   64 Jan 19 00:43 20190119-0043.log
-rw-r--r-- 1 root root   96 Jan 19 00:44 20190119-0044.log
-rw-r--r-- 1 root root   64 Jan 19 00:45 20190119-0045.log
-rw-r--r-- 1 root root   96 Jan 19 00:46 20190119-0046.log
-rw-r--r-- 1 root root   64 Jan 19 00:47 20190119-0047.log
-rw-r--r-- 1 root root   64 Jan 19 00:48 20190119-0048.log
-rw-r--r-- 1 root root   96 Jan 19 00:49 20190119-0049.log
-rw-r--r-- 1 root root   64 Jan 19 00:50 20190119-0050.log
-rw-r--r-- 1 root root   32 Jan 19 00:51 20190119-0051.log

But always same content :

INFO:loading cartoon dataset...
INFO:loading cartoon dataset...
INFO:loading cartoon dataset...

1, 2 or 3 times on each files.

LED light stays on always. No reaction when a push the button (same if I connect manually the wires ).

Somebody have an idea ? Thanks !

How to use it?

Hi, I installed but I don't know how to run it.

I show you my terminal session: https://asciinema.org/a/n8VjH60sHnF4SUFGgwiVPXqgR

And the log:

ERROR:No module named RPi.GPIO
Traceback (most recent call last):
  File "/Users/ericlagarda/Downloads/cartoonify-master/cartoonify/app/gpio/gpio.py", line 16, in __init__
    self.gpio = importlib.import_module('RPi.GPIO')
  File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named RPi.GPIO
INFO:loading cartoon dataset...
INFO:Done
INFO:loading tensorflow model...
INFO:Done
INFO:setup finished.
INFO:processing image...
INFO:saving results...

Thanks so much!

Wiring diagram issue - AA noted in text, AAA noted in diagram

Hi there -

I noticed in the diagram, 4xAAA are shown, but you write that they should be 4xAA enerloops. I assume it's AA to provide enough voltage, but is that the case?

Also is it specifically four of them to power both the printer and the RPI?

There's also a line running from what looks like 3v3 power to the other positive rail on the breadboard. Is this correct, and why?

Thanks!

Update interface reference for greater compatibility

Current build uses "serial:/dev/ttyS0" in the startup script, the recent raspberry pi's expect you to use "/dev/serial0", which is an alias provided to either /dev/ttyAMA0 or /dev/ttyS0, depending on your exact raspbian OS version. Updating the scripts to /dev/serial0 will provide greater compatibility.

automatic printing

first off thanks for this project - it's awesome!

I'm able to take pics using the gpio button press - and then I can print the cartoonified images fine using lp from command line using the format from workflow.py (lp -o landscape -c cartoonX.png) but for some reason they aren't being printed on the gpio button press

i'm new to python - where's a good place to start looking for the problem?

thanks again!

Anyway to see the tensor-flow image recognition picture

Awesome project, I want to take this one step further and wanted to know if you had some insight on how to have the program also show the object_detection file. By this, I mean displaying a picture of the image given, with the boxes around it showing what the program thought an object was which would lead to the drawing. I figure the program does this, so I feel it should be fairly simple to just pull that step out so it can show the image given with the detected parts.

Thanks for the help, what I'm looking for it to display is something like the image below
image

Add some examples?

Hi!
This project sounds awesome!
But so far it's kinda hard to know what it does on an input image and what does the result look like.
Could you try to include some examples please? Like two or three input/output examples?
Thanks.

some questions

hi, great project, thanks for sharing.

i 've run my "cartoonify" on pi, but some questions:

a) how does it work to auto-print the new png file on thermoprinter? which file to edit?
b) how to quit the script? kill the pid?

thx.

ImportError: cannot import name run

Installed on mac using $ pip install --user and trying to run with $ cartoonify, getting this error: ImportError: cannot import name run. Installed module run using $ pip install run --user

How to uninstall from mac?

As because when I try to , I get
Cannot uninstall 'cartoonify'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Fails install, no TensorFlow1.4?

EDIT: I'm an idiot... don't need to go through all the manual processes for RaspberryPi, just skip down to the RPi instructions.

I haven't fully dug into it, but spent a little time a night or two ago and on the pip install -r requirements_desktop.txt, it starts to process but fails on TensorFlow 1.4. It seems to be indicating that 1.4 isn't available anymore. The nearest versions mentioned are 1.1 and 1.8. If I change it to 1.8 and try again, I get an out of memory error (sorry, at work right now, will get the exact message later, this is on a Raspberry Pi 3) and if I try 1.1, it fails on something else further down requirements_desktop.txt.

I'm sure I can figure it out, eventually, but thought I'd check and see if there's something dumb I'm missing or just don't know about like why TensorFlow 1.4 isn't being found.

Great project, though. I look forward to getting it running and having some fun at our makerspace demo days. Thanks!

-Trevor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.