Path: news.mathworks.com!not-for-mail
From: "Yaroslav Bulatov" <yaroslavvb@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Displaying grid of images
Date: Wed, 22 Apr 2009 23:30:19 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 22
Message-ID: <gso9ab$hqk$1@fred.mathworks.com>
References: <gq7016$a24$1@fred.mathworks.com> <gq806h$jbo$1@fred.mathworks.com>
Reply-To: "Yaroslav Bulatov" <yaroslavvb@gmail.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240443019 18260 172.30.248.37 (22 Apr 2009 23:30:19 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 22 Apr 2009 23:30:19 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1654135
Xref: news.mathworks.com comp.soft-sys.matlab:534825


"Oliver Woodford" <o.j.woodford.98@cantab.net> wrote in message <gq806h$jbo$1@fred.mathworks.com>...
> "Yaroslav Bulatov" wrote:
> > How can I display a grid of images with no space between the images? I've tried subplot->imshow->subplotspace, but it's hard to get it to leave no space, and it's very slow to execute
> 
> ImageAnalyst is correct. IMDISP on the FEX (http://www.mathworks.com/matlabcentral/fileexchange/22387) will do this easily for you, creating a grid of subplots. Simply stack the images along the 4th dimension or put them in a cell array, and use as the first argument. There is a 'Border' option (see help imdisp) which defines the space between images; the default is 0, leaving no space.
> 
> Note that MATLAB's montage function will do something similar, but it creates a single image from the input images and displays this.

Thanks, that worked. Code below displays images from a directory in a 3x3 grid 

close all;
root='9sample/';
wildcard=strcat(root,'*.jpg');
files=dir(wildcard);
imarray=cell(numel(files));
for i=1:numel(files)
    disp(files(i).name);
    fullpath=strcat(root,files(i).name);
    im=imread(fullpath);
    imarray{i}=im;
end
imdisp(imarray, 'Size', [3 3])