1

I have an 3d image of dimensions(182 x 218 x 182).

How could I downsample this image in MATLAB to an image of equal dimensions (like 128 x 128 x 128)?

Adam Merckx
  • 1,122
  • 1
  • 14
  • 31

1 Answers1

3

Try this:

im=rand(2,3,4); %%% input image
ny=3;nx=3;nz=5; %% desired output dimensions
[y x z]=...
ndgrid(linspace(1,size(im,1),ny),...
      linspace(1,size(im,2),nx),...
      linspace(1,size(im,3),nz));
imOut=interp3(im,x,y,z);

I stole this answer from resizing 3D matrix (image) in MATLAB

Community
  • 1
  • 1
Johnfun10
  • 118
  • 8