EE 168 Introduction to Digital Image Processing January 30, 2012 HOMEWORK 2 SOLUTIONS

Size: px
Start display at page:

Download "EE 168 Introduction to Digital Image Processing January 30, 2012 HOMEWORK 2 SOLUTIONS"

Transcription

1 EE 168 Introduction to Digital Image Processing January 3, 212 HOMEWORK 2 SOLUTIONS Problem 1: Image Scaling We determine the dimensions of the original image (read from the rodin.raw file) to be 348x261. Figure 1-1 shows a zoomed-in-portion of this image after it is zero-filled-scaled by factors of 2, 3, and 4. Note that as the scale factor increases, more of the pixels are assigned to a value of zero due to zero-filling. As a result, scaling an image by a large factor results in low quality images. Several techniques, including zero-order and first-order hold, can be used to improve image quality. In the zero-order hold algorithm, each zero-filled pixel is replaced by the closest preceding non-zero pixel value. The resulting images are shown in Figure 1-2. Since each zerofilled pixel takes the value of the closest non-zero preceding pixel, repetition of each pixel value for n times (where n is the scaling factor) is observed in cuts through features in the image. Figure 1-3 demonstrates this for the feature located at line and columns 6-7 in the original image. The first-order hold is different in that each zero-filled pixel takes the value of a weighted average of the closest two pixels. The weights are determined by the distance between the zerofilled pixel and the non-zero pixels. Due to this averaging operation, the cuts through features show a piecewise linear variation (Figure 1-5), rather than the piecewise constant variation that we saw with the zero-order hold in Figure 1-3. Note that each of these linear pieces ext for n values (where n is the scaling factor). Original Image Scaled (Zero-fill) by Scaled (Zero-fill) by Scaled (Zero-fill) by Figure 1-1: Effect of Zero-filling on Image Quality: zoomed portions of the scaled images 1

2 Original Image Scaled (Zero-order hold) by Scaled (Zero-order hold) by 3 Scaled (Zero-order hold) by Figure 1-2: Zero-Order hold images 2 Original image 2 Scaled (Zero-order hold) by Scaled (Zero-order hold) by 3 2 Scaled (Zero-order hold) by Figure 1-3: Cuts through a feature (at line, columns 6-7 in the original image) showing change of pixel values 2

3 Original Image Scaled (First-order hold) by Scaled (First-order hold) by 3 Scaled (First-order hold) by Figure 1-4: First-Order hold images 2 Original image 2 Scaled (First-order hold) by Scaled (First-order hold) by 3 2 Scaled (First-order hold) by Figure 1-5: Cuts through a feature (at line, columns 6-7 in the original image) showing change of pixel values 3

4 Problem 2: Image Subsetting and Translation Figure 2-1 shows a subset image of dimensions 1 by 18 from the original rodin.raw image and its insertion into three different locations of a 3 by 4 image. Note that the insertion replaces the corresponding pixel values of the 3 by 4 image with the pixel values of the inserted subset image. Subset Image Figure 2-1: Image Subsetting and Translation Problem 3: Rotations The original image and its rotated versions for rotation angles of 45,, and 67 degrees are shown in Figure 3-1. Note that the rotation is performed by changing the location of the pixel values using the 2 by 2 rotation transformation matrix, provided in the lecture notes. Note that if the origin of the image coordinates is in the upper left corner (and the coordinates are thus increasing downward), the transformation matrix derived in class will operate on the [rowindex column-index] vector rather than the [x y] vector. The rotation problem is different form the other problems in that we are changing the location of the pixels rather than the values that the pixels take. It is observed that the rotation causes black spots in the images due to the rounding that takes place in the algorithm. These spots can be removed by applying techniques similar to a zero-order or first order hold. As an example, the black spots are replaced by the value of the closest preceding non-zero pixel value, as shown in Figure 3-2. Note that the visual quality is significantly higher in Figure 3-2 than it is in Figure

5 Original Image 7 45 Degree Rotation Degree Rotation 67 Degree Rotation Figure 3-1: Image Rotation Original Image 7 45 Degree Rotation Degree Rotation 67 Degree Rotation Figure 3-2: Image Rotation with Zero-Order Hold 5

6 Problem 4: Adding Images Together A subset (dimensions 1 by 18) is taken from the original image and is pasted at three different locations in the original image, as shown in Figure 4-1. Figure 4-2 shows the results from bling the subset image with the original image at the three different locations. Bling is done by assigning the average of the original pixel value and the subset pixel value. Subset Image Figure 4-1: Image Subsetting Subset Image is pasted at 3 different locations within the original Subset Image Figure 4-2: Image Subsetting and Bling Subset Image is bled with the original 6

7 Problem 5: Subtracting to get image change The two original images (from lab2prob5data1 and lab2prob5data2 ) are shown in Figure 5-1. The difference of the two images is shown in Figure 5-2. We see that the two images are mostly similar, except for possibly a slight translation or difference in general illumination levels. The primary difference between the two images is the location of the two cars. These differences are captured and highlighted in the difference image. Hence, difference images can be particularly helpful in finding differences between two images that appear visually alike. Original Image-1 Original Image Figure 5-1: Original Images Difference Image Figure 5-2: Difference Image 7

8 Problem 6: Image Inversion Figure 6-1 compares the image (from lab2prob6data ) and its inverse. Note that the inverse of the image is obtained by subtracting it from 255 since we are using 256 possible gray levels, ranging from to 255. Original Image Inverse Image Figure 6-1: Image Inversion Problem 7: An Unknown Format After opening the file lab2prob7data, we find that it has elements. We know that there is a main header at the beginning of the file, header information at the beginning of each line, and trailer information at the of the file. Because the line-header information will repeat at the beginning of each line, we can find the line-length by plotting the first few thousand elements of the raw data and looking for a repetitive pattern, as shown in Figure 7-1. We note that the line-header repeats every 582 elements, thus the line-length is 582. By zooming in on the beginning of each new cycle, we observe that the line header is 36 elements long and is filled with zeros, except for the 24 th element, which contains line count information. This implies an actual image data length of 546 (582 36). Working backwards from the start of the second line (at element 727), we find that the first line of the image starts at element 145 ( ). This means that we can skip over the first 144 elements (the beginning main header) of the file to get to the image + line-header data. Note that it seems some of the beginning main-header information overlaps with the first line s header. From the line count information contained in column 24 of each line header, we find that there are 691 image lines. Furthermore, if we zoom in on the of the file, we see that the trailer consists of an extra line of zeros. We can then trim out the 36 line-header columns and the 692 nd row to get the final image of Yoda from the Star Wars films, shown in Figure 7-2, which has dimensions 691x546. The final image, with all extraneous bytes removed from the data stream, is then converted to a common raster format (such as tiff, jpeg, gif, etc.). 8

9 2 First elements of raw data Figure 7-1: Plot of first elements in file; reveals the line-length and line-header length Figure 7-2: Final Image of Yoda, with extraneous data removed 9

10 MATLAB code: Question 1: Image Scaling fid = fopen('rodin.raw'); im = fread(fid, [ ], 'uint8'); im = im'; fclose(fid); numrow = size(im, 1); numcol = size(im, 2); %Zero-filled: scale by 2 im_zerofill2 = zeros(2*numrow, 2*numcol); im_zerofill2(1:2:2*numrow, 1:2:2*numcol) = im; %Zero-filled: scale by 3 im_zerofill3 = zeros(3*numrow, 3*numcol); im_zerofill3(1:3:3*numrow, 1:3:3*numcol) = im; %Zero-filled: scale by 4 im_zerofill4 = zeros(4*numrow, 4*numcol); im_zerofill4(1:4:4*numrow, 1:4:4*numcol) = im; % Zero-Order Hold % In the zero-order hold for a scaling factor of n the following steps are taken: % i) form a new all zeros matrix that is nxn times larger than the original matrix. % ii) set every (nxm)th row, (nxl) column element of the new matrix to the mth row, lth column % element of the original matrix % iii) Copy the value in the (nxm)th row, (nxl)th column of this new matrix to its elements in % the (nxm):(nx(m+1))-1 rows and (nxl):(nx(l+1))-1 columns %Zero-order hold: scale by 2 im_zerohold2 = zeros(2*numrow, 2*numcol); im_zerohold2(1:2:2*numrow, 1:2:2*numcol) = im; im_zerohold2(2:2:2*numrow,:) = im_zerohold2(1:2:2*numrow,:); im_zerohold2(:, 2:2:2*numcol) = im_zerohold2(:, 1:2:2*numcol); %Zero-order hold: scale by 3 im_zerohold3 = zeros(3*numrow, 3*numcol); im_zerohold3(1:3:3*numrow, 1:3:3*numcol) = im; im_zerohold3(2:3:3*numrow,:) = im_zerohold3(1:3:3*numrow,:); im_zerohold3(3:3:3*numrow,:) = im_zerohold3(1:3:3*numrow,:); im_zerohold3(:, 2:3:3*numcol) = im_zerohold3(:, 1:3:3*numcol); im_zerohold3(:, 3:3:3*numcol) = im_zerohold3(:, 1:3:3*numcol); %Zero-order hold: scale by 4 im_zerohold4 = zeros(4*numrow, 4*numcol); im_zerohold4(1:4:4*numrow, 1:4:4*numcol) = im; im_zerohold4(2:4:4*numrow,:) = im_zerohold4(1:4:4*numrow,:); im_zerohold4(3:4:4*numrow,:) = im_zerohold4(1:4:4*numrow,:); im_zerohold4(4:4:4*numrow,:) = im_zerohold4(1:4:4*numrow,:); im_zerohold4(:, 2:4:4*numcol) = im_zerohold4(:, 1:4:4*numcol); im_zerohold4(:, 3:4:4*numcol) = im_zerohold4(:, 1:4:4*numcol); im_zerohold4(:, 4:4:4*numcol) = im_zerohold4(:, 1:4:4*numcol); % First-Order Hold % In the first-order hold for a scaling factor of n the following steps are taken: % i) form a new all zeros matrix that is nxn times larger than the original matrix. 1

11 % ii) set every (nxm)th row, (nxl) column element of the new matrix to the mth row, lth % column element of the original matrix % % iii) Zero-filled pixels are replaced by a weighted average of the closest % neighboring pixels. % For a scaling of 2, [a b] becomes [a.5*a+.5*b b] % For a scaling of 3, [a b] becomes [a (2/3)*a+(1/3)*b (1/3)*a+(2/3)*b b] % For a scaling of 4, [a b] becomes [a (3/4)*a+(1/4)*b (2/4)*a+(2/4)*b (1/4)*a+(3/4)*b b] %First-order hold: scale by 2 im_firsthold2 = zeros(2*numrow, 2*numcol); im_firsthold2(1:2:2*numrow, 1:2:2*numcol) = im; im_firsthold2(2:2:2*numrow,:) =.5*im_firsthold2(1:2:2*numrow,:) +.5*[im_firsthold2(3:2:2*numrow,:); zeros(1, 2*numcol)]; im_firsthold2(:, 2:2:2*numcol) =.5*im_firsthold2(:, 1:2:2*numcol) +.5*[im_firsthold2(:, 3:2:2*numcol) zeros(2*numrow, 1)]; %First-order hold: scale by 3 im_firsthold3 = zeros(3*numrow, 3*numcol); im_firsthold3(1:3:3*numrow, 1:3:3*numcol) = im; im_firsthold3(2:3:3*numrow,:) = (2/3)*im_firsthold3(1:3:3*numrow,:) + (1/3)*[im_firsthold3(4:3:3*numrow,:); zeros(1, 3*numcol)]; im_firsthold3(3:3:3*numrow,:) = (1/3)*im_firsthold3(1:3:3*numrow,:) + (2/3)*[im_firsthold3(4:3:3*numrow,:); zeros(1, 3*numcol)]; im_firsthold3(:, 2:3:3*numcol) = (2/3)*im_firsthold3(:, 1:3:3*numcol) + (1/3)*[im_firsthold3(:, 4:3:3*numcol) zeros(3*numrow, 1)]; im_firsthold3(:, 3:3:3*numcol) = (1/3)*im_firsthold3(:, 1:3:3*numcol) + (2/3)*[im_firsthold3(:, 4:3:3*numcol) zeros(3*numrow, 1)]; %First-order hold: scale by 4 im_firsthold4 = zeros(4*numrow, 4*numcol); im_firsthold4(1:4:4*numrow, 1:4:4*numcol) = im; im_firsthold4(2:4:4*numrow,:) = (3/4)*im_firsthold4(1:4:4*numrow,:) + (1/4)*[im_firsthold4(5:4:4*numrow,:); zeros(1, 4*numcol)]; im_firsthold4(3:4:4*numrow,:) = (2/4)*im_firsthold4(1:4:4*numrow,:) + (2/4)*[im_firsthold4(5:4:4*numrow,:); zeros(1, 4*numcol)]; im_firsthold4(4:4:4*numrow,:) = (1/4)*im_firsthold4(1:4:4*numrow,:) + (3/4)*[im_firsthold4(5:4:4*numrow,:); zeros(1, 4*numcol)]; im_firsthold4(:, 2:4:4*numcol) = (3/4)*im_firsthold4(:, 1:4:4*numcol) + (1/4)*[im_firsthold4(:, 5:4:4*numcol) zeros(4*numrow, 1)]; im_firsthold4(:, 3:4:4*numcol) = (2/4)*im_firsthold4(:, 1:4:4*numcol) + (2/4)*[im_firsthold4(:, 5:4:4*numcol) zeros(4*numrow, 1)]; im_firsthold4(:, 4:4:4*numcol) = (1/4)*im_firsthold4(:, 1:4:4*numcol) + (3/4)*[im_firsthold4(:, 5:4:4*numcol) zeros(4*numrow, 1)]; %Plot the zero-fill results figure; colormap(gray); subplot(2,2,1); imagesc(im); axis([ 7 ]); axis('equal') title('original Image') subplot(2,2,2); imagesc(im_zerofill2); axis([ 7 ]); axis('equal'); title('scaled (Zero-fill) by 2') subplot(2,2,3); imagesc(im_zerofill3); axis([ 7 ]); axis('equal'); title('scaled (Zero-fill) by 3') subplot(2,2,4); imagesc(im_zerofill4); axis([ 7 ]); axis('equal'); 11

