I'm trying to use the library to decode Code93 barcodes but the library is not being able to detect it. I looked at the source code and apparently it's able to scan this type of barcode. Is there something wrong with my environment or the way I'm using the library?
I am using the version 0.1.8 of pyzbar along with python 3.7.3 and load using:
from pyzbar import pyzbar
from pyzbar.pyzbar import ZBarSymbol
barcodes = pyzbar.decode(cv2.imread(pic_path), symbols=[ZBarSymbol.CODE93])
The image I am using:
I know this is detectable because this website can read normally.
You're using the library OK, but your image needs some pre-processing to make the bar-code readable. You need to increase the contrast between the black and white bars, which can be done using a threshold filter to binarize the image before passing it to pyzbar. This example, using the OpenCV library, worked for me with your sample image:
import cv2
from pyzbar.pyzbar import decode
from pyzbar.pyzbar import ZBarSymbol
pic_path = "UNENg.png"
# preprocessing using opencv
im = cv2.imread(pic_path, cv2.IMREAD_GRAYSCALE)
ret, bw_im = cv2.threshold(im, 127, 255, cv2.THRESH_BINARY)
# zbar
barcodes = decode(bw_im, symbols=[ZBarSymbol.CODE93])
There are some alternative pre-processing methods in the answer to Preprocessing images for QR detection in python which might also be helpful.