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
| clc clear all;
High_im = imread('C:\Users\雷子\Desktop\桌面文件\SVMDW\2020_8_20_9_46_22_303_H.bmp'); Low_im = imread('C:\Users\雷子\Desktop\桌面文件\SVMDW\2020_8_20_9_46_22_303_L.bmp');
High_im = High_im(1:1000,50:1000); Low_im = Low_im(1:1000,50:1000); figure(1),subplot(1,2,1),imshow(High_im); subplot(1,2,2),imshow(Low_im);
thersh_H = graythresh(High_im); thersh_L = graythresh(Low_im); High_im_bw = im2bw(High_im,thersh_H); Low_im_bw = im2bw(Low_im,thersh_L);
High_im_bw = ~High_im_bw; Low_im_bw = ~Low_im_bw ; High_im_bw = bwareaopen(High_im_bw,50); Low_im_bw = bwareaopen(Low_im_bw,50); figure(2),subplot(1,2,1),imshow(High_im_bw); subplot(1,2,2),imshow(Low_im_bw);
Low_im_nobord = imclearborder(High_im_bw,4); seD = strel('diamond',1); BWfinal = imerode(Low_im_nobord,seD);
BWfinal= bwareaopen(BWfinal,50); figure(3),imshow(BWfinal);
HD= High_im .* uint8(BWfinal); [m,n] = size(High_im); for i = 1:m for j=1:n if HD(i,j)==0 HD(i,j)=255; end end end figure,imshow(HD,[0,255]);
em_H = double(High_im.*(0)) +mean(mean(High_im(100:200,50:100))); em_L = double(Low_im.*(0)) +mean(mean(Low_im(100:200,50:100)));
figure,imshow(High_im(100:200,50:100));
R_im=(log(double(em_L) ./ double(Low_im)) ) ./ (log(double(em_H) ./ double(High_im)));
R_im_f = R_im .* BWfinal;
for i = 1:m for j=1:n if R_im_f(i,j)==0 R_im_f(i,j)=255; end end end figure,imshow(R_im_f,[0,2]);
R_im_f(find(isnan(R_im_f)==1)) = 10; R_im_f(find(isinf(R_im_f)==1)) = 10;
figure,imagesc(uint8(R_im_f),[0,2]);colorbar colormap jet ;
|