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
2019-10-13
Why are you even using eval?
Walter Roberson
2019-10-13
编辑:Walter Roberson
2019-10-13
Just use
img = imread(str);
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!