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!