Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %function burningsDetection
- function bue
- preband5 = imread("preB05.tiff"); %band5 (NIR)
- preband7 = imread("preB07.tiff"); %band7 (SWIR)
- postband5 = imread("postB05.tiff"); %band5
- postband7 = imread("postB07.tiff"); %band7
- pNIR_pre = double(preband5);
- pSWIR_pre = double(preband7);
- SWVI_pre = (pNIR_pre - pSWIR_pre)./(pNIR_pre + pSWIR_pre);
- pNIR_post = single(postband5);
- pSWIR_post = single(postband7);
- SWVI_post = (pNIR_post- pSWIR_post)./(pNIR_post + pSWIR_post);
- [n1, m1] = size(SWVI_pre); % n1 - stroki
- [n2, m2] = size(SWVI_post); % m1 - stolbcy
- if n1 ~= n2 || m1 ~= m2
- PP = checkIfEqual(SWVI_pre, n1, m1 SWVI_post, n2, m2);
- SWVI_pre = PP{1};
- SWVI_post = PP{2};
- endif
- DSWVI = SWVI_pre - SWVI_post;
- figure,
- imagesc(DSWVIC)
- %colorbar
- %colormap(jet)
- print -dpng -r300 SWVI_pre_1346.png
- %fire_calculate
- end
- function PP = checkIfEqual(pre, n1, m1 post, n2, m2)
- h = abs(n1-n2)
- w = abs(m1-m2)
- if n1 < n2
- post = post(1:n2-h, :);
- flag = 1;
- elseif n1 > n2
- pre = pre(1:n1-h, :);
- flag = 2;
- endif
- if m1 < m2
- post = post(:, m2:m2+w-1);
- flag = 3;
- elseif m1 > m2
- pre = pre(:, m1:m1+w-1);
- flag = 4;
- endif
- PP = {pre; post};
- endfunction
- function fire_calculate
- Square = 76100;
- pict = imread("kalmykia_fire.png");
- [n, m] = size(pict);
- all = n*m;
- white = length(find(pict==255));
- black = length(find(pict==0));
- no_white = all - black - white;
- fract = no_white/white;
- Percent = fract*100;
- Territory = Square*fract;
- disp(Territory);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement