size of image
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Wayne King
2011 年 10 月 7 日
size(data,3)
4 件のコメント
Wayne King
2011 年 10 月 7 日
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 件)
Jonas Reber
2011 年 10 月 7 日
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 件のコメント
Jonas Reber
2011 年 10 月 7 日
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!