Skip to content

Instantly share code, notes, and snippets.

@StrikingLoo
Created June 2, 2019 18:38
Show Gist options
  • Select an option

  • Save StrikingLoo/52fce394dbc5f498bd1fed41b4316991 to your computer and use it in GitHub Desktop.

Select an option

Save StrikingLoo/52fce394dbc5f498bd1fed41b4316991 to your computer and use it in GitHub Desktop.
import numpy as np
np_im = pixels_from_path(file_path) #load the image as numpy matrix
pixels = vector_of_pixels(np_im) #turn it into a single vector
np.unique(pixels).shape # count unique pixel values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment