When I open a images and add them into a class the db.mat shows only the latest image details and other image details are missing. Can you please explain what I have missed in the code?
1 view (last 30 days)
Show older comments
[fname path]=uigetfile('.jpg','Open a face as input for training');
fname=fulfile(path,fname);
im=imread(fname);
imshow(im);
title('Input image');
c=input('Enter the Class (Number from 1-10)','s');
%%Feature extraction
F=FeatureStatistical(im);
try
load db;
F = [F c];
db = [db;F];
F = [m s];
save db.mat db
catch
db=[F c]; % 10 12 1
save db.mat db
end
function [F]=FeatureStatistical(im)
im=double(im);
m=mean(im(:));
s=std(im(:));
F=[m s];
end
0 Comments
Answers (1)
Kojiro Saito
on 3 Dec 2018
I think you need to change try-cacth statetments. Leave only load db code. And I guess you need to convert charcter c to double so that concat works fine.
try
load db;
catch
db = [];
end
F = [F str2double(c)];
db = [db;F];
save db.mat db
4 Comments
Kojiro Saito
on 4 Dec 2018
In my environment, it works with no errors. What the size of F and db?
size(F)
it returns [1 3] ?
And
size(db)
returns [n 3] ? (n is integer such as 1, 2 and so on.)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!