Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Solve the question using a simple MATLAB code and answer each and every sub - questions mentioned in attached image. Write a brief executive summary,
Solve the question using a simple MATLAB code and answer each and every subquestions mentioned in attached image. Write a brief executive summary, answer to the all underlined questions and the significant images, add brief comments and write a clear explanation of why we wrote that step and what output we get.
Thank You.
Note: below is the MATLAB code that I got from previous expert but its not satisfactory. In which I got below mentioned error please rectify it
project
Arrays have incompatible sizes for this operation.
Error in projectline
normdiffi normcoefficients meandata:i:i normcoefficients;
Write more explanations and what outputs we got.
Project
Step : Read, convert to black and white, resize images
om imresizedoublergbgrayimreadMyobamajpg;
om imresizedoublergbgrayimreadMyobamajpg;
om imresizedoublergbgrayimreadMyobamajpg;
c imresizedoublergbgrayimreadClooneyjpg;
c imresizedoublergbgrayimreadClooneyjpg;
c imresizedoublergbgrayimreadClooneyjpg;
t imresizedoublergbgrayimreadThatcherjpg;
t imresizedoublergbgrayimreadThatcherjpg;
t imresizedoublergbgrayimreadThatcherjpg;
Step : Reshape images to vectors
omvec reshapeom;
omvec reshapeom;
omvec reshapeom;
cvec reshapec;
cvec reshapec;
cvec reshapec;
tvec reshapet;
tvec reshapet;
tvec reshapet;
Step : Calculate average image and average vector
omave om om om;
cave c c c;
tave t t t;
omavevec reshapeomave, ;
cavevec reshapecave, ;
tavevec reshapetave, ;
Step : Plot training images
figure;
subplot; pcolorflipudom; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudom; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudom; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudc; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudc; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudc; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudt; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudt; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
subplot; pcolorflipudt; shading interp; colormapgray; setgca 'Xtick', 'Ytick', ;
Step : Plot average images
figure;
subplot; colormapgray;
pcolorflipudomave; shading interp;
subplot; colormapgray;
pcolorflipudcave; shading interp;
subplot; colormapgray;
pcolorflipudtave; shading interp;
Step : Create data matrix
data cvec cvec cvec tvec tvec tvec omvec omvec omvec;
datadim sizedata;
datarank rankdata;
singularvalues svddata;
Step : Evaluate covariance matrix
covmat covdata;
Step : Calculate first eigenvalues and eigenvectors
eigenvectors eigenvalues eigscovmat, ;
Step : Transform test image into column vector
testimg imresizedoublergbgrayimreadobamajpg;
testimgvec reshapetestimg, ;
Step : Evaluate coefficients of expansion
coefficients eigenvectors' testimgvec;
reconstructedimgvec eigenvectors coefficients;
Step : Plot coefficients
figure;
barcoefficients;
Step : Plot remaining coefficients
figure;
barcoefficients:end;
Step : Plot coefficients of test image
figure;
barcoefficients;
Step : Calculate normalized difference
normdiff zeros;
for i :
normdiffi normcoefficients meandata:i:i normcoefficients;
end
Step : Plot test image and reconstruction
figure;
subplot; imshowuinttestimg;
titleOriginal Test Image';
subplot; imshowuintreshapereconstructedimgvec, ;
titleReconstructed Test Image';
Step : Calculate normalized error
normalizederror zeros;
for i :
normalizederrori normcoefficients meandata:i:i normmeandata:i:i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started