Skip to content

Commit

Permalink
add lecture 14
Browse files Browse the repository at this point in the history
  • Loading branch information
zoz-cool committed Oct 26, 2019
1 parent 6e4074a commit f3af692
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Lecture14/code/edge_detect.m
Original file line number Diff line number Diff line change
@@ -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');
13 changes: 13 additions & 0 deletions Lecture14/code/ld.m
Original file line number Diff line number Diff line change
@@ -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)
22 changes: 22 additions & 0 deletions Lecture14/code/nns.m
Original file line number Diff line number Diff line change
@@ -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)
Binary file added Lecture14/code/pic1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic3-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic3-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/code/pic4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Lecture14/数学建模十四讲-查永春.pptx
Binary file not shown.

0 comments on commit f3af692

Please sign in to comment.