<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878</link>
    <title>MATLAB Central Newsreader - Printing an image to scale</title>
    <description>Feed for thread: Printing an image to scale</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>Thu, 03 Apr 2008 04:52:01 -0400</pubDate>
      <title>Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424396</link>
      <author>Joshua Fialkoff</author>
      <description>Hi all,&lt;br&gt;
Say we import an image into MATLAB.  I can print/export that&lt;br&gt;
image at the same resolution and using the same file type&lt;br&gt;
and have the same image (i.e., it will match the dimensions&lt;br&gt;
of the original).  Similarly, I can perform some operations&lt;br&gt;
directly on the matrix that represents the image and, again,&lt;br&gt;
export and get a similarly sized image.  The problem is&lt;br&gt;
this.  I would like to show the image using imshow and then&lt;br&gt;
overlay some shapes (e.g., bounding boxes, etc...) and then&lt;br&gt;
export the image such that it is similarly sized as the&lt;br&gt;
original.  I can't seem to figure out how to accomplish&lt;br&gt;
this.  If it helps I'm only working with B&amp;W images, but a&lt;br&gt;
more generic solution is preferable.  Thanks in advance for&lt;br&gt;
you help.&lt;br&gt;
&lt;br&gt;
- Josh</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 06:03:06 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424401</link>
      <author>Bryan</author>
      <description>&quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ft1nph$5rv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; Say we import an image into MATLAB.  I can print/export that&lt;br&gt;
