Info

This question is closed. Reopen it to edit or answer.

Find the distance between images which are saved in cell array form

1 view (last 30 days)
Iout is a binary image.After finding its connected component I want to find the images which are matched to these connected component using the distance.In the code given below vect1 and vect2 are present in which vect1 contain 1*11 cell and vect2 contain 1*22 cell array.Each cell contain 1*124 size numeriacal data. After finding the step sum((vec1{n} - vec2{ii}) .^ 2) , 'dist_1_1{ii}' must contain 1*22 cell array But it contain only 1*22 size data. After that I want to found the minimum distance in each cell.But I can't do that. What is the problem present in the code.Can anybody please help me to solve this problem.
Iout=imread('pic.jpg');
[Ilabel num] = bwlabel(im2bw(Iout));
plotFlag = 1;
depth = 6;
A=[];
vec2=[];
dist_1_1=[];
n=cell([], num);
m=[];
I=[];
for n=1:num
[r,c] = find(Ilabel==n);
% Extract letter
n1=Iout(min(r):max(r),min(c):max(c));
n1=discourser(n1);
n1=uint8(n1);
threshold = graythresh(n1);n1 =im2bw(n1,threshold);
img_r=imresize(n1,[42 24]);
figure,imshow(img_r);
alef1=img_r;
vec1{n}= hierarchicalCentroid(alef1,depth,plotFlag);
% figure,imshow(vec1);
for ii=1:22
A{ii} = imread(['image' num2str(ii) '.bmp']);
% subplot(1,3,2);
vec2{ii} = hierarchicalCentroid(A{ii},depth,plotFlag);
dist_1_1{ii} = sum((vec1{n} - vec2{ii}) .^ 2);
ll=vertcat(dist_1_1{ii});
[m{ii},I{ii}]=min(cell2mat(dist_1_1{ii}));
end
end

Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!