This Python scripts reads barcodes from your webcam and prints them on console in addition to drawing the text on the webcam stream. As to why would you use a webcam instead of an actual barcode scanner is up to you, this is only for learning purposes.
This script requires OpenCV for Python and pyzbar in order to read barcodes.
- For OpenCV run
pip install opencv-python
- For pyzlib run
sudo apt-get install libzbar0
pip install pyzbar