2012-09-12 18 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我們可能能夠更好地支持您的問題。