Skip to content

Instantly share code, notes, and snippets.

@lucidfrontier45
Created July 6, 2015 16:41
Show Gist options
  • Select an option

  • Save lucidfrontier45/96f6e2331f8b0fa751ea to your computer and use it in GitHub Desktop.

Select an option

Save lucidfrontier45/96f6e2331f8b0fa751ea to your computer and use it in GitHub Desktop.
calculate image histogram
def colorHist(img):
size = img.size / 3.0
ret = {}
color = ('b','g','r')
for i,col in enumerate(color):
histr = cv2.calcHist([img],[i],None,[100],[0,256])
ret[col] = histr.flatten() / size
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment