连接 SURF 特征和 Radon 特征来训练 SVM

Concatenate SURF features and Radon Features to train SVM

是否可以连接 2 个 bagoffeatures 对象来训练分类器?

我已经通过以下方式使用 SURF 点训练了一个分类器:

extractorFcn = @SURFBOW;
bag = bagOfFeatures(trainingSets,'CustomExtractor',extractorFcn);

其中 SURFBOW 包含:

[height,width,numChannels] = size(I);
if numChannels > 1
    grayImage = rgb2gray(I);
else
    grayImage = I;
end
multiscaleSURFPoints = detectSURFFeatures(grayImage,'MetricThreshold',100);
features = extractFeatures(grayImage, multiscaleSURFPoints,'Upright',true);
featureMetrics = multiscaleSURFPoints.Metric;

并遵循 Matlab 的示例:http://www.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html?refresh=true

接下来,我做了类似的事情来提取图像的 Radon 特征,而不是使用另一个提取器函数,但使用 RadonBOW(I),如下所示:

[height,width,numChannels] = size(I);
if numChannels > 1
    grayImage = double(rgb2gray(I));
else
    grayImage = double(I);
end



dx = imfilter(grayImage,fspecial('sobel') ); % x, 3x3 kernel
dy = imfilter(grayImage,fspecial('sobel')'); % y
gradmag = sqrt( dx.^2 + dy.^2 );

% mask by disk
R = min( size(grayImage)/2 ); % radius
disk = insertShape(zeros(size(grayImage)),'FilledCircle', [size(grayImage)/2,R] );
mask = double(rgb2gray(disk)~=0);
gradmag = mask.*gradmag;

% radon transform
theta = linspace(0,180,179);
vars = zeros(size(theta));
for u = 1:length(theta)
    [rad,xp] =radon( gradmag, theta(u) );
    indices = find( abs(xp)<R );
    % ignore radii outside the maximum disk area
    % so you don't sum up zeroes into variance
    vars(u) = var( rad( indices ) );
end
features = vars/norm(vars);
featureMetrics = var(features);

我收到了每个公平的结果。无论如何,有没有结合这些来使用氡和 SURF 点训练分类器?

(我也尝试过使用 kmeans 手动执行 Radon BOW 方法,但是,我得到的结果非常糟糕,所以我认为那是不正确的)

谢谢!

当您使用 bagOfFeatures 时,您调用 encode 方法,该方法将图像作为 returns 特征包直方图。您可以将该直方图与同一图像的 Radon 特征连接起来,并对其进行训练。