How to create a 3d stack of multiple images in Matlab

Can someone help with creating a 3D stack in Matlab. I have used this line of codes, but it seems that my code stacks up the same image as many times as specified.
clear all;
Imatrix = [];
for i=1:500
images{i} = imread(sprintf('0001.tif',i));
Imatrix = cat(3, Imatrix, images{i});
end
I have a folder containing 500 images, and i want to stack the images serially as named.
Thanks

4 comentarios

How your images are named?
So, the code above generates a 3D matrix, which is what i want, but rather than selecting each element in my directory folder sequentially, the matrix generated contains same image 500 times.
Anand P
Anand P el 4 de Jun. de 2019
Is there any method to visualise the stack you have created in a 3D manner
bump

Iniciar sesión para comentar.

 Respuesta aceptada

images{i} = imread(sprintf('%04d.tif',i));

Más respuestas (2)

Depending on how your images are named, this line of code should look like
images{i} = imread(sprintf('000%d.tif',i));

Categorías

Etiquetas

Preguntada:

el 24 de Mayo de 2016

Comentada:

el 29 de Ag. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by