A Gocv and Zbar example for detecting and reading barcodes on webcam.
First you need to install GoCV library, which depends on opencv
GoCv installation instructions is well documented in their website:
After you installed the GoCv, you need to install zbar and get the Go wrapper for zbar as shown below:
Installing zbar can be tricky you migth want to check out below:
go get github.com/bieber/barcode
Then you can clone this repo and run it
git clone https://github.com/unicod3/realtime-barcode-detector.git rbd
cd rbd
go run main.go
# or to specify the device id:
go run main.go --device-id 1234
Then you can show your code128 barcodes to your cam.
It will open your default webcam since the device id set to zero.