我是 python 新手,因此我需要一些帮助: AIM:我有一个包含 10 张图像的图像数据库。我想使用色调特征提取器从每个图像中提取色调并将其存储在列表中,并将列表与不属于数据库的其他图像的色调进行比较现在此代码对我来说适用于单个图像,例如:
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
我在正确的轨道上吗?请给我工作的方向。