我的问题是为什么以下代码中的两个直方图相同。因为图片确实发生了变化,第一次显示显示原始图片,第二次显示全黑图片。
我错过了使用 simpleCV 还是这可能是一个错误?
代码:
from itertools import product
from SimpleCV import Image
from SimpleCV import Color
if __name__ == '__main__':
pass
def number_of_hues(picture):
image = Image(picture)
#convert the picture's space to HSV
image = image.toHSV()
image.show()
original_histogram = image.histogram()
(image_x_length, image_y_length) = image.size()
for i,j in product(range(image_x_length), range(image_y_length)):
image[i,j] = Color.BLACK
image.show()
new_histogram = image.histogram()
for o,n in zip(original_histogram, new_histogram):
if o != n:
print o,n