-
-
Save amankharwal/33242b5cbe6abd41c806ca71fbd07866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def read_barcodes(frame): | |
barcodes = pyzbar.decode(frame) | |
for barcode in barcodes: | |
x, y , w, h = barcode.rect | |
barcode_info = barcode.data.decode('utf-8') | |
cv2.rectangle(frame, (x, y),(x+w, y+h), (0, 255, 0), 2) | |
font = cv2.FONT_HERSHEY_DUPLEX | |
cv2.putText(frame, barcode_info, (x + 6, y - 6), font, 2.0, (255, 255, 255), 1) | |
with open("barcode_result.txt", mode ='w') as file: | |
file.write("Recognized Barcode:" + barcode_info) | |
return frame |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment