1 pièce(s) jointe(s)
Point Detection and Line Detection
Bon soir a tous les membres du forum,
J'ai des problemes de compilation des codes des fonction PointDetect and LinDetect sous Matlab (message erreur pendant execution).
Quelqu'un voudra bien analyser mes lines pour savoir ce qui n'a pas marcher.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| function pointDetect(filename,number)
f=imread('amie.jpg');
imshow(f);title('imOriginal')
[widdth,height]=size(f);
%h=zeros(width,height);
if number>width*height
number=width*height;
end
df=im2double(f);
%display df
figure, imshow(df), title('doublef');
w=[-1 -1 -1;-1 8 -1;-1 -1 -1];
g=imfilter(df,w);
%display g
figure, imshow(g), title('df filtering');
g=abs(g)./8;
figure, imshow(g), title('gabs');
[data index]=sort(g(:));
T=data(width*height-number+1);
for i=1:width
for j=1:height
if g(i,j)>=T
h(i,j)=1;
end
end
end
figure,imshow(h) |
***********************************************
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| function LineDetect(fileName, direction)
f=imread('blobs.png'); %image fournie dans la toolbox Image Processing
figure, imshow(f), title('blobs');
[width,height]=size(f);
number=100;
h=zeros(width,height);
if number>width*height
number=width*height;
end
df=im2double(f);
figure, imshow(df)
switch direction
case 0
w=[-1 -1 -1;4 4 4;-1 -1 -1];
case 45
w=[-1 -1 4;-1 4 -1;4 -1 -1];
case 90
w=[-1 4 -1;-1 4 -1;-1 4 -1];
case 135
w=[4 -1 -1;-1 4 -1;-1 -1 4];
otherwise
w=[-1 -1 -1;4 4 4;-1 -1 -1];
end
g=imfilter(df,w);
g=abs(g)./4;
[data index]=sort(g(:));
T=data(width*height-number+1);
for i=1:width
for j=1:height
if g(i,j)>=T
h(i,j)=1;
end
end
end
figure,imshow(h) |
voici l'image utilisée pour la première fonction en attachement.