# MATLAB PROJECTS FOR ENGINEERING STUDENTS

Matlab projects for engineering students are implemented to submit their academic projects in an efficient manner. Simulation tool will help us to enlarge their concepts in an effective and accurate manner. Engineering students selected concepts under image processing and its sub domains.

Matlab Features:

• Matrices and vectors.
• Graphics.
• Arithmetic Operators.
• Data Handling.

Need for Matlab Simulation:

• Holistic Language Design.
• Language Interoperability.
• Balance of high level and low level programming.

Methods Implemented on Matlab:

• Dictionary learning.
• Multi-Resolution Hierarchical Processing.
• Edge Preserving Denoising.

Knowledge Extraction Concepts on Matlab:

• Visual Search
• Semantic Retrieval
• Image and Video Annotation

Operations of Matlab Image Processing Toolbox:

• Read and Display an image.
• Converting graphics file formats.
• Converting image storage classes.

Applications of MATLAB PROJECTS FOR ENGINEERING STUDENTS:

• Video processing.
• High quality color representation.
• Registration techniques.
• Facsimile.

Sample Code for Shape Descriptor Based Feature Extraction – MATLAB PROJECTS FOR ENGINEERING STUDENTS

% The descriptor. Includes Normalization.
function [vec levels] = hierarchicalCentroid1(im, d, plotFlag)

p = hierarchicalCentroidRec(im, 1, d);

if plotFlag % Illustration
showLines(im, p);
end

meany = ([1:size(im,1)]*sum(im,2))/sum(sum(im));
indVer = (mod(p(:,2),2) == 1);
% Normalization for location:
p(indVer,1) = p(indVer,1) – p(1,1);
p(~indVer,1) = p(~indVer,1) – meany;

% Normalization for size (keeping aspect ratio):
p(:,1) = p(:,1)/size(im,1);
% Normalization for size:
% p(indVer,1) = p(indVer,1)/size(im,2);
% p(~indVer,1) = p(~indVer,1)/size(im,1);

% Illustration of the lines after normalization without the image
% showLines([], p);

vec = p(2:end,1)’;
levels = p(2:end,2)’;
end
function p = hierarchicalCentroidRec(im, depth, maxDepth)
if depth > maxDepth
p = [];
else
area = sum(sum(im));[rows,cols] = size(im);
% compute the centroid-x
if cols == 1
centroid = 0.5;
elseif area == 0
centroid = cols/2;
elseif rows == 1
centroid = (im*[1:cols]’)/area;
else
centroid = sum(im)*[1:cols]’/area;
end

leftIm = im(:,1:floor(centroid));
rightIm = im(:,ceil(centroid):end);

pLeft = hierarchicalCentroidRec(leftIm’ , depth+1, maxDepth);
pRight = hierarchicalCentroidRec(rightIm’ , depth+1, maxDepth);

% Updates the distances so they will be in relation to the complete image
if size(pRight,1) > 1
ind = find((1-mod(depth,2))-mod(pRight(2:end,2),2)) + 1;
pRight(ind,1) = pRight(ind,1) + ceil(centroid) – 1;
pRight(1,1) = pRight(1,1) – 1;
end

p = [centroid, depth; pLeft; pRight];
end
end

Sample Code for EMD Based Image Retrieval – MATLAB PROJECTS FOR ENGINEERING STUDENTS:

%% Image Retrieval with SR-EMD
fprintf(‘——————————————————————————————\n’);
fprintf(‘Performing image retrieval \n’);
start_time = round(clock);

SR_EMD_para = struct();
SR_EMD_para.DistanceType = ‘EMD-theta’; % ‘EMD-M’ ‘EMD-theta’
SR_EMD_para.theta = 0.5; %default theta
SR_EMD_para.M = eye(16); %M should be symmetric positive definite (SPD) matrix and is the identity matrix in default[U S V]=svd(SR_EMD_para.M);
SR_EMD_para.M_one_half = U * diag(sqrt(diag(S))) * V’; %the square root matrix of SR_EMD_para.M, i.e. SR_EMD_para.M = SR_EMD_para.M_one_half * SR_EMD_para.M_one_half, which is also a SPD matrix
SR_EMD_para.k = 0; % used in gmmknnclasify.m

iter_max = 50;
acc = zeros(iter_max, 1);

for iter = 1: iter_max;

% Select in random the training files
training_files_all = cell(length(categories_dir), 1);
test_files_all = cell(length(categories_dir), 1);

rp_dir = fullfile(‘Common\WANG\rplist’, sprintf(‘rp%s.mat’, num2str(iter)));
order_dir = fullfile(‘Common\WANG\rplist\order.mat’);
for i=1:length(categories_dir)
model_dir = fullfile(base_model_dir, sprintf(‘%s’, categories_dir(i).name));[training_files test_files] = training_test_images(model_dir, testid(order(i)));
training_files_all{i} = training_files;
test_files_all{i} = test_files;
end

% Load models of training images and obtain their labels
training_models = cell(length(categories_dir), 1);
for i=1:length(categories_dir)
end
training_labels_all = [];
for i=1:length(categories_dir)
training_labels = zeros(length(training_models{i}), 1);
training_labels(:) = i;
training_labels_all = [training_labels_all; training_labels];
end
training_models_all = [training_models{:}];
training_models_all = training_models_all(:);
SR_EMD_para.k = size(training_labels_all,1);
% Retrieval using SR-EMD
tempK = 1:SR_EMD_para.k;
parfor i=1:length(categories_dir)
test_models = load_models(test_files_all{i});[retrievalID BestK] = gmmknnclassify(test_models, training_models_all, training_labels_all, SR_EMD_para);
re_label = training_labels_all(retrievalID);
Ri_ID_idx = double(re_label == i);
Ri_ID = cumsum(Ri_ID_idx);
Ri_ID(find(re_label ~=i)) = 0;
precision = Ri_ID ./ tempK’;
acc(iter,i) = sum(precision) / length(training_models{i});
end
fprintf(‘Round %d MAP on Corel Wang dataset is %f \n’, iter, mean(acc(iter, :)));
end

fprintf(‘Average MAP result %d rounds of on %s %f \n’,iter_max, image_dataset, mean(mean(acc, 2)));

if matlabpool(‘size’) > 0
matlabpool close;
end

end_time = round(clock);
time_elapsed = end_time – start_time;
fprintf(‘Time elapsed is : %d hours %d minutes %d seconds\n’, time_elapsed(4), time_elapsed(5), time_elapsed(6));