getting error in processing eval('img=imread(str);');
Show older comments
% 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 Comments
Daniel M
on 13 Oct 2019
Why are you even using eval?
Walter Roberson
on 13 Oct 2019
Edited: Walter Roberson
on 13 Oct 2019
Just use
img = imread(str);
Answers (0)
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!