-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathturbidityEst2.m
104 lines (71 loc) · 1.83 KB
/
turbidityEst2.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<<<<<<< HEAD
function tmap=turbidityEst2(J,I,Binf,channel)
=======
function tmap=turbidityEst2(J,I,Binf)
>>>>>>> fd31db4c6c653a74b8a452ac63522d4f505aea68
%[A,I] = double(max(max(I)))./255;
%gauss = fspecial('gaussian',12);
%J = imfilter(J,gauss);
%I = imfilter(I,gauss);
% [posx posy] = Aest(I,15);
<<<<<<< HEAD
I = double(I(:,:,channel))/255;
J = double(J(:,:,channel))/255;
Binf = double(Binf(:,:,channel))/255;
%[H S J ] = rgb2hsv(J);
%[H S Binf ] = rgb2hsv(Binf);
=======
[H S I ] = rgb2hsv(I);
[H S J ] = rgb2hsv(J);
[H S Binf ] = rgb2hsv(Binf);
>>>>>>> fd31db4c6c653a74b8a452ac63522d4f505aea68
%J = double(J)./255;
%I = double(I)./255;
% A = I(posx(1),posy(1));
%A = I(posx,posy);
%B = I - A;
%figure;
%imshow(B);
%C = J - A;
%figure;
%imshow(C)
for i=1:size(I,1)
for j=1:size(J,2)
B(i,j) = I(i,j) - Binf(i,j);
C(i,j) = J(i,j) - Binf(i,j);
tmap(i,j) = max([0.001 B(i,j)/C(i,j)]);
if tmap(i,j) >=1
tmap(i,j) = 0.988;
end
end
end
% tmap = (B./C);
%tmap = B./C;
%tmap = 1- tmap;
%max(max(tmap))
%tmap = tmap./max(max(tmap));
%c = tmap(posx,posy);
%figure
%imshow(tmap);
tmap = - log(tmap);
%figure
%imshow(tmap);
%dmax = max(max(tmap));
%daltMap = tmap./dmax;
%c =
%cmap = tmap./distance;
%imshow(daltMap);
<<<<<<< HEAD
%figure;
%imshow(tmap);
=======
figure;
imshow(tmap);
>>>>>>> fd31db4c6c653a74b8a452ac63522d4f505aea68
%figure
%imshow(cmap);
%t = sum(sum(cmap))/(size(cmap,1)*size(cmap,2));
%c = max(max(cmap));
%figure
%imshow(tmap);
end