Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

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

1 Ansicht (letzte 30 Tage)
annmaria
annmaria am 28 Jul. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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

Antworten (0)

Diese Frage ist geschlossen.

Tags

Noch keine Tags eingegeben.

Community Treasure Hunt

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

Start Hunting!

Translated by