Matlab Project Online Homework Help

The sample project solution based on Image Processing using Matlab is shown below. The solution prepared by team of our professional Matlab experts is holistic and incorporates all the elements to be included in the complex Matlab project. The simplistic approach coupled with the well commented Matlab codes ensures the highest grades to the students and thus demonstrate the quality of our Matlab Project Online Homework Help. It should also validate the quality Matlab Assignment help provided by us. The solution incorporates all the key concepts such as Singular value decomposition, Standard deviation and Numerical derivative etc.

Image Processing

Digital Images are pixels arranged in the form of a Matrix. Matlab can be used for efficient processing of matrices. Hence it is convenient to do image processing operations Matlab project online homework help in Matlab. Basically there are two main types of Images. Gray scale and Color Images.

Gray scale Images are represented as an M X N matrix. Where, M is the number of rows in the image and N is the number of columns in the image. Each pixel in the image can have values in the range of 0 to 255. 0 represents black and 255 represents white. Matlab project online homework help Other values represent shades of gray. Color Images are represented as M X N X 3 matrices. Here the 3 denotes the R, G and B color planes. Matlab project online homework help Black and white image is also an M X N image. But the pixels can take either a zero or one. Where, zero represents black and one represents white.

clc
clear all
close all
% See pixels at position (1,1) and at random location.
fprintf('Pixels at position 1,1')
disp(inputImage(1,1,:))
fprintf('Pixels at Random Location')
disp(inputImage(100,300,:))
% Display the Input Image.
imshow(inputImage)>
title('Input Image')

The fundamental image processing tasks are reading and displaying images. Matlab project online homework help Since image files are generally in compressed (encoded) format, it requires appropriate decoding algorithms to read the pixel contents from image files. Matlab’s ‘imread’ Matlab project online homework help function can decode and get pixel values from many of the standard image file formats like ‘.jpg’, ‘.png’ and so on. ‘imshow’ function can be used to display the images.

Other basic image Matlab project online homework help manipulation operations are converting image from color to gray. As it is easier to process M X N matrices than M X N X 3 matrices, these conversion is necessary while Matlab homework help applying many processing algorithms to an image. Similarly Matlab project online homework help the histogram of an image represents the brightness distribution in a gray scale image. Adjusting the histogram of an image will Matlab project online homework help improve the contrast of the image.

Functions tested in Matlab and their purpose-

No. Function Name Purpose Example
1 Imread Reading Pixels of an Image. I = imread(‘myimage.jpg’)
2 Imshow Displaying an Image. imshow(I)
3 rgb2gray Color to Gray Conversion. J = rgb2gray(I)
4 Imhist Histogram of an Image. imhist(J)
5 Imadjust Contrast Stretching of an Image. J = imadjust(J)
6 im2bw Gray to Binary Conversion K = im2bw(J)

Table 1 Basic Image Processing Functions in Matlab

QR Algorithm

The QR Algorithm splits a matrix A into two parts Q and R. The Matrix A can be of any type. Q is an orthogonal matrix and R is an upper triangular matrix. The QR algorithm is a procedure to calculate eigen values and eigen vectors of a matrix. Matlab project online homework help The algorithm is numerically stable. Since the singular values of a Matrix also depends on its eigen features, QR algorithm can be used for efficient computation of singular values.

The widely used method for QR decomposition is based on Householder Matlab project online homework help transformation. The steps involved in performing QR decomposition using Householder method are listed below.

Algorithm (Householder QR)
for k = 1 : n (sum over columns)
x = A(k : m, k)
vk = x + sign(x(1))||x||e1
vk = vk/||vk||2
A(k : m, k : n) = A(k : m, k : n) − 2vk (v ∗ kA(k : m, k : n))
End

Singular Value Decomposition

The singular value decomposition of a matrix A is the Matlab project online homework help factorization of A into the product of three matrices A = UDV T where the columns of U and V are orthonormal and the matrix D is diagonal with positive real entries. The SVD is useful in many tasks. In many applications, Matlab project online homework help the data matrix A is close to a matrix of low rank and it is useful to find a low rank matrix which is a good approximation to the data matrix. From the singular value decomposition of A, we can get standard deviation in Matlab the matrix B of rank k which Matlab project online homework help best approximates A; in fact we can do this for every k. Also, singular value decomposition is defined for all matrices (rectangular or square) unlike the more commonly used spectral decomposition in Linear Algebra.

figure
subplot(1,2,1)
imhist(grayImage)
title('Histogram of Original Gray Image')
subplot(1,2,2)
imhist(adjustedImage)
title('Histogram of Adjusted Gray Inage')
bwImage = im2bw(grayImage);
figure
imshow(bwImage)
title('Black and White Image')

Eigenvectors and eigenvalues also need conditions on the matrix Matlab project online homework help to ensure orthogonality of eigenvectors. In contrast, the columns of V in the singular value decomposition, called the right singular vectors of A, always form an orthogonal set with no assumptions on A. The columns of U are called the left singular vectors and they also form an orthogonal set. A simple consequence of the orthogonality is that for a square and invertible matrix A, the inverse of A is V D−1UT.

s = size(inputImage);
fprintf('Image has %d Rows and %d Columns\n',s(1),s(2))
% Convert to Gray and Show Gray Image.
grayImage = rgb2gray(inputImage);
figure
imshow(grayImage)
title('Gray Image')
% View Histogram of Gray Image.
figure
imhist(grayImage)
% display Gray Image and Histogram in same figure.
figure
subplot(1,2,1)
imshow(grayImage)
title('Gray Image')
subplot(1,2,2)
imhist(grayImage)
title('Histogram of Gray Inage')
% Contrast stretch and show the Adjusted Image.
adjustedImage = imadjust(grayImage);
figure
imshow(adjustedImage)
title('Contrast Stretched Image') 

