GithubHelp home page GithubHelp logo

0xrory / living_qr_code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twisst/living_qr_code

0.0 0.0 0.0 2.79 MB

A QR code that appears to be entirely composed of your webcam video — and yet remains scannable!

License: GNU General Public License v3.0

JavaScript 99.71% Processing 0.28% CSS 0.01% HTML 0.01%

living_qr_code's Introduction

Living QR code

A QR code that appears to be entirely composed of your webcam video — and yet remains scannable!

Living QR Code

Live demo: https://openprocessing.org/sketch/2289887

This Processing script shows a 29x29-squares QR code where a video is shown in between the necessary squares. This works because the squares that make up the QR code actually consist of 3x3 smaller squares. Only the middle one is needed for the QR code to work.

You can also watch my demo at Hackaday Berlin 2024 for an explanation.

(The Processing version works a bit better than the P5 version you see in the live demo; see my notes on that.)

Making the base QR code

The base QR code pattern is stored in a PNG file called blank_qr_code.png. The pixels in that image tell this script which squares should appear larger (without those the QR code would not scan correctly).

Living QR code at Raspberry Pi Jam The Hague

The actual data for the QR is created using an online service. There are several that will let you create QR codes for free. Goqr.me will let you output QR codes as vector images, which you can then convert to a tiny PNG file.

The script expects the QR code to have a size of 29x29 squares (QR code version 3). To get that from Goqr.me, you have to enter at least 33 characters. If necessary, pad the url with spaces. Click on 'Download', set border to 0, leave everything else as-is, then under 'Download QR Code as' click on 'SVG'.

Using Inkscape: open the SVG, File > Export, set width and height both to 29 in the Document tab, set the filetype to PNG at the bottom there, choose a name and set the destination folder to the data folder for the Processing script and click 'Export'. You may need to uncheck 'Hide Export Settings' and set 'antialias' to 0 in the export settings window that pops up.

To do

This is my wishlist of thing I'd like to add:

  • full screen video (with the QR code in the middle)
  • use Processing to generate a QR code
  • try out how well this works with different QR versions, so bigger than 29x29
  • showing a different QR code depending on what is in view
  • use pre-made effects as overlay. I'm thinking large marquee text scrolling by.
  • colour! (HSL palette should make it possible to have colours that have high enough contrast)

Thanks

I had the idea for using live video in QR codes when I saw this QR code published by someone named Repeated Failure. (More info here.)

I based the script on Mirror 2 by Daniel Shiffman, where pixels from the video source are drawn as rectangles with a size based on their brightness. (See Dan's tutorial on live video.)

The dithering is handled by Julian Hespenheide's dithering class for Processing.

The photo on this page was made by Aldo Hoeben, demonstrating the living QR code. Both his amazing artworks and my living QR code were part of the Raspberry Pi Jam I organised in The Hague in January 2024. Yes, the Processing script with the QR code runs on a Raspberry Pi 5!

living_qr_code's People

Contributors

fieldofview avatar twisst avatar

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.