We will use OpenCV with ZBar to generate the QR codes, using the library qrcode from PIL. OpenCV is an open source code that works with computer vision. Computer Vision is an interdisciplinary field that deals with how computers can understand digital images or videos. The idea here is to automate tasks that the human visual systems can do. So, a computer should be able to recognize objects such as that of a face or QR code. The Zbar is a specific library available to generate the QR codes and PIL is a Python Imaging Library which allows for opening, manipulating, and saving many different image file formats.
We successfully developed a python script program that generates a QR code for the specific PPE levels. Our code imports qrcode from the PyPi website in the reference links which includes Pillow open source image package to create the image of the QR code. This randomly generates a QR coded as a png file, where one can input a name and file name. The name will later appear on the screen when its QR code is detected and will be saved onto the database for later use when decoding. This file is automatically saved in our barcode-scanner folder available in the bitbucket. This was a preliminary code that was not given to the client as we opted for an HTML deliverable instead which is in the results section.
Next, we created a database on Excel to save all generated QR codes with their names in an easy way. Each sheet on the Excel file attached in our Bitbucket will represent a level of PPE.
![](https://sites.wustl.edu/ese499facialpperecognition/files/2020/04/qr1.jpg)
PPE Examples
The way the excel links to the python script is very unique. The Excel doc has 5 sheets for 0-4 PPE levels. Using the Pandas package our code reads the corresponding excel sheet.
- If PPE level 0 then pandas package pulls all items in the PPE level 0 sheet and creates a list
- If PPE level 1 then pandas package pulls all items in the PPE level 1 sheet and creates a list
- If PPE level 2 then pandas package pulls all items in the PPE level 2 sheet and creates a list
- If PPE level 3 then pandas package pulls all items in the PPE level 3 sheet and creates a list
- If PPE level 4 then pandas package pulls all items in the PPE level 4 sheet and creates a list
Results
![](https://sites.wustl.edu/ese499facialpperecognition/files/2020/04/qr3-350x197.jpg)
QR Decoding System Flow chart
![](https://sites.wustl.edu/ese499facialpperecognition/files/2020/04/qr2-350x223.png)
QR Code generation page from QR Code website