i trying write program in python. want resize 2 given images fixed value, (100,100), , compare histograms. why histograms not of same length in case? can make them of same length?
code:
import os,sys pil import image im = image.open('untitled.png') i1 = im.resize((100,100)) im2 = image.open('untitled2.png') i2 = im2.resize((100,100)) x = i1.histogram() y = i2.histogram()
now in shell, when check length of 2 histograms:
>>> len(x) 1024 >>> len(y) 768
why happen after resize them? can make lengths equal, without making exact same image?
the histograms work based on number of color bands image has. if image has more 1 band, histograms bands concatenated (for example, histogram “rgb” image contains 768 values).
try converting image1 rgb
i1rgb = i1.convert('rgb')
Comments
Post a Comment