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

2 visualizaciones (últimos 30 días)
Rohitash Kumar Saini
Rohitash Kumar Saini el 13 de Oct. de 2019
Editada: Walter Roberson el 13 de Oct. de 2019
% 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 comentarios
Daniel M
Daniel M el 13 de Oct. de 2019
Why are you even using eval?
Walter Roberson
Walter Roberson el 13 de Oct. de 2019
Editada: Walter Roberson el 13 de Oct. de 2019
Just use
img = imread(str);

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by