one to many matching in matlab

3 views (last 30 days)
annmaria
annmaria on 24 Jul 2015
I have two folders. I want to find the hierarchicalCentroid of the first image in the folder1 and all the images in the folder 2,then calculate the dist_1_2 between the image in folder1 and each image in the folder2,then find the minimum distance and display it . Again calculate the hierarchicalCentroid of the second image in the folder1 and find the distance with each element in the second folder and calculate the minimum distance and so on.. I write one code,But it want some changes. please help me
Dataset='H:\mainproject\codes\letters_numbers';
Testset = 'H:\mainproject\codes\images\test\kk';
plotFlag = 1;
depth = 6;
DataSet = cell([], 1);
for i=1:length(dir(fullfile(Dataset,'*.bmp')))
% Training set process
k = dir(fullfile(Dataset,'*.bmp'));
k = {k(~[k.isdir]).name};
for j=1:length(k)
tempImage = imread(horzcat(Dataset,filesep,k{j}));
imgInfo = imfinfo(horzcat(Dataset,filesep,k{j}));
DataSet{j} = hierarchicalCentroid(tempImage,depth,plotFlag);
%Feature = feature_extractor(image(j));
% DataSet{j} = imresize(hierarchicalCentroid(tempImage),[width height]);
end
end
TestSet = cell([], 1);
for i=1:length(dir(fullfile(Testset,'*.bmp')))
% Training set process
k = dir(fullfile(Testset,'*.bmp'));
k = {k(~[k.isdir]).name};
for j=1:length(k)
tempImage = imread(horzcat(Testset,filesep,k{j}));
imgInfo = imfinfo(horzcat(Testset,filesep,k{j}));
TestSet{j} = hierarchicalCentroid(tempImage,depth,plotFlag);
end
end
dist_1_2 = sum((DataSet{j} - TestSet{j}) .^ 2);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!