-
Notifications
You must be signed in to change notification settings - Fork 0
/
activetester.m
79 lines (58 loc) · 1.51 KB
/
activetester.m
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
clear all;
DIRECTORY = 'C:\\Users\\rramele\\Google Drive\\ATI.Image.Processing\\Videos\\movie1\\movie1\\';
FILENAMEMASK='PIC00%03d.jpg'
NUMBEROFFRAMES=268;
% Parámetros del pixel central.
X=159;
Y=179;
R=8;
Lin = [];
Lout = [];
FI=[];
% Dibujo el círculo con la región inicial.
r=R;x=X;y=Y;
ang=0:0.01:2*pi;
for i=ang
Lin = [Lin ;[ceil(x+r*cos(i)) ceil(y+r*sin(i))]];
end
r=R+1;x=X;y=Y;
ang=0:0.01:2*pi;
for i=ang
Lout = [Lout ;[ceil(x+r*cos(i)) ceil(y+r*sin(i))]];
end
% Reordenar los dos vectores de pixels.
Lout=unique(Lout,'rows','stable');
Lin=unique(Lin,'rows','stable');
% Cargo la imagen la convierto a ESCALA DE GRISES
I = imread( sprintf( '%s\\%s', DIRECTORY, sprintf(FILENAMEMASK,1) ));
I = I (:,:,1);
imshow(redrawI(I,Lin,Lout));
FI=ones(size(I,1),size(I,2))*3;
PixelIn=[];
PixelOut=[];
for x=1:size(I,1)
for y=1:size(I,2)
P=[x; y];
isInLout = find(Lout(find(Lout(:,1)==P(1)),2)==P(2) );
isInLin = find(Lin (find(Lin (:,1)==P(1)),2)==P(2) );
if (isinterior(I,Lin,Lout, P))
FI(x,y) = -3;
PixelIn = [PixelIn I(x,y)];
elseif (size(isInLout,1)>0)
FI(x,y) = 1;
elseif (size(isInLin,1)>0)
FI(x,y) = -1;
else
PixelOut = [PixelOut I(x,y)];
end
end
end
imshow(redrawI(I,Lin,Lout));
Na = 5;
epsilon = 10;
Ng = 3;
baseAvg = mean(PixelIn);
mediai=mean(double(PixelIn));
sigmai = std(double(PixelIn));
mediao=mean(double(PixelOut));
sigmao = std(double(PixelOut));