12 title('scaled (Zero-fill) by 4') %Plot the Zero-order hold results figure; colormap(gray) subplot(2,2,1); imagesc(im); axis('equal') title('original Image') subplot(2,2,2); imagesc(im_zerohold2); axis('equal'); title('scaled (Zero-order hold) by 2') subplot(2,2,3); imagesc(im_zerohold3); axis('equal'); title('scaled (Zero-order hold) by 3') subplot(2,2,4); imagesc(im_zerohold4); axis('equal'); title('scaled (Zero-order hold) by 4') %Plot Cuts through the zero-order-hold scaled images cut_row = ; cut_col = 6; cut_width = 1; figure; colormap(gray) subplot(2,2,1); plot(im(cut_row, cut_col:cut_col+cut_width)); title('original image') subplot(2,2,2); plot(im_zerohold2(2*cut_row-1, (2*cut_col-1):(2*cut_col-1)+2*cut_width)); title('scaled (Zero-order hold) by 2') subplot(2,2,3); plot(im_zerohold3(3*cut_row-2, (3*cut_col-2):(3*cut_col-2)+3*cut_width)); title('scaled (Zero-order hold) by 3') subplot(2,2,4); plot(im_zerohold4(4*cut_row-3, (4*cut_col-3):(4*cut_col-3)+4*cut_width)); title('scaled (Zero-order hold) by 4') %Plot the First-order hold figure; colormap(gray) subplot(2,2,1); imagesc(im); axis('equal') title('original Image') subplot(2,2,2); imagesc(im_firsthold2); axis('equal'); title('scaled (First-order hold) by 2') subplot(2,2,3); imagesc(im_firsthold3); axis('equal'); title('scaled (First-order hold) by 3') subplot(2,2,4); imagesc(im_firsthold4); axis('equal'); title('scaled (First-order hold) by 4') %Plot Cuts through the first-order-hold scaled images cut_row = ; cut_col = 6; cut_width = 1; figure; colormap(gray) subplot(2,2,1); plot(im(cut_row, cut_col:cut_col+cut_width)); title('original image') subplot(2,2,2); plot(im_firsthold2(2*cut_row-1, (2*cut_col-1):(2*cut_col-1)+2*cut_width)); title('scaled (First-order hold) by 2') subplot(2,2,3); plot(im_firsthold3(3*cut_row-2, (3*cut_col-2):(3*cut_col-2)+3*cut_width)); title('scaled (First-order hold) by 3') subplot(2,2,4); plot(im_firsthold4(4*cut_row-3, (4*cut_col-3):(4*cut_col-3)+4*cut_width)); title('scaled (First-order hold) by 4') 12

13 Question 2: Image Subsetting and Translation fid=fopen('rodin.raw'); im = fread(fid,[ ],'uint8'); fclose(fid); im=im'; im_subset=im(51:,11:28); figure; subplot(2,2,1); colormap('gray'); imagesc(im_subset); title('subset Image') axis('image') f=fopen('lab2prob5data1'); im_b =fread(f,[64 37/64],'uint8'); im_b=im_b'; subplot(2,2,2) im_c = im_b(1:3,1:4); im_c(1:1,1:18)=im_subset; imagesc(im_c) subplot(2,2,3) im_c = im_b(1:3,1:4); im_c(11:2,11:28)=im_subset; imagesc(im_c) subplot(2,2,4) im_c = im_b(1:3,1:4); im_c(151:3,11:28)=im_subset; imagesc(im_c) Question 3: Rotations % rot_matrix is the 2 by 2 rotation matrix discussed in class % Pixel locations are changed using rot_matrrix applied to [rot_ind and col_ind]; % round command and an offset of twice the maximum image dimension is used to % avoid fractional or negative indices. % Rotation for 45 degrees is done below. Rotation for the other angles % can be obtained by changing the rot_angle value clear; n_col = 348; n_row = 261; %dimensions of rodin.raw image fid=fopen('rodin.raw'); im = fread(fid,[n_col n_row],'uint8'); fclose(fid); im = im'; figure; imagesc(im); colormap(gray); rot_angle = 45*pi/18; %in radians %rot_angle = *pi/18; %rot_angle = 67*pi/18; rot_mat = [cos(rot_angle) sin(rot_angle); -sin(rot_angle) cos(rot_angle)]; %initialize to negative 1's to distinguish from the black spots in the image offset = 2*max(size(im)); im_rot=-ones(4*max(size(im)), 4*max(size(im))); for row_ind=1:n_row, for col_ind=1:n_col, im_rot(round(rot_mat(1,1)*row_ind+rot_mat(1,2)*col_ind + offset), 13

14 round(rot_mat(2,1)*row_ind+rot_mat(2,2)*col_ind) + offset)=im(row_ind,col_ind); figure; imagesc(im_rot); colormap(gray); axis('equal'); axis('image'); title(['image rotated by ', num2str(rot_angle*18/pi), ' degrees']) % The following part is the zero-order hold operation to avoid % the black spots in the rotated image. im_rot_filled = im_rot; %initialize to the holey rotated image flag_imagerow = zeros(1, size(im_rot,1)); %keep track of which rows the image is on flag_lastimagecol = zeros(1, size(im_rot, 1)); %keep track of last image column for each row for row_ind = 1:size(im_rot, 1), for col_ind = 1:size(im_rot, 2), if im_rot(row_ind, col_ind) > -1, flag_imagerow(row_ind) = 1; flag_lastimagecol(row_ind) = col_ind; %will overwrite until reaches last col %fill the image with the nearest 'non-zero' pixel value to the left along the row for row_ind = 1:size(im_rot, 1), if flag_imagerow(row_ind) == 1, for col_ind = 2:size(im_rot, 2), if im_rot_filled(row_ind, col_ind) == -1, if col_ind < flag_lastimagecol(row_ind), im_rot_filled(row_ind, col_ind) = im_rot_filled(row_ind, col_ind-1); figure; imagesc(im_rot_filled); colormap(gray); axis('equal'); axis('image') title(['image rotated by ', num2str(rot_angle*18/pi), ' degrees, with zero-order hold']) Question 3 Alternative Rotation Methods: % Four Methods are given for possible Matlab image rotation operations: % - two consider improving efficiency by working with matrices % - the other two use for-loops % - two consider forward-mapping from original image coordinate space to rotated image % coordinate space (but then require zero-order hold operations to fill the hole) % - the other two consider inverse mapping to avoid holes in the first place % rot_matrix is the 2 by 2 rotation matrix discussed in class % Pixel locations are changed using rot_matrix applied to [rot_ind and col_ind]; % Alternatively, the inverse of rot_matrix can be applied to the rotated image coordinate space % to find the mapping back to the original coordinate space this method will prevent holes % from developing in the rotated image % Round command and an offset of 3 is used to avoid fractional or negative indices. % Rotation for 45 degrees is done below. Rotation for the other angles % can be obtained by changing the rot_angle value rot_angle = 45*pi/18; %in radians rot_mat = [cos(rot_angle) sin(rot_angle); -sin(rot_angle) cos(rot_angle)]; rot_mat_inv = inv(rot_mat); 14

15 % Method 1: Use matrix operations to map original image coordinates % to rotated image coordinates (will give holes) x = repmat(1,1,n_col); for ind=2:n_row; x = horzcat(x, repmat(ind,1,n_col)); y = repmat([1:n_col],1,n_row); x_y = [x; y]; x_y_prime = rot_mat*x_y; x_y_prime = round(x_y_prime) + 3; %initialize to negative 1's to distinguish from the black spots in the image im_rot = -ones(3*n_col, 3*n_row); for ind1 = 1:length(x_y_prime), im_rot(x_y_prime(1,ind1), x_y_prime(2,ind1)) = im(x_y(1,ind1), x_y(2,ind1)); % Method 2: Use matrix operations to map rotated image coordinates % to the orignal image coordinates (inverse mapping that will prevent holes) im_rot=-ones(3*n_col, 3*n_row); x_pr = repmat(1,1,size(im_rot,2)); for ind=2:size(im_rot,1); x_pr = horzcat(x_pr, repmat(ind,1,size(im_rot,2))); y_pr = repmat([1:size(im_rot,2)],1,size(im_rot,1)); x_y_pr = [x_pr-3; y_pr-3]; x_y = rot_mat_inv*x_y_pr; for ind1 = 1:length(x_y), x = round(x_y(1,ind1)); y = round(x_y(2,ind1)); if(x > & y > & x <= size(im,1) & y <= size(im,2)), im_rot(x_y_pr(1,ind1)+3, x_y_pr(2,ind1)+3) = im(x, y); % Method 3: Use For loop and forward mapping of coordinates % initialize to negative 1's to distinguish from the black spots in the image im_rot=-ones(3*348,3*261); for i=1:n_row, for j=1:n_col, im_rot(round(rot_mat(1,1)*i+rot_mat(1,2)*j)+3,round(rot_mat(2,1)*i+rot_mat(2,2)*j)+3) = im(i,j); %holes should then be filled with a zero-order hold operation % Method 4: Use for-loop and inverse mapping of coordinates (avoids holes) im_rot=-ones(3*n_col, 3*n_row; for i=1:size(im_rot,1), for j=1:size(im_rot,2), %subtract 3 to account for possible negative indices i_prime = round(rot_mat_inv(1,1)*(i-3)+rot_mat_inv(1,2)*(j-3)); j_prime = round(rot_mat_inv(2,1)*(i-3)+rot_mat_inv(2,2)*(j-3)); if (i_prime > & j_prime > & i_prime <= size(im,1) & j_prime <= size(im,2)), im_rot(i,j)=im(i_prime,j_prime); 15

16 Question 4: Adding Images together fid=fopen('rodin.raw'); im = fread(fid,[ ],'uint8'); fclose(fid); im = im'; %take a subset of the original image im_subset = im(51:,11:28); %create three new images with the subset pasted in at different locations im_2 = im; im_2(1:1,1:18)=im_subset; im_3 = im; im_3(11:2,11:28)=im_subset; im_4 = im; im_4(112:261,169:348)=im_subset; figure; colormap('gray'); subplot(2,2,1); imagesc(im_subset); title('subset Image'); axis('image'); subplot(2,2,2); imagesc(im_2); subplot(2,2,3); imagesc(im_3) subplot(2,2,4); imagesc(im_4) % the following part bls the pasted image with the original one. im_2_bl = im; im_2_bl(1:1,1:18)=.5*(im_2_bl(1:1,1:18)+im_subset); im_3_bl = im; im_3_bl(11:2,11:28)=.5*(im_3_bl(11:2,11:28)+im_subset); im_4_bl = im; im_4_bl(112:261,169:348)=.5*(im_4_bl(112:261,169:348)+im_subset); figure; colormap('gray'); subplot(2,2,1); imagesc(im_subset); title('subset Image'); axis('image'); subplot(2,2,2); imagesc(im_2_bl); subplot(2,2,3); imagesc(im_3_bl); subplot(2,2,4); imagesc(im_4_bl); 16

17 Question 5: Subtracting to get image change %note that the sum of the values in the first line of the file gives the line-length fid=fopen('lab2prob5data1'); im_1 = fread(fid,[64 37/64],'uint8'); fclose(fid); im_1 = im_1'; fid=fopen('lab2prob5data2'); im_2 = fread(fid,[64 37/64],'uint8'); fclose(fid); im_2 = im_2'; figure; colormap(gray); subplot(1,2,1); imagesc(im_1); axis('image'); title('original Image-1') subplot(1,2,2); imagesc(im_2) axis('image'); title('original Image-2') figure; colormap('gray'); imagesc(im_1 - im_2); %Difference Image axis('image'); title('difference Image'); Question 6: Image Inversion % The image is inverted by subtracting all of its pixel values from 255. fid=fopen('lab2prob6data'); im=fread(fid,[48 37/48],'uint8'); fclose(fid); im = im'; figure; colormap('gray'); subplot(1,2,1); imagesc(im); axis('equal'); axis('image'); title('original Image') subplot(1,2,2) imagesc(255-im) axis('image'); title('inverse Image') Question 7: An Unknown Format clear fid=fopen('lab2prob7data'); data = fread(fid,[1 inf],'uint8'); fclose(fid); %data is size 1x42741 % Find the line length by looking for a repetitive pattern in the data % The line-header information will repeat at the beginning of each new line figure; plot(data(1:)); title('first elements of raw data') 17

18 line_length = 582; len_line_header = 36; len_main_header = 144; fid=fopen('lab2prob7data'); main_header = fread(fid,[1 len_main_header],'uint8'); %beginning main header is length start reading image after im_raw = fread(fid,[line_length inf], 'uint8'); %raw image has dimensions 692x582 fclose(fid); %find the number of data lines: subtract 1 since the last row is the special trailer, %which we know from observing the line count information contained in col 24 of the line-headers num_lines = size(im_raw,2) - 1; %form image without extraneous data by cutting out line-header columns and trailer %the final image has dimensions of 691x546 im = im_raw(len_line_header+1:, 1:num_lines)'; figure; imagesc(im); colormap(gray) axis('equal') axis('image') % im is 8-bit grayscale (-255) defined as double precision % imwrite() assumes doubles to be in the dynamic range [,1], so convert it to uint8 im_final = uint8(im); imwrite(im_final, 'Yoda.jpeg'); 18

EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3

EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3 EE168 Lab/Homework #1 Introduction to Digital Image Processing Handout #3 We will be combining laboratory exercises with homework problems in the lab sessions for this course. In the scheduled lab times,

More information

Lab 1: Basic operations on images in Matlab

Lab 1: Basic operations on images in Matlab Lab 1: Basic operations on images in Matlab Maria Magnusson with contributions by Michael Felsberg, 2017, Computer Vision Laboratory, Department of Electrical Engineering, Linköping University 1 Introduction

More information

EE168 Handout #6 Winter Useful MATLAB Tips

EE168 Handout #6 Winter Useful MATLAB Tips Useful MATLAB Tips (1) File etiquette remember to fclose(f) f=fopen( filename ); a = fread( ); or a=fwrite( ); fclose(f); How big is a? size(a) will give rows/columns or all dimensions if a has more than

More information

Depatment of Computer Science Rutgers University CS443 Digital Imaging and Multimedia Assignment 4 Due Apr 15 th, 2008

Depatment of Computer Science Rutgers University CS443 Digital Imaging and Multimedia Assignment 4 Due Apr 15 th, 2008 CS443 Spring 2008 - page 1/5 Depatment of Computer Science Rutgers University CS443 Digital Imaging and Multimedia Assignment 4 Due Apr 15 th, 2008 This assignment is supposed to be a tutorial assignment

More information

matlab_intro.html Page 1 of 5 Date: Tuesday, September 6, 2005

matlab_intro.html Page 1 of 5 Date: Tuesday, September 6, 2005 matlab_intro.html Page 1 of 5 % Introducing Matlab % adapted from Eero Simoncelli (http://www.cns.nyu.edu/~eero) % and Hany Farid (http://www.cs.dartmouth.edu/~farid) % and Serge Belongie (http://www-cse.ucsd.edu/~sjb)

More information

Image transformations. Prof. Noah Snavely CS Administrivia

Image transformations. Prof. Noah Snavely CS Administrivia Image transformations Prof. Noah Snavely CS1114 http://www.cs.cornell.edu/courses/cs1114/ Administrivia 2 Last time: Interpolation 3 Nearest neighbor interpolation 4 Bilinear interpolation 5 Bicubic interpolation

More information

LAB 2: Resampling. Maria Magnusson, 2012 (last update August 2016) with contributions from Katarina Flood, Qingfen Lin and Henrik Turbell

LAB 2: Resampling. Maria Magnusson, 2012 (last update August 2016) with contributions from Katarina Flood, Qingfen Lin and Henrik Turbell LAB 2: Resampling Maria Magnusson, 2 (last update August 6) with contributions from Katarina Flood, Qingfen Lin and Henrik Turbell Computer Vision Laboratory, Dept. of Electrical Engineering, Linköping

More information

Image Processing Matlab tutorial 2 MATLAB PROGRAMMING

Image Processing Matlab tutorial 2 MATLAB PROGRAMMING School of Engineering and Physical Sciences Electrical Electronic and Computer Engineering Image Processing Matlab tutorial 2 MATLAB PROGRAMMING 1. Objectives: Last week, we introduced you to the basic

More information

Introduction to image processing in Matlab

Introduction to image processing in Matlab file://d:\courses\digital Image Processing\lect\Introduction to Image Processing-MATL... Page 1 of 18 Introduction to image processing in Matlab by Kristian Sandberg, Department of Applied Mathematics,

More information

Redundant Data Elimination for Image Compression and Internet Transmission using MATLAB

Redundant Data Elimination for Image Compression and Internet Transmission using MATLAB Redundant Data Elimination for Image Compression and Internet Transmission using MATLAB R. Challoo, I.P. Thota, and L. Challoo Texas A&M University-Kingsville Kingsville, Texas 78363-8202, U.S.A. ABSTRACT

More information

CS1114 Assignment 5, Part 1

CS1114 Assignment 5, Part 1 CS4 Assignment 5, Part out: Friday, March 27, 2009. due: Friday, April 3, 2009, 5PM. This assignment covers three topics in two parts: interpolation and image transformations (Part ), and feature-based

More information

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia The goal for this tutorial is to make sure that you understand a few key concepts related to programming, and that you know the basics

More information

Homework #4: Creating Panoramas

Homework #4: Creating Panoramas Homework #4: Creating Panoramas Assigned: March 21 Due: Wednesday, April 6 The goal of this assignment is to write a simple photo panorama creator. You will take four or more photographs and create a panoramic

More information

Spring 2010 Instructor: Michele Merler.

Spring 2010 Instructor: Michele Merler. Spring 2010 Instructor: Michele Merler http://www1.cs.columbia.edu/~mmerler/comsw3101-2.html Images are matrices (for MATLAB) Grayscale images are [nxm] matrices Color images are [nxmx3] matrices R G B

More information

Homework 5: Transformations in geometry

Homework 5: Transformations in geometry Math 21b: Linear Algebra Spring 2018 Homework 5: Transformations in geometry This homework is due on Wednesday, February 7, respectively on Thursday February 8, 2018. 1 a) Find the reflection matrix at

More information

The 2D Fourier transform & image filtering

The 2D Fourier transform & image filtering Luleå University of Technology Matthew Thurley and Johan Carlson Last revision: Oct 27, 2011 Industrial Image Analysis E0005E Product Development Phase 6 The 2D Fourier transform & image filtering Contents

More information

Introduction to Computer Vision

Introduction to Computer Vision Introduction to Computer Vision Michael J. Black Oct 2009 Motion estimation Goals Motion estimation Affine flow Optimization Large motions Why affine? Monday dense, smooth motion and regularization. Robust

More information

MATLAB for Image Processing. April 2018 Rod Dockter

MATLAB for Image Processing. April 2018 Rod Dockter MATLAB for Image Processing April 2018 Rod Dockter Outline Introduction to MATLAB Basics & Examples Image Processing with MATLAB Basics & Examples What is MATLAB? MATLAB = Matrix Laboratory MATLAB is a

More information

Image Warping. August 20, Abstract

Image Warping. August 20, Abstract Image Warping Mikkel B. Stegmann Informatics and Mathematical Modelling, Technical University of Denmark Richard Petersens Plads, Building 32, DK-2800 Kgs. Lyngby, Denmark August 20, 200 Abstract This

More information

Computer Vision, Laboratory session 1

Computer Vision, Laboratory session 1 Centre for Mathematical Sciences, january 200 Computer Vision, Laboratory session Overview In this laboratory session you are going to use matlab to look at images, study the representations of points,

More information

02501 Image analysis, vision and computer graphics Exercise 05 - Image Warping

02501 Image analysis, vision and computer graphics Exercise 05 - Image Warping 0250 Image analysis, vision and computer graphics Exercise 05 - Image Warping September 7, 2007 Abstract This note introduces the concept of image warping and treats the special case of Euclidean warping

More information

EE795: Computer Vision and Intelligent Systems

EE795: Computer Vision and Intelligent Systems EE795: Computer Vision and Intelligent Systems Spring 2012 TTh 17:30-18:45 WRI C225 Lecture 04 130131 http://www.ee.unlv.edu/~b1morris/ecg795/ 2 Outline Review Histogram Equalization Image Filtering Linear

More information

MATLAB for Image Processing

MATLAB for Image Processing MATLAB for Image Processing PPT adapted from Tuo Wang, tuowang@cs.wisc.edu Computer Vision Lecture Notes 03 1 Introduction to MATLAB Basics & Examples Computer Vision Lecture Notes 03 2 What is MATLAB?

More information

Contents Systems of Linear Equations and Determinants

Contents Systems of Linear Equations and Determinants Contents 6. Systems of Linear Equations and Determinants 2 Example 6.9................................. 2 Example 6.10................................ 3 6.5 Determinants................................

More information

Introduction.

Introduction. Product information Image Systems AB Main office: Ågatan 40, SE-582 22 Linköping Phone +46 13 200 100, fax +46 13 200 150 info@imagesystems.se, Introduction TEMA Automotive is the world leading system

More information

Particle localization and tracking GUI: TrackingGUI_rp.m

Particle localization and tracking GUI: TrackingGUI_rp.m Particle localization and tracking GUI: TrackingGUI_rp.m Raghuveer Parthasarathy Department of Physics The University of Oregon raghu@uoregon.edu Begun April, 2012 (based on earlier work). Last modified

More information

XPM 2D Transformations Week 2, Lecture 3

XPM 2D Transformations Week 2, Lecture 3 CS 430/585 Computer Graphics I XPM 2D Transformations Week 2, Lecture 3 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel

More information

Lecture 4 Image Enhancement in Spatial Domain

Lecture 4 Image Enhancement in Spatial Domain Digital Image Processing Lecture 4 Image Enhancement in Spatial Domain Fall 2010 2 domains Spatial Domain : (image plane) Techniques are based on direct manipulation of pixels in an image Frequency Domain

More information

16720: Computer Vision Homework 1

16720: Computer Vision Homework 1 16720: Computer Vision Homework 1 Instructor: Martial Hebert TAs: Varun Ramakrishna and Tomas Simon Instructions A complete homework submission consists of two parts. A pdf file with answers to the theory

More information

The Singular Value Decomposition: Let A be any m n matrix. orthogonal matrices U, V and a diagonal matrix Σ such that A = UΣV T.

The Singular Value Decomposition: Let A be any m n matrix. orthogonal matrices U, V and a diagonal matrix Σ such that A = UΣV T. Section 7.4 Notes (The SVD) The Singular Value Decomposition: Let A be any m n matrix. orthogonal matrices U, V and a diagonal matrix Σ such that Then there are A = UΣV T Specifically: The ordering of

More information

Transform 1: Translate, Matrices

Transform 1: Translate, Matrices Transform 1: Translate, Matrices This unit introduces coordinate system transformations and explains how to control their scope. Syntax introduced: translate(), pushmatrix(), popmatrix() The coordinate

More information

CV: 3D sensing and calibration

CV: 3D sensing and calibration CV: 3D sensing and calibration Coordinate system changes; perspective transformation; Stereo and structured light MSU CSE 803 1 roadmap using multiple cameras using structured light projector 3D transformations

More information

Assignment: Backgrounding and Optical Flow.

Assignment: Backgrounding and Optical Flow. Assignment: Backgrounding and Optical Flow. April 6, 00 Backgrounding In this part of the assignment, you will develop a simple background subtraction program.. In this assignment, you are given two videos.

More information

Lab Assignment 3 - CSE 377/594, Fall 2007

Lab Assignment 3 - CSE 377/594, Fall 2007 Lab Assignment 3 - CSE 377/594, Fall 2007 Due: Thursday, November 15, 2007, 11:59pm Having completed assignments 1 and 2 you are now sufficiently familiar with Matlab. Assignment 3 will build on this knowledge

More information

Linear Algebra Review

Linear Algebra Review CS 1674: Intro to Computer Vision Linear Algebra Review Prof. Adriana Kovashka University of Pittsburgh January 11, 2018 What are images? (in Matlab) Matlab treats images as matrices of numbers To proceed,

More information

IMAGING. Images are stored by capturing the binary data using some electronic devices (SENSORS)

IMAGING. Images are stored by capturing the binary data using some electronic devices (SENSORS) IMAGING Film photography Digital photography Images are stored by capturing the binary data using some electronic devices (SENSORS) Sensors: Charge Coupled Device (CCD) Photo multiplier tube (PMT) The

More information

THE BARE ESSENTIALS OF MATLAB

THE BARE ESSENTIALS OF MATLAB WHAT IS MATLAB? Matlab was originally developed to be a matrix laboratory, and is used as a powerful software package for interactive analysis and visualization via numerical computations. It is oriented

More information

UTSA CS 6723 Image Processing Fall 2013 Problem Set No. 3

UTSA CS 6723 Image Processing Fall 2013 Problem Set No. 3 UTSA CS 6723 Image Processing Fall 2013 Problem Set No. 3 Issued: Monday, September 30, 2013 Due: Monday, October 14, 2013 Homework on Fractal Coding Problem 3.1 (20 points) Figures 1 show attractors of

More information

GP265 / EE355 Homework 7 (Final project 1) Solutions

GP265 / EE355 Homework 7 (Final project 1) Solutions GP265 / EE355 Homework 7 (Final project 1) Solutions 2018-03-10 1. We form the interferogram by multiplying image S 1 and conjugated image S 2 together: S int = S 1 S 2. The multi-look version of the complex

More information

Rotation and Interpolation

Rotation and Interpolation Rotation and Interpolation Summary This article describes how to rotate 2D objects using any angle, as well as describes two pixel interpolation methods nearest neighbor and bilinear. 1- Introduction Image

More information

Lecture #3. MATLAB image processing (cont.) Histograms Mathematics of image processing Geometric transforms Image Warping.

Lecture #3. MATLAB image processing (cont.) Histograms Mathematics of image processing Geometric transforms Image Warping. Lecture #3 MATLAB image processing (cont.) vectorization Histograms Mathematics of image processing Geometric transforms Image Warping Pixel Indexing in MATLAB For loops in Matlab are inefficient, whereas

More information

QUICK INTRODUCTION TO MATLAB PART I

QUICK INTRODUCTION TO MATLAB PART I QUICK INTRODUCTION TO MATLAB PART I Department of Mathematics University of Colorado at Colorado Springs General Remarks This worksheet is designed for use with MATLAB version 6.5 or later. Once you have

More information

Graphing Calculator Tutorial

Graphing Calculator Tutorial Graphing Calculator Tutorial This tutorial is designed as an interactive activity. The best way to learn the calculator functions will be to work the examples on your own calculator as you read the tutorial.

More information

A very brief Matlab introduction

A very brief Matlab introduction A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading

More information

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices

Introduction to. The Help System. Variable and Memory Management. Matrices Generation. Interactive Calculations. Vectors and Matrices Introduction to Interactive Calculations Matlab is interactive, no need to declare variables >> 2+3*4/2 >> V = 50 >> V + 2 >> V Ans = 52 >> a=5e-3; b=1; a+b Most elementary functions and constants are

More information

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline

MATLAB Tutorial EE351M DSP. Created: Thursday Jan 25, 2007 Rayyan Jaber. Modified by: Kitaek Bae. Outline MATLAB Tutorial EE351M DSP Created: Thursday Jan 25, 2007 Rayyan Jaber Modified by: Kitaek Bae Outline Part I: Introduction and Overview Part II: Matrix manipulations and common functions Part III: Plots

More information

CITS 4402 Computer Vision

CITS 4402 Computer Vision CITS 4402 Computer Vision A/Prof Ajmal Mian Adj/A/Prof Mehdi Ravanbakhsh, CEO at Mapizy (www.mapizy.com) and InFarm (www.infarm.io) Lecture 02 Binary Image Analysis Objectives Revision of image formation

More information

Homework #1. Displays, Image Processing, Affine Transformations, Hierarchical modeling, Projections

Homework #1. Displays, Image Processing, Affine Transformations, Hierarchical modeling, Projections Computer Graphics Instructor: rian Curless CSEP 557 Winter 213 Homework #1 Displays, Image Processing, Affine Transformations, Hierarchical modeling, Projections Assigned: Tuesday, January 22 nd Due: Tuesday,

More information

TWO DIMENSIONAL ARRAY OR MATRIX common name scores Defined as scores[10][5] IE 10 rows x 5 columns showing name of each position; some values below

TWO DIMENSIONAL ARRAY OR MATRIX common name scores Defined as scores[10][5] IE 10 rows x 5 columns showing name of each position; some values below TWO DIMENSIONAL ARRAY OR MATRIX common name scores Defined as scores[10][5] IE 10 rows x 5 columns showing name of each position; some values below Values in the memory could be scores[1][2]=78 scores[0][2]=56

More information

1 Background and Introduction 2. 2 Assessment 2

1 Background and Introduction 2. 2 Assessment 2 Luleå University of Technology Matthew Thurley Last revision: October 27, 2011 Industrial Image Analysis E0005E Product Development Phase 4 Binary Morphological Image Processing Contents 1 Background and

More information

Lab 1: Elementary image operations

Lab 1: Elementary image operations CSC, KTH DD2423 Image Analysis and Computer Vision : Lab 1: Elementary image operations The goal of the labs is to gain practice with some of the fundamental techniques in image processing on grey-level

More information

The University of Sydney MATH 2009

The University of Sydney MATH 2009 The University of Sydney MTH 009 GRPH THORY Tutorial 10 Solutions 004 1. In a tournament, the score of a vertex is its out-degree, and the score sequence is a list of all the scores in non-decreasing order.

More information

Lecture #5. Point transformations (cont.) Histogram transformations. Intro to neighborhoods and spatial filtering

Lecture #5. Point transformations (cont.) Histogram transformations. Intro to neighborhoods and spatial filtering Lecture #5 Point transformations (cont.) Histogram transformations Equalization Specification Local vs. global operations Intro to neighborhoods and spatial filtering Brightness & Contrast 2002 R. C. Gonzalez

More information

Modify Panel. Flatten Tab

Modify Panel. Flatten Tab AFM Image Processing Most images will need some post acquisition processing. A typical procedure is to: i) modify the image by flattening, using a planefit, and possibly also a mask, ii) analyzing the

More information

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into 2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into the viewport of the current application window. A pixel

More information

XPM 2D Transformations Week 2, Lecture 3

XPM 2D Transformations Week 2, Lecture 3 CS 430/585 Computer Graphics I XPM 2D Transformations Week 2, Lecture 3 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel

More information

Homework 5: Transformations in geometry

Homework 5: Transformations in geometry Math b: Linear Algebra Spring 08 Homework 5: Transformations in geometry This homework is due on Wednesday, February 7, respectively on Thursday February 8, 08. a) Find the reflection matrix at the line

More information

CS129: Introduction to Matlab (Code)

CS129: Introduction to Matlab (Code) CS129: Introduction to Matlab (Code) intro.m Introduction to Matlab (adapted from http://www.stanford.edu/class/cs223b/matlabintro.html) Stefan Roth , 09/08/2003 Stolen

More information

Creating a Basic Chart in Excel 2007

Creating a Basic Chart in Excel 2007 Creating a Basic Chart in Excel 2007 A chart is a pictorial representation of the data you enter in a worksheet. Often, a chart can be a more descriptive way of representing your data. As a result, those

More information

Basic MATLAB Intro III

Basic MATLAB Intro III Basic MATLAB Intro III Plotting Here is a short example to carry out: >x=[0:.1:pi] >y1=sin(x); y2=sqrt(x); y3 = sin(x).*sqrt(x) >plot(x,y1); At this point, you should see a graph of sine. (If not, go to

More information

DSP-Based Parallel Processing Model of Image Rotation

DSP-Based Parallel Processing Model of Image Rotation Available online at www.sciencedirect.com Procedia Engineering 5 (20) 2222 2228 Advanced in Control Engineering and Information Science DSP-Based Parallel Processing Model of Image Rotation ZHANG Shuang,2a,2b,

More information

Computer Vision, Laboratory session 1

Computer Vision, Laboratory session 1 Centre for Mathematical Sciences, january 2007 Computer Vision, Laboratory session 1 Overview In this laboratory session you are going to use matlab to look at images, study projective geometry representations

More information

Organizing and Summarizing Data

Organizing and Summarizing Data 1 Organizing and Summarizing Data Key Definitions Frequency Distribution: This lists each category of data and how often they occur. : The percent of observations within the one of the categories. This

More information

How to learn MATLAB? Some predefined variables

How to learn MATLAB? Some predefined variables ECE-S352 Lab 1 MATLAB Tutorial How to learn MATLAB? 1. MATLAB comes with good tutorial and detailed documents. a) Select MATLAB help from the MATLAB Help menu to open the help window. Follow MATLAB s Getting

More information

% Close all figure windows % Start figure window

% Close all figure windows % Start figure window CS1112 Fall 2016 Project 3 Part A Due Monday 10/3 at 11pm You must work either on your own or with one partner. If you work with a partner, you must first register as a group in CMS and then submit your

More information

Image Compression Techniques

Image Compression Techniques ME 535 FINAL PROJECT Image Compression Techniques Mohammed Abdul Kareem, UWID: 1771823 Sai Krishna Madhavaram, UWID: 1725952 Palash Roychowdhury, UWID:1725115 Department of Mechanical Engineering University

More information

Lab 4: Automatical thresholding and simple OCR

Lab 4: Automatical thresholding and simple OCR Lab 4: Automatical thresholding and simple OCR Maria Magnusson, 2018, Computer Vision Laboratory, Department of Electrical Engineering, Linköping University, Sweden Based on an older lab developed at the

More information

Digital Image Analysis and Processing CPE

Digital Image Analysis and Processing CPE Digital Image Analysis and Processing CPE 0907544 Matlab Tutorial Dr. Iyad Jafar Outline Matlab Environment Matlab as Calculator Common Mathematical Functions Defining Vectors and Arrays Addressing Vectors

More information

Camera Model and Calibration

Camera Model and Calibration Camera Model and Calibration Lecture-10 Camera Calibration Determine extrinsic and intrinsic parameters of camera Extrinsic 3D location and orientation of camera Intrinsic Focal length The size of the

More information

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures

Introduction to Octave/Matlab. Deployment of Telecommunication Infrastructures Introduction to Octave/Matlab Deployment of Telecommunication Infrastructures 1 What is Octave? Software for numerical computations and graphics Particularly designed for matrix computations Solving equations,

More information

Identity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans =

Identity Matrix: >> eye(3) ans = Matrix of Ones: >> ones(2,3) ans = Very Basic MATLAB Peter J. Olver January, 2009 Matrices: Type your matrix as follows: Use space or, to separate entries, and ; or return after each row. >> [;5 0-3 6;; - 5 ] or >> [,5,6,-9;5,0,-3,6;7,8,5,0;-,,5,]

More information

Chapter 18. Geometric Operations

Chapter 18. Geometric Operations Chapter 18 Geometric Operations To this point, the image processing operations have computed the gray value (digital count) of the output image pixel based on the gray values of one or more input pixels;

More information

Lecture 5 2D Transformation

Lecture 5 2D Transformation Lecture 5 2D Transformation What is a transformation? In computer graphics an object can be transformed according to position, orientation and size. Exactly what it says - an operation that transforms

More information

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques 5.1 Line A line, or straight line, is, roughly speaking, an (infinitely) thin, (infinitely) long, straight geometrical object,

More information

Introduction to Engineering gii

Introduction to Engineering gii 25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.

More information

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens.

PC-MATLAB PRIMER. This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. PC-MATLAB PRIMER This is intended as a guided tour through PCMATLAB. Type as you go and watch what happens. >> 2*3 ans = 6 PCMATLAB uses several lines for the answer, but I ve edited this to save space.

More information

Programming for Blood, Spring 2008 Set #3 P. N. Hilfinger. ±0.d 1 d m 2 e,

Programming for Blood, Spring 2008 Set #3 P. N. Hilfinger. ±0.d 1 d m 2 e, Programming for Blood, Spring 2008 Set #3 P. N. Hilfinger 1. An m-bit floating-point number is a value ±0.d 1 d m 2 e, where e is an integer (i.e., positive or negative), and each d i is either 0 or 1.

More information

Chapter 1 Introduction to MATLAB

Chapter 1 Introduction to MATLAB Chapter 1 Introduction to MATLAB 1.1 What is MATLAB? MATLAB = MATrix LABoratory, the language of technical computing, modeling and simulation, data analysis and processing, visualization and graphics,

More information

16720 Computer Vision: Homework 3 Template Tracking and Layered Motion.

16720 Computer Vision: Homework 3 Template Tracking and Layered Motion. 16720 Computer Vision: Homework 3 Template Tracking and Layered Motion. Instructor: Martial Hebert TAs: Varun Ramakrishna and Tomas Simon Due Date: October 24 th, 2011. 1 Instructions You should submit

More information

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections.

Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections. Image Interpolation 48 Interpolation is a basic tool used extensively in tasks such as zooming, shrinking, rotating, and geometric corrections. Fundamentally, interpolation is the process of using known

More information

Automated Measurement of Viscosity with Ubbelohde Viscometers, Camera Unit and Image Processing Software

Automated Measurement of Viscosity with Ubbelohde Viscometers, Camera Unit and Image Processing Software Santiago de Querétaro, México, Automated Measurement of Viscosity with Ubbelohde Viscometers, Camera Unit and Image Processing Software Will, J.C., Hernández, I., Trujillo, S. km 4,5 Carretera a Los Cués,

More information

hp calculators hp 39g+ & hp 39g/40g Using Matrices How are matrices stored? How do I solve a system of equations? Quick and easy roots of a polynomial

hp calculators hp 39g+ & hp 39g/40g Using Matrices How are matrices stored? How do I solve a system of equations? Quick and easy roots of a polynomial hp calculators hp 39g+ Using Matrices Using Matrices The purpose of this section of the tutorial is to cover the essentials of matrix manipulation, particularly in solving simultaneous equations. How are

More information

PROGRAMMING WITH MATLAB WEEK 6

PROGRAMMING WITH MATLAB WEEK 6 PROGRAMMING WITH MATLAB WEEK 6 Plot: Syntax: plot(x, y, r.- ) Color Marker Linestyle The line color, marker style and line style can be changed by adding a string argument. to select and delete lines

More information

Camera Model and Calibration. Lecture-12

Camera Model and Calibration. Lecture-12 Camera Model and Calibration Lecture-12 Camera Calibration Determine extrinsic and intrinsic parameters of camera Extrinsic 3D location and orientation of camera Intrinsic Focal length The size of the

More information

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions:

Matrices. A Matrix (This one has 2 Rows and 3 Columns) To add two matrices: add the numbers in the matching positions: Matrices A Matrix is an array of numbers: We talk about one matrix, or several matrices. There are many things we can do with them... Adding A Matrix (This one has 2 Rows and 3 Columns) To add two matrices:

More information

BCC Multi Stretch Wipe

BCC Multi Stretch Wipe BCC Multi Stretch Wipe The BCC Multi Stretch Wipe is a radial wipe with three additional stretch controls named Taffy Stretch. The Taffy Stretch parameters do not significantly impact render times. The

More information

Image Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan

Image Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan Image Processing CS 6640 : An Introduction to MATLAB Basics Bo Wang and Avantika Vardhan August 29, 2014 1 Getting Started with MATLAB 1.1 Resources 1) CADE Lab: Matlab is installed on all the CADE lab

More information

Finite Math - J-term Homework. Section Inverse of a Square Matrix

Finite Math - J-term Homework. Section Inverse of a Square Matrix Section.5-77, 78, 79, 80 Finite Math - J-term 017 Lecture Notes - 1/19/017 Homework Section.6-9, 1, 1, 15, 17, 18, 1, 6, 9, 3, 37, 39, 1,, 5, 6, 55 Section 5.1-9, 11, 1, 13, 1, 17, 9, 30 Section.5 - Inverse

More information

Chapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1

Chapter 2 (Part 2) MATLAB Basics. dr.dcd.h CS 101 /SJC 5th Edition 1 Chapter 2 (Part 2) MATLAB Basics dr.dcd.h CS 101 /SJC 5th Edition 1 Display Format In the command window, integers are always displayed as integers Characters are always displayed as strings Other values

More information

Reconstruction of Images Distorted by Water Waves

Reconstruction of Images Distorted by Water Waves Reconstruction of Images Distorted by Water Waves Arturo Donate and Eraldo Ribeiro Computer Vision Group Outline of the talk Introduction Analysis Background Method Experiments Conclusions Future Work

More information

Practical 4: The Integrate & Fire neuron

Practical 4: The Integrate & Fire neuron Practical 4: The Integrate & Fire neuron 2014 version by Mark van Rossum 2018 version by Matthias Hennig and Theoklitos Amvrosiadis 16th October 2018 1 Introduction to MATLAB basics You can start MATLAB

More information

Anima-LP. Version 2.1alpha. User's Manual. August 10, 1992

Anima-LP. Version 2.1alpha. User's Manual. August 10, 1992 Anima-LP Version 2.1alpha User's Manual August 10, 1992 Christopher V. Jones Faculty of Business Administration Simon Fraser University Burnaby, BC V5A 1S6 CANADA chris_jones@sfu.ca 1992 Christopher V.

More information

Introduction to Digital Image Processing

Introduction to Digital Image Processing Fall 2005 Image Enhancement in the Spatial Domain: Histograms, Arithmetic/Logic Operators, Basics of Spatial Filtering, Smoothing Spatial Filters Tuesday, February 7 2006, Overview (1): Before We Begin

More information

Haar Wavelet Image Compression

Haar Wavelet Image Compression Math 57 Haar Wavelet Image Compression. Preliminaries Haar wavelet compression is an efficient way to perform both lossless and lossy image compression. It relies on averaging and differencing the values

More information

An Introductory Tutorial on Matlab

An Introductory Tutorial on Matlab 1. Starting Matlab An Introductory Tutorial on Matlab We follow the default layout of Matlab. The Command Window is used to enter MATLAB functions at the command line prompt >>. The Command History Window

More information

EE795: Computer Vision and Intelligent Systems

EE795: Computer Vision and Intelligent Systems EE795: Computer Vision and Intelligent Systems Spring 2012 TTh 17:30-18:45 FDH 204 Lecture 10 130221 http://www.ee.unlv.edu/~b1morris/ecg795/ 2 Outline Review Canny Edge Detector Hough Transform Feature-Based

More information

MATLAB Introductory Course Computer Exercise Session

MATLAB Introductory Course Computer Exercise Session MATLAB Introductory Course Computer Exercise Session This course is a basic introduction for students that did not use MATLAB before. The solutions will not be collected. Work through the course within

More information

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review.

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review. MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review. 1. The intersection of two non-parallel planes is a line. Find the equation of the line. Give

More information

EE368 Project: Visual Code Marker Detection

EE368 Project: Visual Code Marker Detection EE368 Project: Visual Code Marker Detection Kahye Song Group Number: 42 Email: kahye@stanford.edu Abstract A visual marker detection algorithm has been implemented and tested with twelve training images.

More information

E0005E - Industrial Image Analysis

E0005E - Industrial Image Analysis E0005E - Industrial Image Analysis The Hough Transform Matthew Thurley slides by Johan Carlson 1 This Lecture The Hough transform Detection of lines Detection of other shapes (the generalized Hough transform)

More information