我的问题是,为什么下面代码中的两个直方图是相同的。因为图片确实发生了变化,所以第一次显示的是原始图片,第二次显示的是完全黑色的图片。
是我错过了simpleCV的使用,还是这可能是一个bug?
代码:
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发布于 2013-03-18 07:11:45
你最后一次从开发github库中拉出是什么时候?对image类的set item调用中存在一个bug,该bug阻止直接设置图像。几周前就修好了。一般来说,你应该尽量避免直接在图像对象上循环和直接设置像素,因为它可能会非常慢。如果您认为您发现了错误,请将问题提交到我们的github资源库,我们将尽快解决它。
https://stackoverflow.com/questions/15342868
复制相似问题