I am using zxing-cpp library for reading barcode from image.
import cv2
import zxingcpp
img = cv2.imread('test.jpg')
results = zxingcpp.read_barcodes(img)
for result in results:
print('Found barcode:'
f'\n Valid: "{result.valid}"'
f'\n Text: "{result.text}"'
f'\n Format: {result.format}'
f'\n Content: {result.content_type}'
f'\n Position: {result.position}')
if len(results) == 0:
print("Could not find any barcode.")
However, this library is unable to scan this simple barcode from image.
How can I processes the image and improve quality of image in order to read the barcode?
I used the answer to this question as a guideline, and was still unsuccessful, therefore I am asking this question and seeking help?
With referencing this question and this question I simply increased brightness and contrast of your image. It seem worked for your image. However, you should know that just because this solution worked for this photo is not a guarantee that it will work for every photo you test.I just followed these steps because I found your photo a little dark and blurry. I think these steps can give you an idea about some of the requirements for barcode detection.
And the output is: