-
Notifications
You must be signed in to change notification settings - Fork 0
/
KI_CD.m
67 lines (51 loc) · 1.32 KB
/
KI_CD.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
%%
% This code is based on the Kittler– Illingsworth method
% please refer to the next bibtex:
%@article{kittler1986minimum,
% title={Minimum error thresholding},
% author={Kittler, Josef and Illingworth, John},
% journal={Pattern recognition},
% volume={19},
% number={1},
% pages={41--47},
% year={1986},
% publisher={Elsevier}
%}
%%
clear all
close all
clc
warning off
addpath(genpath(pwd))
%% Initialization
%________________ lake data ___________
%load('mulargia_95_96.mat')
%load('fire_2013.mat')
%load('alaska_dataset')
%load('Madeirinha_dataset')
%load('katios_dataset')
%load('dique_dataset')
%load('SF_dataset')
%load('Wenchuan_dataset')
%load('canada_dataset')
load('california_flood')
%load('contest_dataset')
I = double(before);
Aspot = double(after);
clear lake lakef before after;
%________________ contest data ___________
%load('data_contest.mat')
%_________________Magnitude of difference _______________
ro = sqrt((I(:) - Aspot(:)).^2);
T = kittler(ro);
idx_w1 = ro <= T;
idx_w2 = ro > T;
W1 = ro(idx_w1);
W2 = ro(idx_w2);
change_map = ro;
change_map(idx_w1) = 0;
change_map(idx_w2) = 1;
[m_c n_c] = size(Aspot);
figure, imshow(reshape(ro,m_c,n_c)), colorbar
change_map_KI = reshape(change_map,m_c,n_c);
figure, imshow(change_map_KI), colorbar