size of image

4 views (last 30 days)
FIR
FIR on 7 Oct 2011
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 Comment
Jan
Jan on 7 Oct 2011
The question is not clear. I recommend to show the used Matlab commands.

Sign in to comment.

Accepted Answer

Wayne King
Wayne King on 7 Oct 2011
size(data,3)
  4 Comments
FIR
FIR on 7 Oct 2011
sir wmri si a 3D ,but i have only 2D image ,if i process as u said ,i am getting an error,index exceeds matrix dimensions
Wayne King
Wayne King on 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

Sign in to comment.

More Answers (1)

Jonas Reber
Jonas Reber on 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 Comments
FIR
FIR on 7 Oct 2011
if i use cat i get an error as
CAT arguments dimensions are not consistent.
Jonas Reber
Jonas Reber on 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..
?

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!