Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc; clear; close all;
- P = imread('rice.tif');
- P = double(P)/255;
- k = 1;
- k2 = 100;
- P = P(k2:k2+99,k:k+99);
- P3 = P;
- Mur = zeros(100,100);
- value = 0.4;
- for n = 10:40,
- Mur(9, n) = value;
- Mur(10, n) = value;
- Mur(11, n) = value;
- Mur(39, n) = value;
- Mur(40, n) = value;
- Mur(41, n) = value;
- Mur(n, 9) = value;
- Mur(n, 10) = value;
- Mur(n, 11) = value;
- Mur(n, 39) = value;
- Mur(n, 40) = value;
- Mur(n, 41) = value;
- end
- h = fspecial('gaussian', 3, 3);
- %Mur = imfilter(Mur, h);
- figure(1);
- imshow(Mur)
- P = Mur + P;
- figure(2);
- mesh(P)
- colormap(gray)
- size = 0;
- for i = 0:1000000
- se = strel('line',mod(i, 100),90);
- P_tophat=imtophat(P,se);
- se2 = strel('line',mod(i,100),0);
- P_tophat2=imtophat(P,se2);
- P2 =im2bw(P_tophat+P_tophat2, 0.8);
- figure(3);
- imshow(P2 + P3)
- pause(0.02);
- end
Advertisement
Add Comment
Please, Sign In to add comment