Skip to content

Commit

Permalink
Faster get masked image
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Apr 12, 2019
1 parent b5f2f1b commit f2fc9c4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions process
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,9 @@ class Context: # pylint: disable=too-many-instance-attributes
raise Exception('The image is None')
if self.mask_ready is None:
return self.image

image = self.image.copy()
for x in range(image.shape[0]):
for y in range(image.shape[1]):
if self.mask_ready[x, y] == 0:
image[x, y] = (255, 255, 255)
image[self.mask_ready == 0] = (255, 255, 255)
return image

def crop(self, x: int, y: int, width: int, height: int) -> None:
Expand Down

0 comments on commit f2fc9c4

Please sign in to comment.