2012-09-12 16 views
0

我是python的新手,因此我需要一些帮助: AIM:我有一个包含10个图像的图像数据库。我想使用色调特征提取器从每张图像中提取色调并将其存储在列表中,并将列表与来自其他图像的色相进行比较,但不属于数据库 现在,此代码对于单个图像适用于我,例如:从simpleCV中的图像数据库提取功能

print __doc__ 
from SimpleCV import* 
from SimpleCV import HueHistogramFeatureExtractor, np 
import numpy as np 
    image1 = ... 
    image2 = ... 

    hue = HueHistogramFeatureExtractor() # define the extractor  
    x = np.array(hue.extract(image1)) # extract features 
    y = np.array(hue.extract(image2)) # extract features 

    xandy = np.sum(np.square(x-y)) # compare extracted features 

    print xandy 

    ('#######################################################') 
    Of course avoiding to write each image seperatly from a database I tried: 

    imageDatabase = "/.../dir/car/" #load image database 
    car_images = ImageSet(imageDatabase) 
    hue = HueHistogramFeatureExtractor() # define the extractor 
    car_hue = [hue.extract(car_images) for c in car_image] # extract hue features from image database??? 
    print hue # print hue feature list 

我在正确的轨道上吗?请给我工作的方向。

+0

请添加细节。你能指望什么?你遇到什么问题? – Macmade

回答

1

所以色相直方图提取器提取色相的直方图,而不是一个单一的平均色调值(它似乎是你想要做的)。你有没有尝试过meanColor?此外,如果您使用SimpleCV help forum我们可能能够更好地支持您的问题。