Guest User

Untitled

a guest
Aug 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. background_color = np.array([255, 255, 255], dtype=np.uint8)
  2.  
  3. foreground = image != background_color
  4.  
  5. foreground = np.zeros(shape=(height, width, 1), dtype=np.bool)
  6. for y in range(height):
  7. for x in range(width):
  8. if not np.array_equal(image[y, x], background_color):
  9. foreground[y, x] = True
Add Comment
Please, Sign In to add comment