-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow.m
More file actions
52 lines (46 loc) · 959 Bytes
/
show.m
File metadata and controls
52 lines (46 loc) · 959 Bytes
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
%{
c = Con >= 0.8;
[h,w] = size(c);
[h1,w1,k] = size(Ref);
newCorr =extend(h,w,Corr,c,Sp2,Sp,Seg,max(max(Sp2)),Src,Ref,h1,w1);
shit = newCorr;
newCorr(:,:,1) = newCorr(:,:,1).*c;
newCorr(:,:,2) = newCorr(:,:,2).*c;
%}
c = Con >= 0.8;
[h,w] = size(c);
[h1,w1,k] = size(Ref);
%show result
I = zeros(h,w,1);
I(:,:,1) = newCorr(:,:,1) / w1;
%I(:,:,2) = newCorr(:,:,2) / h1;
%imwrite(I, 'Corr.png');
figure;
imagesc(I);
colorbar;
ref_mask = zeros(h,w);
a = Src / 2 + 0.5;
for i=1:h
for j=1:w
x = round(newCorr(i,j,2));
y = round(newCorr(i,j,1));
if (x > 0 && y > 0 && x < h1 && y < w1)
a(i,j,:)=Ref(x,y,:);
ref_mask(x,y) = 1;
end
end
end
b = Ref / 2 + 0.5;
for i=2:h-1
for j=2:w-1
if ref_mask(i,j) == 1
b(i-1:i+1,j-1:j+1,:) = Ref(i-1:i+1,j-1:j+1,:);
end
end
end
figure;
imshow(a);
figure;
imshow(b);
imwrite(a, 'after-src.png');
imwrite(b,'after-ref.png');