Ask Your Question

Special color histogram in SimpleCV

asked 2013-03-10 09:41:00 -0500

ak83 gravatar image

I need to cunstruct color histogram (using HSV color space) in SimpleCV, the problem is that the histogram needs cointain only colors where saturation and brightness are over certain level (which is different of each channel). How do I achieve this?

Though I have already asked this question on stackOverflow, and use of openCV function inRange was suggested. However, by logic filtering histogram seems quite usefull function. So I assume it is simpleCV has a simple way of achieving this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-03-13 17:35:13 -0500

ak83 gravatar image

I have another question. In the following code, why are the histograms the same? Because when I display picture where I changed all the pixels to black color, it does display a black picture, however both original and changed picture produce the same histogram. Why is that?

from itertools import product from SimpleCV import Image from SimpleCV import Color

if name == 'main': pass

def numberofhues(picture): image = Image(picture)

#convert the picture's space to HSV
image = image.toHSV()
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

new_histogram =  image.histogram()

for o,n in zip(original_histogram, new_histogram):
    if o != n:
        print o,n
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-03-10 09:41:00 -0500

Seen: 623 times

Last updated: Mar 13 '13