I wrote a small piece of code that gives me hue values for a set of images in a folder. My goal is to create a hue-histogram much like in this article: http://blog.scottlogic.com/2014/04/12/app-colour-analysis.html
I'm currently collecting the data, but I'm only getting 0.0s, 60.0s, 120.0s, 180.0s, 240.0s, 300.0s values from a set of +5000 images. I heard hue goes from 0 to 360 and in the article, it looks like he gets 0.0s, 1.0s, 2.0s, 3.0s... etc. How? What is wrong with my code?
from PIL import Image
import _imaging
import colorsys
import os
h = 0
for file in os.listdir("/path/"):
im = Image.open(file)
width, height = im.size
rgb_im = im.convert('RGB')
widthRange = range(width)
heightRange = range(height)
for i in widthRange:
for j in heightRange:
r, g, b = rgb_im.getpixel((i, j))
h, s, v = colorsys.rgb_to_hsv(r, g, b)
h = h * 360
# Rest of code stores h value for each pixel with a counter
"h" should be the HUE value for every pixel, it's all stored in a file.