Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. def find_rectangles_that_match_dict(rectangles, match_dict):
  2. matching_rectangles = []
  3. for r in rectangles:
  4. x,y,w,h = r
  5. x_start, x_end = match_dict['x']
  6. y_start, y_end = match_dict['y']
  7. w_start, w_end = match_dict['w']
  8. h_start, h_end = match_dict['h']
  9. if is_between(x, x_start, x_end) and \
  10. is_between(y, y_start, y_end) and \
  11. is_between(w, w_start, w_end) and \
  12. is_between(h, h_start, h_end):
  13. matching_rectangles.append(r)
  14. return matching_rectangles
  15.  
  16. def letter_dict():
  17. return {'x': [0, 200],
  18. 'y': [0, 500],
  19. 'w': [50, 175],
  20. 'h': [20, 40]}
  21.  
  22. def date_dict():
  23. return {'x': [1200, 1400],
  24. 'y': [0, 500],
  25. 'w': [75, 175],
  26. 'h': [20, 40]}
  27.  
  28. def name_dict():
  29. return {'x': [1500, 4000],
  30. 'y': [0, 500],
  31. 'w': [800, 1400],
  32. 'h': [50, 4000]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement