Borrar filtros
Borrar filtros

cant display my new image

2 visualizaciones (últimos 30 días)
asaf omer
asaf omer el 10 de Abr. de 2021
Comentada: asaf omer el 10 de Abr. de 2021
hello,
i have an excericse ;
i have a little pic of mozart and a big one. i seperated my big pic into 30 pieces and replaced them with the small one, now i cant show my image. can any1 help please?
a=imread('smallMozart.tiff'); # the size is 38x25
b=imread('bigMozart.tiff'); # the size is 1140x750
disp(size(b));
disp(size(a));
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
for i=1:30
for j=1:30
c{i,j}=a;
end
end
imshow(c)
thanks
  1 comentario
Jan
Jan el 10 de Abr. de 2021
Editada: Jan el 10 de Abr. de 2021
You get an error message, if you provide a cell array to the imshow command. Then it i useful to share the message with the readers. It is easier to solve a problem than to guess, what the problem is.
Why do you create c by mat2cell only to overwrite it immediately?
Avoid monsters as:
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
Easier to read:
c = mat2cell(b, repmat(38, 1, 30), repmat(25, 1, 30));
You can simplify:
for i=1:30
for j=1:30
c{i,j}=a;
end
end
to:
c(:) = {a};

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 10 de Abr. de 2021
imshow does not accept cell arrays as input. It needs a matrix.
Either create this matrix directly:
d = repmat(a, 30, 30);
or join the cell elements:
d = cell2mat(c);

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by