Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- background_color = np.array([255, 255, 255], dtype=np.uint8)
- foreground = image != background_color
- foreground = np.zeros(shape=(height, width, 1), dtype=np.bool)
- for y in range(height):
- for x in range(width):
- if not np.array_equal(image[y, x], background_color):
- foreground[y, x] = True
Add Comment
Please, Sign In to add comment