&amp;gt; image at the same resolution and using the same file type&lt;br&gt;
&amp;gt; and have the same image (i.e., it will match the dimensions&lt;br&gt;
&amp;gt; of the original).  Similarly, I can perform some operations&lt;br&gt;
&amp;gt; directly on the matrix that represents the image and, again,&lt;br&gt;
&amp;gt; export and get a similarly sized image.  The problem is&lt;br&gt;
&amp;gt; this.  I would like to show the image using imshow and then&lt;br&gt;
&amp;gt; overlay some shapes (e.g., bounding boxes, etc...) and then&lt;br&gt;
&amp;gt; export the image such that it is similarly sized as the&lt;br&gt;
&amp;gt; original.  I can't seem to figure out how to accomplish&lt;br&gt;
&amp;gt; this.  If it helps I'm only working with B&amp;W images, but a&lt;br&gt;
&amp;gt; more generic solution is preferable.  Thanks in advance for&lt;br&gt;
&amp;gt; you help.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; - Josh&lt;br&gt;
&lt;br&gt;
you want some version of:&lt;br&gt;
&lt;br&gt;
imgMod = get(findobj('type','image),'Cdata');&lt;br&gt;
&lt;br&gt;
with more than one figure open, you can use 'gcf' or 'get'&lt;br&gt;
with the figure number, whatever.&lt;br&gt;
&lt;br&gt;
there's some other way to do it, i think, but that comes to&lt;br&gt;
mind.&lt;br&gt;
&lt;br&gt;
bryan</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 14:39:02 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424501</link>
      <author>Joshua Fialkoff</author>
      <description>Thanks for the help.  I don't think this is accomplishing&lt;br&gt;
what I'm looking for.  I performed the following:&lt;br&gt;
&lt;br&gt;
img = imread('somefile.tif');&lt;br&gt;
imshow(img);&lt;br&gt;
rectangle('position', [0 0 100 100]);&lt;br&gt;
img2 = get(findobj('type','image'), 'cdata');&lt;br&gt;
imshow(img2);&lt;br&gt;
&lt;br&gt;
The result is the original image.  What I desire is a&lt;br&gt;
composite image (i.e., an image that is somefile.tif with a&lt;br&gt;
square overlaid).&lt;br&gt;
&lt;br&gt;
- Josh</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 16:34:03 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424523</link>
      <author>Bryan</author>
      <description>&quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ft2q66$aj8$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Thanks for the help.  I don't think this is accomplishing&lt;br&gt;
&amp;gt; what I'm looking for.  I performed the following:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; img = imread('somefile.tif');&lt;br&gt;
&amp;gt; imshow(img);&lt;br&gt;
&amp;gt; rectangle('position', [0 0 100 100]);&lt;br&gt;
&amp;gt; img2 = get(findobj('type','image'), 'cdata');&lt;br&gt;
&amp;gt; imshow(img2);&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The result is the original image.  What I desire is a&lt;br&gt;
&amp;gt; composite image (i.e., an image that is somefile.tif with a&lt;br&gt;
&amp;gt; square overlaid).&lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
oops... yes, i understood what you meant, and thought this&lt;br&gt;
would do it (was not at a matlab computer, so couldn't test&lt;br&gt;
it).  i'll get back to you if i figure it out.</description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 16:36:33 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424524</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message &lt;br&gt;
news:ft2q66$aj8$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Thanks for the help.  I don't think this is accomplishing&lt;br&gt;
&amp;gt; what I'm looking for.  I performed the following:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; img = imread('somefile.tif');&lt;br&gt;
&amp;gt; imshow(img);&lt;br&gt;
&amp;gt; rectangle('position', [0 0 100 100]);&lt;br&gt;
&amp;gt; img2 = get(findobj('type','image'), 'cdata');&lt;br&gt;
&amp;gt; imshow(img2);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The result is the original image.  What I desire is a&lt;br&gt;
&amp;gt; composite image (i.e., an image that is somefile.tif with a&lt;br&gt;
&amp;gt; square overlaid).&lt;br&gt;
&lt;br&gt;
You might want to look at the GETFRAME or PRINT functions.  [PRINT to an &lt;br&gt;
image file, then read in the image to get the modified data back into &lt;br&gt;
MATLAB.]&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Thu, 03 Apr 2008 16:57:12 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424534</link>
      <author>Bryan</author>
      <description>&quot;Steven Lord&quot; &amp;lt;slord@mathworks.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ft312h$49e$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message &lt;br&gt;
&amp;gt; news:ft2q66$aj8$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt; Thanks for the help.  I don't think this is accomplishing&lt;br&gt;
&amp;gt; &amp;gt; what I'm looking for.  I performed the following:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; img = imread('somefile.tif');&lt;br&gt;
&amp;gt; &amp;gt; imshow(img);&lt;br&gt;
&amp;gt; &amp;gt; rectangle('position', [0 0 100 100]);&lt;br&gt;
&amp;gt; &amp;gt; img2 = get(findobj('type','image'), 'cdata');&lt;br&gt;
&amp;gt; &amp;gt; imshow(img2);&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; The result is the original image.  What I desire is a&lt;br&gt;
&amp;gt; &amp;gt; composite image (i.e., an image that is somefile.tif with a&lt;br&gt;
&amp;gt; &amp;gt; square overlaid).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; You might want to look at the GETFRAME or PRINT functions.&lt;br&gt;
&amp;nbsp;[PRINT to an &lt;br&gt;
&amp;gt; image file, then read in the image to get the modified&lt;br&gt;
data back into &lt;br&gt;
&amp;gt; MATLAB.]&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Steve Lord&lt;br&gt;
&amp;gt; slord@mathworks.com &lt;br&gt;
&amp;gt; &lt;br&gt;
&lt;br&gt;
but if the image is displayed at anything other than 100%&lt;br&gt;
this loses the original image dimensions... i think the op&lt;br&gt;
wanted the _same_ image (dimensions), with the modifications&lt;br&gt;
as part of the new image.  &lt;br&gt;
&lt;br&gt;
after looking around myself, i have also had trouble finding&lt;br&gt;
this functionality.  i tried to set the rectangle's parent&lt;br&gt;
property to be the image, but that didn't work out.&lt;br&gt;
&lt;br&gt;
in the trivial example given, the op could obviously just&lt;br&gt;
change the color of the pixels in his original image that&lt;br&gt;
define his rectangle, but this would get harder and harder&lt;br&gt;
for non-simple annotations (and text!).&lt;br&gt;
&lt;br&gt;
bryan</description>
    </item>
    <item>
      <pubDate>Fri, 04 Apr 2008 00:09:02 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424633</link>
      <author>Dan Haeg</author>
      <description>&quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ft1nph$5rv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi all,&lt;br&gt;
&amp;gt; Say we import an image into MATLAB.  I can print/export that&lt;br&gt;
&amp;gt; image at the same resolution and using the same file type&lt;br&gt;
&amp;gt; and have the same image (i.e., it will match the dimensions&lt;br&gt;
&amp;gt; of the original).  Similarly, I can perform some operations&lt;br&gt;
&amp;gt; directly on the matrix that represents the image and, again,&lt;br&gt;
&amp;gt; export and get a similarly sized image.  The problem is&lt;br&gt;
&amp;gt; this.  I would like to show the image using imshow and then&lt;br&gt;
&amp;gt; overlay some shapes (e.g., bounding boxes, etc...) and then&lt;br&gt;
&amp;gt; export the image such that it is similarly sized as the&lt;br&gt;
&amp;gt; original.  I can't seem to figure out how to accomplish&lt;br&gt;
&amp;gt; this.  If it helps I'm only working with B&amp;W images, but a&lt;br&gt;
&amp;gt; more generic solution is preferable.  Thanks in advance for&lt;br&gt;
&amp;gt; you help.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; - Josh&lt;br&gt;
&lt;br&gt;
I have the same problem. My image is 5939 by 4639 pixels so&lt;br&gt;
it is way too big for my screen when not zoomed. I read the&lt;br&gt;
image and display it. Then I plot some non-trivial lines on&lt;br&gt;
top of the image. Now I want to print the combined image&lt;br&gt;
with lines to the same size file as the original ie 5939 by&lt;br&gt;
4639. The image is true color.&lt;br&gt;
&lt;br&gt;
Here is my thread:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/166433#423529&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/166433#423529&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
If anyone can solve both our problems that would be great,&lt;br&gt;
thanks.&lt;br&gt;
Dan</description>
    </item>
    <item>
      <pubDate>Fri, 04 Apr 2008 09:31:02 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#424686</link>
      <author>M K</author>
      <description>&quot;Dan Haeg&quot; &amp;lt;haegd@msoe.edu&amp;gt; wrote in message&lt;br&gt;
&amp;lt;ft3riu$98e$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Joshua Fialkoff&quot; &amp;lt;fialkj@rpi.edu&amp;gt; wrote in message&lt;br&gt;
&amp;gt; &amp;lt;ft1nph$5rv$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt; Hi all,&lt;br&gt;
&amp;gt; &amp;gt; Say we import an image into MATLAB.  I can print/export that&lt;br&gt;
&amp;gt; &amp;gt; image at the same resolution and using the same file type&lt;br&gt;
&amp;gt; &amp;gt; and have the same image (i.e., it will match the dimensions&lt;br&gt;
&amp;gt; &amp;gt; of the original).  Similarly, I can perform some operations&lt;br&gt;
&amp;gt; &amp;gt; directly on the matrix that represents the image and, again,&lt;br&gt;
&amp;gt; &amp;gt; export and get a similarly sized image.  The problem is&lt;br&gt;
&amp;gt; &amp;gt; this.  I would like to show the image using imshow and then&lt;br&gt;
&amp;gt; &amp;gt; overlay some shapes (e.g., bounding boxes, etc...) and then&lt;br&gt;
&amp;gt; &amp;gt; export the image such that it is similarly sized as the&lt;br&gt;
&amp;gt; &amp;gt; original.  I can't seem to figure out how to accomplish&lt;br&gt;
&amp;gt; &amp;gt; this.  If it helps I'm only working with B&amp;W images, but a&lt;br&gt;
&amp;gt; &amp;gt; more generic solution is preferable.  Thanks in advance for&lt;br&gt;
&amp;gt; &amp;gt; you help.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; - Josh&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I have the same problem. My image is 5939 by 4639 pixels so&lt;br&gt;
&amp;gt; it is way too big for my screen when not zoomed. I read the&lt;br&gt;
&amp;gt; image and display it. Then I plot some non-trivial lines on&lt;br&gt;
&amp;gt; top of the image. Now I want to print the combined image&lt;br&gt;
&amp;gt; with lines to the same size file as the original ie 5939 by&lt;br&gt;
&amp;gt; 4639. The image is true color.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Here is my thread:&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/166433#423529&quot;&gt;http://www.mathworks.com/matlabcentral/newsreader/view_thread/166433#423529&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If anyone can solve both our problems that would be great,&lt;br&gt;
&amp;gt; thanks.&lt;br&gt;
&amp;gt; Dan&lt;br&gt;
&lt;br&gt;
Hi,&lt;br&gt;
&lt;br&gt;
One method is described  here:&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/support/solutions/data/1-16WME.html?solution=1-16WME&quot;&gt;http://www.mathworks.com/support/solutions/data/1-16WME.html?solution=1-16WME&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
However, the &quot;background&quot; image may not have exactly same&lt;br&gt;
colors as the original when exported trough print().&lt;br&gt;
&lt;br&gt;
load clown&lt;br&gt;
figH = figure;&lt;br&gt;
axH = axes('units','normalized','position',[0 0 1 1]);&lt;br&gt;
imH  = imshow(X,map,'parent',axH);&lt;br&gt;
colormap(map);&lt;br&gt;
hold on, patch([ 50 100 50]',[50 100 100]','r','LineWidth',3)&lt;br&gt;
text(150,20,'Clown','color',[0 0&lt;br&gt;
0],'fontweight','bold','fontsize',14)&lt;br&gt;
axis off&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
figSize = size(X);&lt;br&gt;
defRes = 100;&lt;br&gt;
paperPos = fliplr(figSize/defRes);&lt;br&gt;
set(figH,'PaperUnits','inches','PaperPosition',[0 0 paperPos]);&lt;br&gt;
% &quot;save&quot; figure with annotations&lt;br&gt;
print('-dpng','new.png',['-r',num2str(defRes)])&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
HTH, &lt;br&gt;
&lt;br&gt;
M</description>
    </item>
    <item>
      <pubDate>Mon, 07 Apr 2008 15:15:03 -0400</pubDate>
      <title>Re: Printing an image to scale</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/166878#425188</link>
      <author>Joshua Fialkoff</author>
      <description>Works like a charm...thanks much.</description>
    </item>
  </channel>
</rss>

