Why must there be a barcode on bottles/cans for them to be accepted?

The barcodes allow the reverse vending machines to differentiate between plastic bottles and aluminium cans which are then sorted into different compartments within the machine. The barcodes also allow the machine to determine if a container is empty by cross referencing the weight of the container deposited versus its weight stored in a database.