__init__.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # flake8: noqa
  2. from ._io import lblsave
  3. from .image import apply_exif_orientation
  4. from .image import img_arr_to_b64
  5. from .image import img_arr_to_data
  6. from .image import img_b64_to_arr
  7. from .image import img_data_to_arr
  8. from .image import img_data_to_pil
  9. from .image import img_data_to_png_data
  10. from .image import img_pil_to_data
  11. from .image import img_qt_to_arr
  12. from .shape import labelme_shapes_to_label
  13. from .shape import masks_to_bboxes
  14. from .shape import polygons_to_mask
  15. from .shape import shape_to_mask
  16. from .shape import shapes_to_label
  17. from .qt import newIcon
  18. from .qt import newButton
  19. from .qt import newAction
  20. from .qt import addActions
  21. from .qt import labelValidator
  22. from .qt import struct
  23. from .qt import distance
  24. from .qt import distancetoline
  25. from .qt import fmtShortcut
  26. import os
  27. def load_barcode_dict():
  28. """Load the barcode dictionary from the utils folder."""
  29. dict_path = os.path.join(os.path.dirname(__file__), "barcode_dict.txt")
  30. try:
  31. with open(dict_path, "r", encoding="utf-8") as f:
  32. characters = f.read().splitlines()
  33. return ["</s>"] + characters # Add special character
  34. except Exception as e:
  35. raise FileNotFoundError(f"Error loading barcode_dict.txt: {e}")