Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Anaconda-files/Program_18b.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@

fig1 = plt.figure()
plt.imshow(face)
width, height, _ = face.shape
height, width, _ = face.shape

print('Image dimensions: {}x{}'.format(width, height))
white_pixels = np.zeros((width, height))

def white_pixel_filter(pixel, threshold):
return 1 if all(value > threshold for value in pixel) else 0

for i, row in enumerate(face):
for j, pixel in enumerate(row):
white_pixels[i, j] = white_pixel_filter(pixel, threshold=180)
white_pixels = np.all(face > 180, axis=2)

fig2 = plt.figure()
plt.imshow(white_pixels, cmap='gray')
Expand Down