displayImages

PURPOSE ^

displayImage - display a set of images of the same size (bx, by) on

SYNOPSIS ^

function im = displayImages(images,ncol,bx,by,normalize, widthMargin, heightMargin)

DESCRIPTION ^

 displayImage - display a set of images of the same size (bx, by) on 
   a specified tabular.

 ncol: number of columns

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function im = displayImages(images,ncol,bx,by,normalize, widthMargin, heightMargin)
0002 % displayImage - display a set of images of the same size (bx, by) on
0003 %   a specified tabular.
0004 %
0005 % ncol: number of columns
0006 
0007 if nargin < 5
0008     normalize = true;
0009 end
0010 
0011 if nargin < 6
0012     widthMargin = 5;
0013     heightMargin = 5;
0014 end
0015 
0016 n = length(images);
0017 nrow = ceil(n/ncol);
0018 width = by*ncol + (ncol-1)*widthMargin;
0019 height = bx*nrow + (nrow-1)*heightMargin;
0020 im = 255-zeros(height,width);
0021 for i=1:n
0022     row = ceil(i/ncol);
0023     col = i-(row-1)*ncol;
0024     startx = (row-1)*(bx+heightMargin);
0025     starty = (col-1)*(by+widthMargin);
0026     towrite = imresize(double(images{i}),[bx,by]);
0027     if normalize
0028         towrite = uint8(255 * (towrite-min(towrite(:)))/(max(towrite(:))-min(towrite(:))));
0029     else
0030         towrite = uint8(towrite);
0031     end
0032     im((startx+1):(startx+bx),(starty+1):(starty+by)) = towrite;
0033 end
0034 im = uint8(im);

Generated on Sat 23-Jan-2010 22:26:10 by m2html © 2005