display_scenes_info.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # main imports
  2. import os, sys
  3. import argparse
  4. import pickle
  5. # image processing imports
  6. import matplotlib.pyplot as plt
  7. # modules imports
  8. sys.path.insert(0, '') # trick to enable import of main folder module
  9. import custom_config as cfg
  10. from modules.utils import data as dt
  11. # define all scenes values
  12. scenes_list = cfg.scenes_names
  13. def main():
  14. parser = argparse.ArgumentParser(description="Compute and display scenes information")
  15. parser.add_argument('--data', type=str, help="object filename saved using pickle", required=True)
  16. parser.add_argument('--scene', type=str, help="scene name to display click information", required=True, choices=cfg.scenes_names)
  17. args = parser.parse_args()
  18. p_data = args.data
  19. p_scene = args.scene
  20. # load data extracted by zones
  21. fileObject = open(p_data, 'rb')
  22. scenes_data = pickle.load(fileObject)
  23. data = scenes_data[p_scene]
  24. # set title and zone axis
  25. plt.title(p_scene, 'with data :', p_data)
  26. for x_i, x in enumerate(cfg.zone_coodinates):
  27. plt.plot([x_i * 200, x_i * 200], [0, 800], color='red')
  28. for y_i, y in enumerate(cfg.zone_coodinates):
  29. plt.plot([0, 800], [y_i * 200, y_i * 200], color='red')
  30. plt.scatter(data['x'], data['y'])
  31. plt.show()
  32. if __name__== "__main__":
  33. main()