Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find all color in image python

>>> from PIL import Image
>>> im = Image.open('polar-bear-cub.jpg')
>>> from collections import defaultdict
>>> by_color = defaultdict(int)
>>> for pixel in im.getdata():
...     by_color[pixel] += 1
>>> by_color
defaultdict(<type 'int'>, {(11, 24, 41): 8, (53, 52, 58): 8, (142, 147, 117): 1, (121, 111, 119): 1, (234, 228, 216): 4
Comment

PREVIOUS NEXT
Code Example
Python :: find different between list 
Python :: how to do swapping in python without 
Python :: count elements in list 
Python :: Randint Random Library 
Python :: python how to make notepad 
Python :: size of the query process in python BigQuery 
Python :: replace column values/create new column based on another column values/condition in Pandas 
Python :: cv2.namedWindow 
Python :: python isnan 
Python :: how to convert the date column from string to a particular format in python 
Python :: python grid 
Python :: effektivwert python 
Python :: Python Program to Find Armstrong Number in an Interval 
Python :: Image Watermarking in python 
Python :: tensor vs numpy array 
Python :: print dictionary of list 
Python :: how to remove a tuple from a list python 
Python :: python how to calculate how much time code takes 
Python :: python dataframe replace nan with 0 
Python :: distance between numpy arrays 
Python :: np where nan 
Python :: python byte string 
Python :: initialise a 2d array python 
Python :: fork function in python 
Python :: django create object with default today date 
Python :: create requirement .txt 
Python :: Python How To Check Operating System 
Python :: python grouped bar chart 
Python :: list from comma separated string python 
Python :: slicing of tuple in python 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =