Home > vbmeg > functions > plotfunc > subdirectory > vb_plot_2d_image.m

vb_plot_2d_image

PURPOSE ^

Plot 2D image

SYNOPSIS ^

function h = vb_plot_2d_image(B2,mode)

DESCRIPTION ^

 Plot 2D image 
  h = vb_plot_2d_image(B, mode)

 B : 2D-image [NBx, NBy]
 --- Optional input
 mode : 2D plot mode for X-Y 
      = 0   : plot without transpose
      = 1   : plot by transposing 2D-image matrix

 written by M. Sato  2005-8-1
 Modified by M Sato  2007-3-16

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    h = vb_plot_2d_image(B2,mode)
0002 % Plot 2D image
0003 %  h = vb_plot_2d_image(B, mode)
0004 %
0005 % B : 2D-image [NBx, NBy]
0006 % --- Optional input
0007 % mode : 2D plot mode for X-Y
0008 %      = 0   : plot without transpose
0009 %      = 1   : plot by transposing 2D-image matrix
0010 %
0011 % written by M. Sato  2005-8-1
0012 % Modified by M Sato  2007-3-16
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 if ~exist('mode','var'), mode = 0; end;
0018 
0019 % Image dimension
0020 [NX ,NY] = size(B2);
0021 
0022 X = 1:NX;
0023 Y = 1:NY;
0024 
0025 if mode==0
0026     % Flip X-Y
0027     % Index color -> True color
0028     B3 = repmat(B2',[1 1 3]);
0029 
0030     h = image(X, Y, B3, 'CDataMapping','scaled');
0031     set(gca,'YDir','normal','XLimMode','manual','YLimMode','manual');
0032 else
0033     % Index color -> True color
0034     B3 = repmat(B2,[1 1 3]); 
0035     
0036     h = image(Y, X, B3, 'CDataMapping','scaled');
0037 end
0038 
0039 colormap('gray');
0040 axis equal
0041 axis tight

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005