Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. import cv2
  2. import copy
  3. import time
  4. image = cv2.imread("/Users/matijakrivosic/Documents/JOB/ParkingLotDetection/image.jpg")
  5. cv2.imshow("image", image)
  6.  
  7. tuple_list = [(100, 120), (20, 30)]
  8. """Pritiskom na slovo m ulazi se u funkciju u kojoj se kordinate pomicu sa wsad izlazi se iz
  9. te funkcije s pritiskom na m i isto tako se ponovo ulazi u modifikacije"""
  10. def move_points(tuple_list):
  11.  
  12. new_tup = []
  13.  
  14. while True:
  15.  
  16. key = cv2.waitKey()
  17. print(key)
  18.  
  19. if key == ord('w') or key == 56:
  20. print("W")
  21. for tup in tuple_list:
  22. x, y = tup
  23. x = x - 1
  24. new_tup.append((x, y))
  25.  
  26. tuple_list = copy.copy(new_tup)
  27. new_tup = []
  28. print(tuple_list)
  29.  
  30. elif key == ord('s') or key == 50:
  31. print("S")
  32. for tup in tuple_list:
  33. x, y = tup
  34. x = x + 1
  35. new_tup.append((x, y))
  36.  
  37. tuple_list = copy.copy(new_tup)
  38. new_tup = []
  39. print(tuple_list)
  40.  
  41. elif key == ord('a') or key == 52:
  42. print("A")
  43. for tup in tuple_list:
  44. x, y = tup
  45. y = y - 1
  46. new_tup.append((x, y))
  47.  
  48. tuple_list = copy.copy(new_tup)
  49. new_tup = []
  50. print(tuple_list)
  51.  
  52. elif key == ord('d') or key == 54:
  53. print("D")
  54.  
  55. for tup in tuple_list:
  56. x, y = tup
  57. y = y + 1
  58. new_tup.append((x, y))
  59.  
  60. tuple_list = copy.copy(new_tup)
  61. new_tup = []
  62. print(tuple_list)
  63.  
  64. if key == ord('m'):
  65. break
  66.  
  67. print(tuple_list)
  68.  
  69. while True:
  70. k = cv2.waitKey()
  71. if k == ord('m'):
  72. print("Ušo sam u fine tuning")
  73. move_points(tuple_list)
  74. print("Izašao sm iz fine tuning-a")
  75. continue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement