size of image
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Réponse acceptée
Wayne King
le 7 Oct 2011
size(data,3)
4 commentaires
Wayne King
le 7 Oct 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
Plus de réponses (1)
Jonas Reber
le 7 Oct 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 commentaires
Jonas Reber
le 7 Oct 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..
?
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!