Image Compression Using Singular Values

            Image compression is the process of representing Image data using fewer memory. So Image compression is generally finding a subset of minimal Matlab project assignment help coefficients that can best represent an image with little or no loss in image quality.

Due to the excellent approximation properties of singular values, they are a Matlab project online homework help natural choice for compression.

To compression an numerical derivative Matlab image using its singular values, the following steps need to be followed.

  • If the image is color image process each plane separately.
  • Find the SVD of image matrix.
Keep only the n largest singular values and their corresponding left and right singular vectors.
Decompression can be performed as simple Matrix image processing multiplication
% Show histograms before and after adjustment.
figure
subplot(1,2,1)
imhist(grayImage)
title('Histogram of Original Gray Image')
subplot(1,2,2)
imhist(adjustedImage
title('Histogram of Adjusted Gray Inage'
% Find and display the black and white image.
bwImage = im2bw(grayImage);
figure
imshow(bwImage)
title('Black and White Image')

Basic Image Processing Operations-

fprintf('Pixels at position 1,1')
disp(inputImage(1,1,:))
fprintf('Pixels at Random Location')
disp(inputImage(100,300,:))
% Display the Input Image.
imshow(inputImage)
title('Input Image')
% Find Image Size.
s = size(inputImage);
fprintf('Image has %d Rows and %d Columns\n',s(1),s(2))
% Convert to Gray and Show Gray Image
grayImage = rgb2gray(inputImage);
figure
imshow(grayImage)
title('Gray Image')
% View Histogram of Gray Image.
figure
imhist(grayImage)
% display Gray Image and Histogram in same figure.
figure
subplot(1,2,1)
imshow(grayImage)
title('Gray Image')
subplot(1,2,2)
imhist(grayImage)
title('Histogram of Gray Inage')
% Contrast stretch and show the Adjusted Image.
adjustedImage = imadjust(grayImage);
figure
imshow(adjustedImage)
title('Contrast Stretched Image')
% Show histograms before and after adjustment.
figure
subplot(1,2,1)
imhist(grayImage)
title('Histogram of Original Gray Image')
subplot(1,2,2)
imhist(adjustedImage)
title('Histogram of Adjusted Gray Inage')
% Find and display the black and white image.
bwImage = im2bw(grayImage);
figure
imshow(bwImage)
title('Black and White Image')
Computing Singular values using QR algorithm
unction [U, S, V] = qrsingular(A)
[m,n] = size(A);
if(m <= n)
A = A';
[m, n] = size(A);
end
Q = eye(m);
R = A;
% Perform Transformations.
for j = 1:n
normx = norm(R(j:end,j));
s = -sign(R(j,j));
u1 = R(j,j) - s*normx;
w = R(j:end,j)/u1;
w(1) = 1;
tau = -s*u1/normx;
% Save Results
R(j:end,:) = R(j:end,:)-(tau*w)*(w'*R(j:end,:));
Q(:,j:end) = Q(:,j:end)-(Q(:,j:end)*w)*(tau*w)';
end
% Find Singular Values from decomposed Matrix.
C = (Q*R)'*(Q*R);
[V,D] = eig(C);
clear C;
[d,ix] = sort(abs(diag(D)),'descend');
V = V(:,ix);
U = Q*R*V;
s = sqrt(d);
U = bsxfun(@(x,c)x./c, U, s');
S = diag(s);
end
Singular Value Decomposition using SVD
inputImage = imread('your group.jpg');
% Display the Input Image.
imshow(inputImage)
title('Input Image')
% Convert to Gray and Show Gray Image.
grayImage = rgb2gray(inputImage);
figure
imshow(grayImage)
title(' Input Gray Image')
% Perform SVD.
[U, S, V] = svd(double(grayImage));
% Plot the singular Values
figure
plot(diag(S));
grid on
title('Distribution of Singular Values')
Compression
Grayscale Images
inputImage = imread('your group.jpg');
% Display the Input Image.
imshow(inputImage)
title('Input Image')
% Convert to Gray and Show Gray Image.
grayImage = rgb2gray(inputImage);
figure
imshow(grayImage)
title(' Input Gray Image')
% Perform SVD.
[U, S, V] = svd(double(grayImage));
% Compress using different Values of k
k = [1, 11, 31, 51];
h1 = figure;
h2 = figure;
for i = 1:4
compressedImage = U(:,1:k(i))*S(1:k(i),1:k(i))*V(:,1:k(i))';
figure(h1)
subplot(2,2,i);
imshow(uint8(compressedImage))
title(sprintf('Compressed Image with k = %d',k(i)))
residual = abs(uint8(compressedImage) - grayImage);
figure(h2)
subplot(2,2,i);
imshow(residual)
title(sprintf('Residual with k = %d',k(i)))
end
% Compression of Color Image using SVD.
% Read an Input Image
inputImage = imread('your group.jpg');
% Display the Input Image.
imshow(inputImage)
title('Input Image')
% Compress using different Values of k
k = [1, 11, 31, 51];
planes = 'RGB';
h1 = figure;
h2 = figure;
compressedImage = inputImage;
residual = inputImage;
for i = 1:4
for j = 1:3
% Perform SVD.
[U, S, V] = svd(double(inputImage(:,:,j)));
compressedImage(:,:,j) = U(:,1:k(i))*S(1:k(i),1:k(i))*V(:,1:k(i))';
residual(:,:,j) = abs(uint8(compressedImage(:,:,j)) - inputImage(:,:,j));
end
figure(h1)
subplot(2,2,i);
imshow(uint8(compressedImage))
title(sprintf('Compressed Image with k = %d',k(i)))
figure(h2)
subplot(2,2,i);
imshow(residual)
title(sprintf('Residual with k = %d',k(i)))
end