The basic procedure is to chop up your input file into datapieces that fit a QR code.
According to the specs, a QR code can hold 4296 alphanumeric characters or 2953 bytes (8bit).
So decide how you want to store your data :
- alphanumeric characters (easy to check with any decoder but you need to convert your binary data to alphanumeric data) ot
- 8 bit binary data (harder to check but you can add a bit more data to each QR code).
For testing purposes, I would recommend alphanumeric because it is easy to check.
After deciding this the following steps are necessary :
1. convert you input file to alphanumeric if needed
2. chop up your input file into piece that fit a single qr code
3 encode a qr code for each piece.
Now you have a large number QR codes
Decoding them is the reverse process
1. read each QR code and extract that data piece
2. append all data pieces
3. if the data was alphanumeric, convert the alphanumeric data to binary data again.
For bonus points to impress your teacher :
- add each data pice to your own data structure which defined an index. When extracting the data, look up the index of each piece. Then you will be able to scan QR codes in a random order.
- add a checksum to your input data to check the validity of the decoded output.
- add a parity archive (https://en.wikipedia.org/wiki/Parchive) so that you can miss a few QR codes and still be able to recreate the original file.
- add a cool logo to the QR code, or even a sequence number. this involves setting a high error correction for the QR codes themselves.
- create a flip book device with a webcam to scan all QR codes (http://brightbytes.com/collection/flipbooks.html)
Thanks a lot for a very detailed reply.
Is there any method you could suggest to convert a file to alphanumeric, when developing an android app using android studio? So far I've only come across Base64 encoding method.
Sorry if my questions are very basic. I'm a beginner to the programming world.
>>So far I've only come across Base64 encoding method.
Base64 is great for encoding/decoding and you can probably find enough examples how to use it.
And why spend a lot of time on writing your own encoder/decoder if you can use it right out of the box?
If you have any other question, feel free to mail them anytime.
I managed to do till the part where the input file is chopped so that it would fit to a single QR code. Any suggestions as to how i should convert the chopped string to multiple QR codes. I can only convert the very first array created. I posted this in stackoverflow
2 things you need to do :
1. Make sure you output the barcode you just made to a file.
2. Put everything you have made so far in a loop :
for (int i=0;i<Base64Parts.length();i++)
// in your code change Base64Parts to Base64Parts[i]
// also make sure you use 'i' in the filename of your output image
and it will loop over all the elements in the Base64Parts array.
After generating your individual QR codes,
you need a way to show them 1 by 1.
You could go for the build in photoviewer as a start and focus on building the decoder.
If your decoder proves to be fast enough, you know how long you will need to show each bar code.
Then you could indeed make an animated gif (where you set the display interval long enough to decode each QR code).
Decoding it to a video might take more effort.
Since you are on Android, you could also look foor a photo viewer component and point that to the output folder of your images. Maybe you can have the photo viewer component go to the next image if you press one of the side buttons on the phone. In this way you control the speed with which QR codes are shown. That way you can make sure you QR decoder has decoded the image before you move on to the next.
If you have only 1 phone available, it's maybe easier to write all image to a new folder.
If you want to test your decoder, just point it to the right folder and let it read the files (in the correct order that is).