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 次查看(过去 30 天)
显示 更早的评论
[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 个评论
回答(1 个)
Kojiro Saito
2018-12-3
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 个评论
Kojiro Saito
2018-12-4
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.)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!