size of image

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 个评论

Jan
Jan 2011-10-7
The question is not clear. I recommend to show the used Matlab commands.

请先登录,再进行评论。

 采纳的回答

size(data,3)

4 个评论

FIR
FIR 2011-10-7
if i do as u said i get answer as one,i need it as 15,which is number of imaged,which is 2D
i have 2D IMAGE
I need it as
256*256*15
Then store your image as 3-D to begin with. For example:
load wmri;
% X is 128x128x7
imagesc(X(:,:,1)); % first slice
imagesc(X(:,:,2)); % second slice
imagesc(X(:,:,3)); % third slice
size(X,3)
FIR
FIR 2011-10-7
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
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

请先登录,再进行评论。

更多回答(1 个)

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 个评论

FIR
FIR 2011-10-7
I HAVE THOSE 15 IMAGES IN .MAT FILE OF SAME SIZE
NEXT QUESTION:IS it possible to create a stack frpm thode 15 images which i have stored
FIR
FIR 2011-10-7
if i use cat i get an error as
CAT arguments dimensions are not consistent.
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..
?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by