size of image
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sir i have 15 images,which i have formed into .mat file,it is an 2d images,if it was an 3D I GET SIZE 256*256*15,BUT IN 2D I GET ONLY 256*256,IS THERE ANY WAT TO GET THE THIRG COLUMN AS NUMBER OF IMAGES IN 2D,PLEASE SUGGEST
1 comentario
Respuesta aceptada
Wayne King
el 7 de Oct. de 2011
size(data,3)
4 comentarios
Wayne King
el 7 de Oct. de 2011
FIR, You can take your 2-D images and make them a 3-D image just like the data in wmri. All you have to do is:
1.) Create an array of zeros
X = zeros(256,256,15);
2.) put your first image, I'm going to call it image1, which is 256x256, into
X(:,:,1) = image1;
3.) Now take your second image, I'm going to call it image2 (256x256) into
X(:,:,2) = image2;
and so on. then you will have a 3-D dataset just like the data in wmri
Más respuestas (1)
Jonas Reber
el 7 de Oct. de 2011
how did you store your images? is it a 2d matrix?
did you store it like: (N images of size 3 by 4)
1 1 1 1
1 1 1 1
1 1 1 1
2 2 2 2
2 2 2 2
2 2 2 2
...
N N N N
N N N N
N N N N
or more
1 1 1 1 2 2 2 2 ... N N N N
1 1 1 1 2 2 2 2 ... N N N N
1 1 1 1 2 2 2 2 ... N N N N
do all the images have the same size?
I would advise you to save the images as Imarray = zeros(m size of image , n size of image, numer of images); Imarray(:,:,1) = image1 Imarray(:,:,2) = image2 ...
(or better - use cat)
3 comentarios
Jonas Reber
el 7 de Oct. de 2011
do you have 15 different mat files? for all those images?
are you aware of the function "imread"?
cat only works if all your images have the same size.
e.g
im1 = rand(4,3);
im2 = rand(4,3);
im3 = rand(4,3);
imarray = cat(3,im1,im2,im3);
otherwise you might want to use a cell array for your images...
imarray{1} = image1;
imarray{2} = image2;
...
and then you can use
numel(imarray)
to find your how many images you have
to display one of them use:
imshow(imarray{1},[]);
etc..
?
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!