Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. from google_images_download import google_images_download
  2. import sys
  3. import cv2
  4. import os
  5. import json
  6. from dbr import DynamsoftBarcodeReader
  7. dbr = DynamsoftBarcodeReader()
  8. dbr.initLicense('LICENSE-KEY')
  9.  
  10. def decodeFile(fileName, templateName=""):
  11. # 1D, PDF417, QRCODE, DataMatrix, Aztec Code
  12. barcodeTypes = 0x3FF | 0x2000000 | 0x4000000 | 0x8000000 | 0x10000000
  13. results = dbr.decodeFile(fileName, barcodeTypes, templateName)
  14.  
  15. for result in results:
  16. print("Format: " + result[0])
  17. print("Value: " + result[1])
  18.  
  19. if __name__ == "__main__":
  20.  
  21. keyword = "barcode on box"
  22. response = google_images_download.googleimagesdownload()
  23.  
  24. arguments = {"keywords": keyword, "limit": 10, "format": "jpg", "usage_rights": "labeled-for-reuse", "time_range": '{"time_min": "01/01/2010", "time_max": "01/01/2019"}'}
  25. paths = response.download(arguments)
  26.  
  27. images = paths[0][keyword]
  28.  
  29. for filename in images:
  30. print("-------------------------------------------------\n")
  31. print(filename)
  32. decodeFile(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement