Lab 8 Report PDF

Title Lab 8 Report
Author Daniel Nasr
Course Discrete Time Signals and Systems Laboratory
Institution California State Polytechnic University Pomona
Pages 13
File Size 845.3 KB
File Type PDF
Total Downloads 74
Total Views 144

Summary

Lab Report...


Description

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Prelab #8

1. A common measure of transmission for digital data is the baud rate, defined as the number of bits transmitted per second. Generally, transmission is accomplished in packets consisting of a start bit, a byte (8 bits) of information, and a stop bit, Using these fact, answer the following: a. How many minutes would it take to transmit a 1024x1024 image with 256 gray level using a 56K baud modem? 28 = 256 grayscale level/pixel 56K = 56,000 bits/sec 1024*1024 = 1048576 pixels Size of image = 1048576 * 8 = 8388608 bits Minutes to transmit image = (8388608/56000)/60 = 2.5 minutes

b. What would the time be at 750K baud, a representative sped of a phone DSL connection? Size of image = 8388608 bits Time to transmit image = (8388608/750000) = 11.18 seconds Lab #8 1) Image on left is original 1024x1024, middle image is 256x256 and, last image is original 1024x1024

Analysis: We can see that after the original figure is shrunk then returned to the original image size, it appears blurry as there are bits lost when increasing the size. The image is blurrier because there are less pixels to fill the same space in the way MATLAB presents the image compared to the original 1024x1024 image. It can be thought of like when someone zooms into a small image it can see the pixels very clearly.

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 %Lab 8-1 %Daniel Nasr clear all; close all; A = imread('Fig-1.jpg'); imshow(A); B = imresize(A,0.25); 256/1024=0.25 figure(1); imshow (B);

%Change picture as needed

C = imresize(B,4); figure(2); imshow (C);

% zoom image back to 1024x1024 == 256x4=1024

2) a) Lowpass Filtering After First Lowpass

After Second Lowpass

% shrink the image from 1024x1024 to 256x256 ==

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Analysis: The difference between the two images is that the filtered images look softer than the original image. The edges look less sharp and detailed with less contrast. The image becomes blurry because lowpass filters smooth the areas in which it’s applied. %Lab8-2a A=imread('Animal-1.jpg'); figure,imshow(A) title('Original Image'); A=im2double(A); X=[1 1 1; 1 1 1;1 1 1]/9; %Mask 1 %X=[1 2 1; 2 4 2;1 2 1]/16; %Mask 2 Y=imfilter(A,X); figure, imshow(Y) title('Lowpass Filtered Image');

b) Highpass filtering Original Image

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Mask 1 Enhanced Image using Mask 1

Analysis: We can see that in both masked images, when the image is put through the high pass filter, there darks in the image look much clearer than the lighter images. In grayscale, white is on the lower end of the spectrum while blacks are the high end. Therefore, the blacks in the images are emphasized since the lower whites are smoothed out. This image looks too sharp because of visible noise.

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Mask 2

Enhanced Image using Mask 2 Mask 2 is filtering less than Mask 1 which results in a sharper but not too sharp image

since there’s less noise.

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 MATLAB CODE %Lab8-2b A=imread('Animal-2.jpg'); figure,imshow(A) title('Original Image'); A=im2double(A); X=[-1 -1 -1; -1 8 -1;-1 -1 -1;]; %Filter 1 %X=[0 -1 0;-1 4 -1;0 -1 0]; %Filter 2 Y=imfilter(A,X); figure, imshow(Y) title('Higpass Filtered Image'); Z=A+Y ; figure, imshow(Z) title('Enhanced Image');

c) Spatial Filtering

Analysis: The difference between the two images is that the spatial filtered appaears to be very choppy and looks as though there are random pixels missing. This results in a blurrier picurte than the original. MATLAB CODE %Lab8-2c %Use only one Filter A=imread('fig-1.jpg'); figure,imshow(A) title('Original Image'); A=im2double(A);

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 X=[1 1 1; 1 -8 1;1 1 1]; Y=A-imfilter(A,X,'replicate'); figure, imshow(Y) title('Spatial Filtered Image');

d) Enhancement Using the Laplacian Laplacian Image

Scaled Image

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Analysis: The edges are enhancement but more noise has been produced. The difference between the two images is that the Laplacian Enhanced appears like the high pass filter from before, but highlights the outline of the skull. This is great for scaling the image and enhancing the image. We can see that after the image is enhanced, we can see that there is a very similar image to the original. MATLAB CODE %Lab8-2d %Use only one Filter A=imread('Animal-2.jpg'); figure,imshow(A) title('Original Image');

%Original Image

A=im2double(A); X=[-1 -1 -1;-1 8 -1;-1 -1 -1]; Y1=imfilter(A,X,'replicate'); Y2=A+imfilter(A,X,'replicate'); %Laplacian Masked Image figure, imshow(Y1) title('Laplacian Image'); %Scaled Laplacian Masked Image Y11=.9*Y1; figure, imshow(Y11) title('Scaled Image'); %Enhanced Image figure, imshow(A+Y11); title('Laplacian Enhanced Image');

3) a) Fourier Spectrum and Average Value Original Image vs Fourier Spectrum

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017

From MATLAB, average value of image = 63.359 %Lab 3 f=imread('Animal-1a.jpg'); figure, imshow(f); title('Original Image'); F=fft2(im2double(f)); S=abs(F); figure, imshow(S,[]); title('Fourier Spectrum'); Fc=fftshift(F); S=abs(Fc); figure, imshow(S,[]); title('Fourier Spectrum, zero-frequency component centered'); S2=0.5*log(1+abs(Fc)); figure, imshow(S2,[]); title('Enhanced Centered Fourier Spectrum'); % Average Value [M,N]=size(f); S=double(f); sum=0; for m=1:M for n=1:N sum=S(m,n)+sum; end end A=sum/(M*N)

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 b) Lowpass Filtering

Analysis: The difference between the two pictures is that the Gaussian low pass image looks significantly blurrier. In some images, it would be very difficult to see the low passed image. MATLAB CODE %Lab 3 f=imread('Fig-1.jpg'); imshow(f); title('Original Image'); [M,N] = size(f); F = fft2(im2double(f)); sig = 20; u = 0:(M-1); v = 0:(N-1); idx = find(u>M/2); u(idx)= u(idx)-M; idy = find(v>N/2); v(idy)= v(idy)-N; [U,V] = meshgrid(v,u); D0 = sig; D = sqrt(U.^2+V.^2); H = exp(-D.^2/(2*D0.^2)); G = F.*H; g = real(ifft2(G)); figure, imshow(g,[ ]) title('Lowpass Filter Image');

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 c) Highpass Filtering Using a Lowpass Image Original Image

After Gaussian highpass

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 Gaussian highpass after fine tuning Gaussian lowpass filter

Analysis: The interesting part about high passing a low pass filter is the fact that the image of the animal is clear. This can be useful in certain cases when one requires the background of an image to be nonexistent where you can focus on the object in the foreground and not the background. MATLAB CODE %Lab 3 f=imread('Animal-2.jpg'); imshow(f); title('Original Image'); [M,N] = size(f); F = fft2(im2double(f)); sig = 20; u = 0:(M-1); v = 0:(N-1); idx = find(u>M/2); u(idx)= u(idx)-M; idy = find(v>N/2); v(idy)= v(idy)-N; [U,V] = meshgrid(v,u); D0 = sig; D = sqrt(U.^2+V.^2); H = 1- exp(-D.^2/(2*D0.^2)); G = F.*H; g = real(ifft2(G)); figure, imshow(g,[ ])

Daniel Nasr ECE 306L Andrew Pagnon 5/30/2017 title('Lowpass Filter Image'); g2=double(g); g3=g2.^.6; figure,imshow(g3,[ ]) title('Highpassing a Lowpassed Image');...


Similar Free PDFs