test.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import logging
  2. import os
  3. import cv2
  4. import numpy as np
  5. from image import read_json
  6. # size = np.array([[[500, 501, 502], [600, 601, 602], [100, 101, 102]],
  7. # [[500, 501, 502], [600, 601, 602], [100, 101, 102]],
  8. # [[500, 501, 502], [600, 601, 602], [100, 101, 102]]
  9. # ])
  10. # print(size.shape)
  11. # print(size[..., ::-1])
  12. # img, _, _ = read_json("train/dataset-line/2/train_0.json")
  13. # img.save('train_0.jpg')
  14. # with open('train_463.jpg', 'wb') as f:
  15. # f.write(img)
  16. # print(int(891.999999))
  17. #
  18. # _list = [[1, 2], [2, 3], [3, 4]]
  19. # delete_list = [[1, 2]]
  20. #
  21. # _list.remove(delete_list[0])
  22. # print(_list)
  23. #
  24. # size = (100, 1024)
  25. # image = np.zeros(size[::-1], dtype='uint8')
  26. # cv2.imshow("image", image)
  27. # cv2.waitKey(0)
  28. # image = cv2.imread("8.png")
  29. # ret, binary = cv2.threshold(image, 180, 255, cv2.THRESH_BINARY)
  30. # print("阈值:", ret)
  31. # cv2.imshow("binary", binary)
  32. # cv2.waitKey(0)
  33. # _image = [[1, 0, 1],
  34. # [0, 0, 0]
  35. # ]
  36. # _image = np.array(_image)
  37. # print(np.where(_image >= 1))
  38. # localPath = r"C:\Users\Administrator\Desktop\Test_ODPS\1623857120150.pdf"
  39. # max_file_size_mb = 2
  40. # if os.path.exists(localPath):
  41. # file_size_mb = int(os.path.getsize(localPath)/1024/1024)
  42. # print(file_size_mb)
  43. # if file_size_mb >= max_file_size_mb:
  44. # print("file size > " + str(max_file_size_mb))
  45. _str = "*" * 10
  46. print(_str)