pwd

ls

path

help addpath

% Look at function test

test(3,4)

% Images

dog = imread('dog1.jpg');

figure

image(dog);

axis equal

dogbw = rgb2gray(dog);

figure

imagesc(dogbw);

colormap(gray)

imagesc(imrotate(dogbw,45,'bilinear'));

size(dogbw)

imagesc(dogbw)
 
% We can zoom in on the nose

% Look at the raw pixel values.

for i = 170:190, for j=200:220, fprintf(1,'%3.3d ', double(dogbw(i,j))); end, fprintf(1,'\n'); end

dogbw(170:200,215)'

% or plot them.

figure

plot(dogbw(170:200,215))

size(dog)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Averaging demo

S = zeros(100,100);

S(40:60,40:60) = 1;

imagesc(S)

N = .1*randn(100,100);

imagesc(N)

I = S+N;

imagesc(I)

A = fspecial('average', 3)

O = conv2(A,I);

imagesc(O)

A = fspecial('average', 9)

O = conv2(A,I);

imagesc(O)

% Filtering and structure

G = fspecial('gaussian', 9, .5);

imagesc(conv2(G,I))

G = fspecial('gaussian', 9, 1.5);

imagesc(conv2(G,I))

G = fspecial('gaussian', 9, 3);

imagesc(conv2(G,I))

G = fspecial('gaussian', 18, 6);

imagesc(conv2(G,I))

G = fspecial('gaussian', 36, 12);

imagesc(conv2(G,I))

G = fspecial('gaussian', 9, .5);

imagesc(conv2(G,dogbw))

G = fspecial('gaussian', 9, 1.5);

imagesc(conv2(G,dogbw))

G = fspecial('gaussian', 9, 3);

imagesc(conv2(G,dogbw))

G = fspecial('gaussian', 18, 6);

imagesc(conv2(G,dogbw))

G = fspecial('gaussian', 36, 12);

imagesc(conv2(G,dogbw))

% Subsampling

A = zeros(100,100);

for i = 40:42 for j = 10:90 A(i,j) = 1; end, end

B = imrotate(A, 45);

imagesc(B)

imagesc(B(1:4:100,1:4:100))

G = fspecial('gaussian', 9, 3);

C = conv2(G,B);

imagesc(C)

imagesc(C(1:4:100,1:4:100))