matlab - Layering multiple images in 3D-space -
suppose have matrix of size 49x49x5, corresponding 5 images of size 49x49 stacked along third dimension have total of 5 images. these images should visualize density of gas in 3d space, can think of each image section cut of room @ different locations.
is there way make figure in matlab 5 images shown hanging in 3d space "came from"?
here image making clearer after:
consider following example. uses low-level surface function plot stacked images:
%# create stacked images (i repeating same image 5 times) img = load('clown'); = repmat(img.x,[1 1 5]); cmap = img.map; %# coordinates [x,y] = meshgrid(1:size(i,2), 1:size(i,1)); z = ones(size(i,1),size(i,2)); %# plot each slice texture-mapped surface (stacked along z-dimension) k=1:size(i,3) surface('xdata',x-0.5, 'ydata',y-0.5, 'zdata',z.*k, ... 'cdata',i(:,:,k), 'cdatamapping','direct', ... 'edgecolor','none', 'facecolor','texturemap') end colormap(cmap) view(3), box on, axis tight square set(gca, 'ydir','reverse', 'zlim',[0 size(i,3)+1])
i using indexed color images (with direct color mapping), can changed use grayscale images (with scaled color mapping).
now if want 3d space arranged have shown in question, interchange y , z dimensions (images stacked along y-dimension instead of z-dimension).
in general, have more control on viewing angle, use camera manipulation functions.
Comments
Post a Comment