Matlab coding http://courses.washington.edu/am301/hw/pics.mat Download a library
ID: 3845112 • Letter: M
Question
Matlab coding
http://courses.washington.edu/am301/hw/pics.mat
Download a library of 40 faces (Resolution 96 times 64) from http://courses.washington.edu/am301/hw/pics.mat However DO NOT upload pics.mat to Scorelator. Use load to import the data to Matlab. The first 10 faces are: for j = 1:10 subplot (2, 5, j): pcolor (pics(:,:, j)): shading interp: colormap (gray): end a. Calculate the "average" face of the 40 faces. Save the average face as a 96 times 64 matrix in A1. dat using the "save -ascii" command. b. Subtract the average face from all 40 images. The resultant 40 images are thus the anomalous faces. Save the first anomalous face as a 96 times 64 matrix in A2.dat using the "save -ascii" command.Explanation / Answer
clear all
clc
%To detect Face
FDetect = vision.CascadeObjectDetector;
%Read the input image
I = imread('HarryPotter.jpg');
%Returns Bounding Box values based on number of objects
BB = step(FDetect,I);
figure,
imshow(I); hold on
for i = 1:size(BB,1)
rectangle('Position',BB(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
end
title('Face Detection');
hold off;
----------------------------------------------------------------------------------------------------------------------------------------------------------------------Based on Viola-Jones face detection algorithm, the computer vision system toolbox contains vision.CascadeObjectDetector System object which detects objects based on above mentioned algorithm.
Hope this helps a little.