imtile does not work with cell array of images
33 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Massimo Bassan
el 1 de En. de 2026 a las 10:49
Editada: Walter Roberson
el 1 de En. de 2026 a las 20:45
Documentation for IMTILE says I can assign a cel array of images as an input variable.
This is instead what happens when I try to use it this way:
immag =
1×4 cell array
{1×1 Image} {1×1 Image} {1×1 Image} {1×1 Image}
>> otta=imtile(immag)
Error using images.internal.getImageFromFile (line 9)
The specified filename is not a string.
Thanks !
I add the whole tree of errors, it might be useful:
Error using images.internal.getImageFromFile (line 9)
The specified filename is not a string.
Error in images.internal.createMontage>getOneImage (line 339)
[I, map] = images.internal.getImageFromFile(imgSource{k});
Error in images.internal.createMontage>getImages (line 209)
img = getOneImage(imgSource,useIndexedRead, idxs(1), cmap);
Error in images.internal.createMontage (line 66)
imageArray = getImages( imgSrc, thumbnailSize, thumbnailInterp, ...
Error in imtile (line 9)
out = images.internal.createMontage(Isrc, thumbnailSize, thumbnailInterp, ...
0 comentarios
Respuestas (3)
Star Strider
el 1 de En. de 2026 a las 11:49
It seems obvious --
immag =
1×4 cell array
{1×1 Image} {1×1 Image} {1×1 Image} {1×1 Image}
>> otta=imtile(immag)
Error using images.internal.getImageFromFile (line 9)
The specified filename is not a string.
See the imtile documentation section on filenames for details. They have to be file names of the images, not the images themselves.
0 comentarios
Stephen23
el 1 de En. de 2026 a las 20:00
Editada: Stephen23
el 1 de En. de 2026 a las 20:01
"imtile does not work with cell array of images"
Yes, it does:
C = {rand(2,4,3),rand(2,4,3)};
I = imtile(C);
image(I)
The documentation here:
clearly states that it accepts a cell array of numeric images. My example above shows that this works exactly as documented. Your code does not work because you provided a cell array containing some kind of special class, which are clearly not numeric arrays.
0 comentarios
DGM
el 1 de En. de 2026 a las 20:09
Editada: DGM
el 1 de En. de 2026 a las 20:15
You're feeding montage()/imtile() a cell array of graphics objects, not raster image arrays or filenames. I'm going to use montage() for this demonstration for simplicity, but the input handling is the same.
% these are filenames
fnameA = 'peppers.png';
fnameB = 'cameraman.tif';
% these are raster images (numeric arrays)
A = imread(fnameA);
B = imread(fnameB);
% these are graphics objects of type matlab.graphics.primitive.Image
objA = imshow(A); figure;
objB = imshow(B);
% montage()/imtile() work with filename inputs
figure;
montage({fnameA,fnameB})
% ... or with raster arrays
figure;
montage({A,B})
% but they do not accept graphics objects
figure;
montage({objA,objB})
You either need to extract the raster data from the objects, or better yet just use the original data instead.
% or something
montage({objA.CData,objB.CData})
0 comentarios
Ver también
Categorías
Más información sobre Modify Image Colors en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



