C.07 QR Code Generation

Today, I did some experiments with QR codes to extend upon the structure I already had which sent 1’s 2’s and 3’s from processing to Arduino depending on key presses.

Goal: To replace the input (key presses) with QR code detection through the webcam.

One thing I know about this process is that the QR code detector will return the key code for the letter 1 rather than a number value 1. So this needs to be rectified.

Process

Using the QR code generator that was recommended by the links in C.06 Troubleshooting and Structure and saved them as usable qr codes like so:

Before printing and testing the qrcodes on the webcam, I decided to upload them in processing to make sure they could be decoded properly (see line 72). This threw out an error ‘No QR code image found’. I tested this against a file path that was deliberately wrong and that threw a different error, so there must be something wrong with the QR code image.

Screen Shot 2017-03-09 at 22.16.09

I suspected that this was because I tried to use the phone number section of the qr code generator and only used one digit. Running the jpeg through an online QR code decoder, produce the correct result however.

Screen Shot 2017-03-09 at 22.24.16

My options from here on are: a) To try again with text instead of a number, b) To find a site that will let me download the jpg for free c) use preexisting QR codes with an if statement that uses that data as a condition for returning 1’s 2’s and 3’s.

A. Try again using a text string

Screen Shot 2017-03-09 at 22.35.05

I repeated the process with the text string, 1 2 and 3. This time skipping the step where I sharpen the image on photoshop (to save time) and exporting them as png files (to match the example).

Again the same error came up.

Screen Shot 2017-03-09 at 22.51.47

 

c) Use pre-existing QR codes

Just to see if the decoder works with other qr codes, I have downloaded one from the internet. Running it through the online decoder reveals that is contains the string ‘12345678’.

Screen Shot 2017-03-09 at 23.00.35

Interestingly, this gives a different kind of error, I thought maybe the image itself was too large. The sample image was 216 x 216 pixels so I resized the tester qr code.

Screen Shot 2017-03-09 at 23.08.08

This worked and the string was returned. When I tested it out on the original 1,2 and 3 (digit, not string) QR codes, it also worked! However the data returned was TEL:3 rather than just 3. So I will use the 1,2 and 3 (string) QR codes instead.

Screen Shot 2017-03-09 at 23.18.24

I don’t think this would have been much of a problem when printed out but I am glad I was able to fix this issue, regardless.

Screen Shot 2017-03-09 at 23.30.17

 

Advertisements

Author: Pip Williamson

Pip // Animator & Motion Designer

1 thought on “C.07 QR Code Generation”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s