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
| % Initialisations
clear all;
close all;clc ;
% Lecture de l'image originale.
I = imread(' im.bmp');
I=double(I);
[n,m]=size(I);
s3=0;s4=0;
w=20;
f=round(m/w);
for i=1:n-2
for j=1:w:m-2
s1=-I(i,j)+I(i,j+2)-2*I(i+1,j)+2*I(i+1,j+2)-I(i+2,j)+I(i+2,j+2);
s2=I(i,j)+2*I(i,j+1)+I(i,j+2)-I(i+2,j)-2*I(i+2,j+1)-I(i+2,j+2);
s3=s3-2*s1*s2;
s4=s4+(s2^2-s1^2);
s5=0.5*atand(s3/s4);
if s4<0
s5=s5+90;
elseif s4>=0
if s3<0
s5=s5+180;
else
end
else
end
for p=1:f
T(p)=s5;
end
end
end
T |
Partager