Error in resizing 3d image

I have a dataset of 3d images containing 30 images of different sizes,I want to resize all images to a paricular size
for example for 2d if we use imresize(I,[25 256]) all images in dataset will be resized
same way i tried for 3d using
J = resize(I,size(I).*[0.3 0.3 1])
but it is not reduced to a particular size,i need all images to have same size
say 256x256x3
please help

 채택된 답변

Image Analyst
Image Analyst 2012년 8월 29일

0 개 추천

If it's a color image (as opposed to a volumetric image, as from CT or MRI), you do it exactly the same way as for a gray scale image. No difference at all in the arguments to imresize.
rgbImage256 = imresize(rgbImage, [256 256]);

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2012년 8월 29일
편집: Andrei Bobrov 2012년 8월 29일

1 개 추천

try this code
A = randi(255,89,300,3,'uint8'); % eg first image
B = randi(255,100,200,3,'uint8'); % eg second image
AA = {A,B};
out = cellfun(@(x)imresize(x,[256 256]),AA,'un',0);

댓글 수: 3

kash
kash 2012년 8월 29일
i have a code as for 3d image as per ur code for single image
D=imread('peppers.png');
size(D);
D=uint8(D);
X={D};
out = cellfun(@(x)imresize(x,[256 256]),X,'un',0)
wen displaying as imshow(out) i get error as
Error using iptcheckinput
Function IMAGEDISPLAYVALIDATEPARAMS expected its first input, I,
to be one of these types:
double, single, uint8, uint16, uint32, int8, int16, int32, logical
Instead its type was cell.
Andrei Bobrov
Andrei Bobrov 2012년 8월 29일
편집: Andrei Bobrov 2012년 8월 29일
just for one image, my variant in answer for multiple image
D=imread('peppers.png');
out = imresize(D,[256 256]);
kash
kash 2012년 8월 29일
Thanks andre1

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

질문:

2012년 8월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by