Advertisement
amroamroamro

rgb images texture mapped

Jun 22nd, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.56 KB | None | 0 0
  1. % read first 5 frames of a video file
  2. vid = VideoReader('shuttle.avi');
  3. I = read(vid, [1 5]);  % (a HxWx3x5 array)
  4. clear vid
  5.  
  6. % coordinates
  7. [X,Y] = meshgrid(1:size(I,2), 1:size(I,1));
  8. Z = ones(size(I,1),size(I,2));
  9.  
  10. % plot each slice as a texture-mapped surface
  11. % (truecolor RGB images stacked along the Z-dimension)
  12. for k=1:size(I,4)
  13.     surface('XData',X-0.5, 'YData',Y-0.5, 'ZData',Z.*k, ...
  14.         'CData',I(:,:,:,k), 'EdgeColor','none', 'FaceColor','texturemap')
  15. end
  16. view(3), box on, axis tight square
  17. set(gca, 'YDir','reverse', 'ZLim',[0 size(I,4)+1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement