Is it possible to concatenate 2 bagoffeatures objects to train a classifier?
I have trained a classifier using SURF points by the following :
extractorFcn = @SURFBOW;
bag = bagOfFeatures(trainingSets,'CustomExtractor',extractorFcn);
where SURFBOW contains :
[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;
and followed Matlab's example : http://www.mathworks.com/help/vision/examples/image-category-classification-using-bag-of-features.html?refresh=true
Next, i have done something similar to extract the Radon Features of the image instead using another extractor function but with RadonBOW(I) as follows :
[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);
I receive fair results with each. is there anyway to combine these to train the classifier using both the radon and SURF points?
(I have also tried to do the Radon BOW method manually by use of kmeans, however, i got extremely poor results, so I believe that was incorrect)
Thank you!