<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274</link>
    <title>MATLAB Central Newsreader - Displaying grid of images</title>
    <description>Feed for thread: Displaying grid of images</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 23 Mar 2009 03:35:02 -0400</pubDate>
      <title>Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#636828</link>
      <author>Yaroslav Bulatov</author>
      <description>How can I display a grid of images with no space between the images? I've tried subplot-&amp;gt;imshow-&amp;gt;subplotspace, but it's hard to get it to leave no space, and it's very slow to execute</description>
    </item>
    <item>
      <pubDate>Mon, 23 Mar 2009 08:34:01 -0400</pubDate>
      <title>Re: Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#636857</link>
      <author>Gavrilo Bozovic</author>
      <description>&quot;Yaroslav Bulatov&quot; &amp;lt;yaroslavvb@gmail.com&amp;gt; wrote in message &amp;lt;gq7016$a24$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; How can I display a grid of images with no space between the images? I've tried subplot-&amp;gt;imshow-&amp;gt;subplotspace, but it's hard to get it to leave no space, and it's very slow to execute&lt;br&gt;
&lt;br&gt;
This will look terrible, but it's the only thing I can think of:&lt;br&gt;
&lt;br&gt;
generate arrays for the X and Y coordinates of your points. Then, make surface plots of each image in the same axes, shifting the X and Y arrays to reach the desired position in the grid.&lt;br&gt;
&lt;br&gt;
If you use a gray colorscale, and orient the representation correctly, you'll obtain your grid of images.&lt;br&gt;
&lt;br&gt;
e.g.:&lt;br&gt;
&lt;br&gt;
% A = 640 x 480 x n x m array of images&lt;br&gt;
&lt;br&gt;
x = 1:640;&lt;br&gt;
y = 1:480;&lt;br&gt;
&lt;br&gt;
[X, Y] = meshgrid(x,y)&lt;br&gt;
&lt;br&gt;
figure&lt;br&gt;
colorscale(grey)&lt;br&gt;
view([0 90])&lt;br&gt;
&lt;br&gt;
for i=0:n-1&lt;br&gt;
&amp;nbsp;&amp;nbsp;for j=0:m-1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;surf(X+i*640, Y+j*480, A(:,:,i,j));&lt;br&gt;
&amp;nbsp;&amp;nbsp;end&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
Consider it as pseudocode, I haven't tested it. And again, while this will work, I'm not at all sure it will be faster!</description>
    </item>
    <item>
      <pubDate>Mon, 23 Mar 2009 08:55:03 -0400</pubDate>
      <title>Re: Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#636859</link>
      <author>Gavrilo Bozovic</author>
      <description>&quot;Gavrilo Bozovic&quot; &amp;lt;gavrilo.dot.bozovic@gmail.dot.ch&amp;gt; wrote in message &amp;lt;gq7hhp$qa4$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Yaroslav Bulatov&quot; &amp;lt;yaroslavvb@gmail.com&amp;gt; wrote in message &amp;lt;gq7016$a24$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; How can I display a grid of images with no space between the images? I've tried subplot-&amp;gt;imshow-&amp;gt;subplotspace, but it's hard to get it to leave no space, and it's very slow to execute&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This will look terrible, but it's the only thing I can think of:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; generate arrays for the X and Y coordinates of your points. Then, make surface plots of each image in the same axes, shifting the X and Y arrays to reach the desired position in the grid.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If you use a gray colorscale, and orient the representation correctly, you'll obtain your grid of images.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; e.g.:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; % A = 640 x 480 x n x m array of images&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x = 1:640;&lt;br&gt;
&amp;gt; y = 1:480;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; [X, Y] = meshgrid(x,y)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; figure&lt;br&gt;
&amp;gt; colorscale(grey)&lt;br&gt;
&amp;gt; view([0 90])&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; for i=0:n-1&lt;br&gt;
&amp;gt;   for j=0:m-1&lt;br&gt;
&amp;gt;     surf(X+i*640, Y+j*480, A(:,:,i,j));&lt;br&gt;
&amp;gt;   end&lt;br&gt;
&amp;gt; end&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Consider it as pseudocode, I haven't tested it. And again, while this will work, I'm not at all sure it will be faster!&lt;br&gt;
&lt;br&gt;
Sorry, it would be A(:,:,i+1,j+1) !!</description>
    </item>
    <item>
      <pubDate>Mon, 23 Mar 2009 10:24:43 -0400</pubDate>
      <title>Re: Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#636870</link>
      <author>ImageAnalyst</author>
      <description>Yaroslav Bulatov:&lt;br&gt;
I think Oliver Woodford's imdisp() in the File Exchange might be able&lt;br&gt;
to do that.  Or have you taken a look at the montage() function in the&lt;br&gt;
image processing toolbox?&lt;br&gt;
Regards,&lt;br&gt;
ImageAnalyst</description>
    </item>
    <item>
      <pubDate>Mon, 23 Mar 2009 12:44:01 -0400</pubDate>
      <title>Re: Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#636905</link>
      <author>Oliver Woodford</author>
      <description>&quot;Yaroslav Bulatov&quot; wrote:&lt;br&gt;
&amp;gt; How can I display a grid of images with no space between the images? I've tried subplot-&amp;gt;imshow-&amp;gt;subplotspace, but it's hard to get it to leave no space, and it's very slow to execute&lt;br&gt;
&lt;br&gt;
ImageAnalyst is correct. IMDISP on the FEX (&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22387)&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22387)&lt;/a&gt; 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.&lt;br&gt;
&lt;br&gt;
Note that MATLAB's montage function will do something similar, but it creates a single image from the input images and displays this.</description>
    </item>
    <item>
      <pubDate>Wed, 22 Apr 2009 23:30:19 -0400</pubDate>
      <title>Re: Displaying grid of images</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/247274#644779</link>
      <author>Yaroslav Bulatov</author>
      <description>&quot;Oliver Woodford&quot; &amp;lt;o.j.woodford.98@cantab.net&amp;gt; wrote in message &amp;lt;gq806h$jbo$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Yaroslav Bulatov&quot; wrote:&lt;br&gt;
&amp;gt; &amp;gt; How can I display a grid of images with no space between the images? I've tried subplot-&amp;gt;imshow-&amp;gt;subplotspace, but it's hard to get it to leave no space, and it's very slow to execute&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ImageAnalyst is correct. IMDISP on the FEX (&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/22387)&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/22387)&lt;/a&gt; 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.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Note that MATLAB's montage function will do something similar, but it creates a single image from the input images and displays this.&lt;br&gt;
&lt;br&gt;
Thanks, that worked. Code below displays images from a directory in a 3x3 grid &lt;br&gt;
&lt;br&gt;
close all;&lt;br&gt;
root='9sample/';&lt;br&gt;
wildcard=strcat(root,'*.jpg');&lt;br&gt;
files=dir(wildcard);&lt;br&gt;
imarray=cell(numel(files));&lt;br&gt;
for i=1:numel(files)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;disp(files(i).name);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fullpath=strcat(root,files(i).name);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;im=imread(fullpath);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;imarray{i}=im;&lt;br&gt;
end&lt;br&gt;
imdisp(imarray, 'Size', [3 3])</description>
    </item>
  </channel>
</rss>

