Yes, you would need to digitize the barcode and opencv sounds as good as any. It may have a barcode parser.
To do it yourself you would first need to determine the barcode symbology
There is a phone app called Barcode Data Decoder which will do this.
assuming a 2D symbology, barcodes usually have a start and a stop sequence. Barcode characters are made up of bars and spaces. These are defined as being multiples of the narrow bar width. If you are generating barcodes on a Zebra ZPL printer like I do, the narrow bar is defined as being 1,2 or 3 pixels wide (@203 dpi). Wider barcodes are easier to read. 1 pixel wide narrow bar is nearly impossible to read.
So then you can study up on your symbology and understand its structure.
If you are choosing the symbology, CODE39 is probably the easiest to parse at a low level but its not very compact. Code 128 is more compact but harder to parse. ref:
en.wikipedia.org/wiki/Code_39