Created
July 14, 2016 09:54
-
-
Save ggarlic/af7951eeba8f631a3031c0c473ab5750 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _find_neg_rect(image, pos_rects): | |
| image_width, image_height = image.shape | |
| rand = partial(random.randint, 1) | |
| while True: | |
| x = rand(image_width - 1) | |
| width = rand(image_width - x) | |
| y = rand(image_height - 1) | |
| height = rand(image_height - y) | |
| random_rect = Rect(x, y, width, height) | |
| if any(map(lambda x: is_same_target(random_rect, x, 0), pos_rect)): | |
| return random_rect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment