diff --git a/Lecture14/code/edge_detect.m b/Lecture14/code/edge_detect.m new file mode 100644 index 0000000..a1ecd29 --- /dev/null +++ b/Lecture14/code/edge_detect.m @@ -0,0 +1,30 @@ +I=imread('pic4.png'); +I0=rgb2gray(I); +subplot(231); +imshow(I); + +BW1=edge(I0,'Roberts',0.16); +subplot(232); +imshow(BW1); +title('Roberts') + + +BW2=edge(I0,'Sobel',0.16); +subplot(233); +imshow(BW2); +title('Sobel') + +BW3=edge(I0,'Prewitt',0.16); +subplot(234); +imshow(BW3); +title('Prewitt'); + +BW4=edge(I0,'LOG',0.012); +subplot(235); +imshow(BW4); +title('LOG') + +BW5=edge(I0,'Canny',0.2); +subplot(236); +imshow(BW5); +title('Canny'); \ No newline at end of file diff --git a/Lecture14/code/ld.m b/Lecture14/code/ld.m new file mode 100644 index 0000000..071cdc3 --- /dev/null +++ b/Lecture14/code/ld.m @@ -0,0 +1,13 @@ +f=imread('pic4.png'); +w = [2 -1 -1; -1 2 -1;-1 -1 2 ]; +g = imfilter(double(f),w); +imshow(g) +gtop = g(1:120,1:120); +figure , imshow(gtop) +gbot = g(end-119:end, end-119:end); +figure,imshow(gbot) +g = abs(g); +figure,imshow(g) +T = max (g(:)); +g = g >= T; +figure, imshow(g) diff --git a/Lecture14/code/nns.m b/Lecture14/code/nns.m new file mode 100644 index 0000000..ca9c3e0 --- /dev/null +++ b/Lecture14/code/nns.m @@ -0,0 +1,22 @@ +clear all +close all +clc +p=3;q=5; +I0=imread('pic3.jpg'); +ii=1; +I1=zeros(size(I0,1)*p/q,size(I0,2)*p/q,3); +for i=1:q:size(I0,1)-1 + jj=1; + for j=1:q:size(I0,2)-1 + I1(ii:ii+p-1,jj:jj+p-1,:)=double(I0(i:2:i+q-1,j:2:j+q-1,:)); + jj=jj+p; + endfor + ii=ii+p; +endfor +figure +image(I0) +% truesize +figure +image(uint8(I1)) +% truesize +size(I0),size(I1) \ No newline at end of file diff --git a/Lecture14/code/pic1.jpg b/Lecture14/code/pic1.jpg new file mode 100644 index 0000000..e24c53d Binary files /dev/null and b/Lecture14/code/pic1.jpg differ diff --git a/Lecture14/code/pic2.jpg b/Lecture14/code/pic2.jpg new file mode 100644 index 0000000..f67b742 Binary files /dev/null and b/Lecture14/code/pic2.jpg differ diff --git a/Lecture14/code/pic3-1.png b/Lecture14/code/pic3-1.png new file mode 100644 index 0000000..c214b59 Binary files /dev/null and b/Lecture14/code/pic3-1.png differ diff --git a/Lecture14/code/pic3-2.png b/Lecture14/code/pic3-2.png new file mode 100644 index 0000000..727665a Binary files /dev/null and b/Lecture14/code/pic3-2.png differ diff --git a/Lecture14/code/pic3-3.png b/Lecture14/code/pic3-3.png new file mode 100644 index 0000000..06acba4 Binary files /dev/null and b/Lecture14/code/pic3-3.png differ diff --git a/Lecture14/code/pic3.jpg b/Lecture14/code/pic3.jpg new file mode 100644 index 0000000..782635f Binary files /dev/null and b/Lecture14/code/pic3.jpg differ diff --git a/Lecture14/code/pic4.png b/Lecture14/code/pic4.png new file mode 100644 index 0000000..30bfba1 Binary files /dev/null and b/Lecture14/code/pic4.png differ diff --git "a/Lecture14/\346\225\260\345\255\246\345\273\272\346\250\241\345\215\201\345\233\233\350\256\262-\346\237\245\346\260\270\346\230\245.pptx" "b/Lecture14/\346\225\260\345\255\246\345\273\272\346\250\241\345\215\201\345\233\233\350\256\262-\346\237\245\346\260\270\346\230\245.pptx" new file mode 100644 index 0000000..d8f75e9 Binary files /dev/null and "b/Lecture14/\346\225\260\345\255\246\345\273\272\346\250\241\345\215\201\345\233\233\350\256\262-\346\237\245\346\260\270\346\230\245.pptx" differ