getting error in processing eval('img=​imread(str​);');

% number of images on the training set.
M = 14;
%read and show images(jpg);
% S will store all the images
S=[];
figure(1);
for i=1:M
str = strcat('instructors/', int2str(i));
str = strcat(str, '.jpg');
eval('img=imread(str);');
img = rgb2gray(img);
img = imresize(img, [300,300]);
subplot(ceil(sqrt(M)),ceil(sqrt(M)),i)
imshow(img)
if i==3
title('Course Intructors','fontsize',14)
end
drawnow;
% save the dimensions of the image (irow, icold)
[irow, icol]=size(img);
% creates a (N1*N2) x 1 matrix and add to S
temp=reshape(img',irow*icol,1);
%S will eventually be a (N1*N2) x M matrix.
S=[S temp];
end

댓글 수: 2

Daniel M
Daniel M 2019년 10월 13일
Why are you even using eval?
Just use
img = imread(str);

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품

질문:

2019년 10월 13일

편집:

2019년 10월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by