문제

My question is why are the two histograms in following code the same. Because the picture does change, first show shows original picture and second shows completely black picture.

Am I miss-using simpleCV or is this perhaps a bug?

Code:

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
도움이 되었습니까?

해결책

When was the last time you did a pull from the develop github repo? There was a bug in the set item call for the image class that kept images from getting set directly. It was fixed a couple weeks ago. Generally you should try to avoid directly looping over image objects and setting pixels directly as it can be really slow. If you think you found a bug please submit an issue to our github repo and we will try to address it as soon as we can.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top