Practice Assignment - Digital Image Processing | ECE 517, Assignments of Digital Signal Processing

Material Type: Assignment; Class: Digital Image Processing; Subject: Electrical and Computer Engr; University: University of Illinois - Chicago; Term: Fall 2006;

Typology: Assignments

Pre 2010

Uploaded on 07/22/2009

koofers-user-p3i
koofers-user-p3i 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 517, Fall 2006 Semester
Matlab function “image_2_squares” segments a 256-by-256 image into 1024 8-by-8
squares, then puts the information of each square into a 64-by-1 column vector; all such
column vectors are output in a matrix that is 64-by-1024:
function B = image_2_squares(A);
% A is assumed to by 256 x 256
B = zeros(64,1024);
for R = 0:31
for C = 0:31
Bcol = 1 + R + C*32;
Arow = R*8;
Acol = C*8;
B(:,Bcol) = reshape(A(Arow+[1:8],Acol+[1:8]),64,1);
end
end
return
Matlab function “squares_2_image” takes the 64-by-1024 matrix produced by the
function described above and reorganizes it back into 256-by-256 original image format:
function A = squares_2_image(B);
% B is assumed to by 64 x 1024
A = zeros(256,256);
for Bcol = 1:1024
C = floor((Bcol-1)/32);
R = (Bcol-1) - C*32;
Arow = R*8;
Acol = C*8;
A(Arow+[1:8],Acol+[1:8]) = reshape(B(:,Bcol),8,8);
end
return
pf2

Partial preview of the text

Download Practice Assignment - Digital Image Processing | ECE 517 and more Assignments Digital Signal Processing in PDF only on Docsity!

ECE 517, Fall 2006 Semester

Matlab function “image_2_squares” segments a 256-by-256 image into 1024 8-by-

squares, then puts the information of each square into a 64-by-1 column vector; all such

column vectors are output in a matrix that is 64-by-1024:

function B = image_2_squares(A);

% A is assumed to by 256 x 256 B = zeros(64,1024); for R = 0: for C = 0: Bcol = 1 + R + C32; Arow = R8; Acol = C8; B(:,Bcol) = reshape(A(Arow+[1:8],Acol+[1:8]),64,1); end end*

return

Matlab function “squares_2_image” takes the 64-by-1024 matrix produced by the

function described above and reorganizes it back into 256-by-256 original image format:

function A = squares_2_image(B);

% B is assumed to by 64 x 1024 A = zeros(256,256); for Bcol = 1: C = floor((Bcol-1)/32); R = (Bcol-1) - C32; Arow = R8; Acol = C8; A(Arow+[1:8],Acol+[1:8]) = reshape(B(:,Bcol),8,8); end*

return

Assignment, due Tuesday October 3:

Load image_data (Lena) and image2_data (Cameraman), these will show up in your

Matlab workspace as 256-by-256 matrices A and B, respectively.

1. For each 8-by-8 subimage in A, find the closest match in B according to

minimum mean-square distance measure; replace the subimage of A with this best

match in B, repeat for all 1024 subimages, and display the result.

2. For each 8-by-8 subimage in A, find the closest match in B according to

normalized correlation similarity measure (resulting in measures over the range

[-1, +1]; replace the subimage of A with this best match in B, repeat for all 1024

subimages, and display the result.

3. Same as (2), except replace the subimage of A with the best match in B after it is

optimally amplitude scaled.

Show all of your Matlab code and display the resulting images.