today i read about barcodes and QRcodes . well i see barcodes / QR codes and often see them on almost every product. But as a programming learner , i wanna know about what they represent ?, how they are created(with which information) ?, how they are read by our application ? does any application can read any barcode ?
i wanna know about what they represent
Usually a product number, but QR code is designed to contain something larger, like an URL.
how they are read by our application
Usually by an external scanner. These scanners read the image and convert it into plain text, which is often emulated as being keyboard input.
does any application can read any barcode
Mobile application able to integrate with a camera can. So basically, the same is possible when using a webcam. You just need some tools to convert the image into data.
i wanna know about what they represent ?
There are a number of barcode symbologies that have different data restrictions. Here's a quick overview of some common ones:
- Code 3 of 9: Alphanumeric data. These are 1D barcodes in that they only have a series of vertical bars to encode the value.
- Code 128: Alphanumeric data. Essentially a replacement for 3 of 9 when more data is required in less space. Also supports a larger character set.
- UPC/EAN/JAN: Numeric data only, these are typically used for consumer products and inventorying in retail.
- PDF417: Any data. This is a stacked 2D format where the "bars" (boxes, actually) run both vertical and horizontal. The encoding is rather extensive, so PDF417 can hold quite a bit of data in a relatively small space. Also includes optional error correction.
- DataMatrix: Any data. Like PDF417 this is a 2D symbology with optional error correction. A benefit of DataMatrix is that it can encode data into a smaller barcoder than PDF417.
- QR: Any data. Like most common 2D symbologies, a large amount of data can be stored in a relatively small space with optional error correction. The biggest benefits of QR are quick recognition and high availability of recognition libraries.
how they are created(with which information) ?
It depends on the symbology. 1D barcodes could be as simple as placing check characters on the end of the value (
"*12345*" for 3 of 9), or as complex as a thorough compaction, encryption, and encoding scheme typically found in the 2D barcodes.
how they are read by our application ?
There are two options, essentially:
Hardware scanning: A physical device captures an image of the barcode and processes it internally, then passes the extracted value to your application. In terms of using these devices it's often as simple as pulling a string in from standard input.
Image recognition: Using a barcode recognition library, you can open an image file on the hard disk and extract barcode information. This makes up the lion's share of how I handle barcodes at work.
does any application can read any barcode ?
Yes. Barcodes aren't voodoo. With the right library you can do recognition in 10 lines or less. Implementing such a library can be vastly more complex though, especially when it comes to 2D barcodes.
There are many kinds of barcodes -- some contain more information than others. RFID contains the most information, such as nearly everything about the product (manufacturer, dates, shipping info, just to name a few). The person or company generating the barcodes determine what information the barcode contains. The most common -- UPC -- contains just numeric digits. Here is more detailed information about UPC and EAN barcodes.
As previously mentioned, you will need some kind of external scanner to read barcodes -- the scanners I worked with send my programs the barcode info as plain text data, usually by stuffing it into the keyboard buffer, or by making API calls to the barcode reader. Those API calls are totally dependent on the manufacturer of the reader -- there is no industry standard. That means you will have to read the programming docs for the readers you have or will have.
One of the most common industrial style external barcode readers is made by Symbols Technologies -- and they can cost anywhere from $30.00 USD to over $500.00 USD.