<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167928</link>
    <title>MATLAB Central Newsreader - reduce size of high-quality image</title>
    <description>Feed for thread: reduce size of high-quality image</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>Sun, 20 Apr 2008 17:52:02 -0400</pubDate>
      <title>reduce size of high-quality image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167928#427821</link>
      <author>dormant </author>
      <description>I need to reduce the size of a high quality image, read from&lt;br&gt;
a TIFF file.&lt;br&gt;
&lt;br&gt;
Say I want to reduce the image size by a factor of N&lt;br&gt;
(normally 4). I would average the image using NxN blocks,&lt;br&gt;
then decimate by N and use the output to create a new image. &lt;br&gt;
&lt;br&gt;
But that would lose the increase in dynamic range that comes&lt;br&gt;
from the averaging process. I want to retain that dynamic&lt;br&gt;
range somehow, which means I have to change variable type&lt;br&gt;
and then somehow create an image file that uses uint16 or&lt;br&gt;
floating point values.&lt;br&gt;
&lt;br&gt;
I've had a stab at this, but can't get anywhere. I can't&lt;br&gt;
even get blkproc to work as follows:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; fun = @mean2;&lt;br&gt;
&amp;gt;&amp;gt; IM2 = blkproc( IM1, [4 4], fun);&lt;br&gt;
??? Subscripted assignment dimension mismatch.&lt;br&gt;
&lt;br&gt;
Error in ==&amp;gt; blkproc at 89&lt;br&gt;
aa(border(1)+(1:ma),border(2)+(1:na)) = a;&lt;br&gt;
&lt;br&gt;
Any suggestions for:&lt;br&gt;
&lt;br&gt;
1) How to get over the blkproc problem.&lt;br&gt;
&lt;br&gt;
2) How to add the precision change.</description>
    </item>
    <item>
      <pubDate>Sun, 20 Apr 2008 19:57:21 -0400</pubDate>
      <title>Re: reduce size of high-quality image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167928#427835</link>
      <author>ImageAnalyst</author>
      <description>On Apr 20, 1:52=A0pm, &quot;dormant &quot; &amp;lt;rod.stew...@uwiseismic.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; I need to reduce the size of a high quality image, read from&lt;br&gt;
&amp;gt; a TIFF file.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Say I want to reduce the image size by a factor of N&lt;br&gt;
&amp;gt; (normally 4). I would average the image using NxN blocks,&lt;br&gt;
&amp;gt; then decimate by N and use the output to create a new image.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But that would lose the increase in dynamic range that comes&lt;br&gt;
&amp;gt; from the averaging process. I want to retain that dynamic&lt;br&gt;
&amp;gt; range somehow, which means I have to change variable type&lt;br&gt;
&amp;gt; and then somehow create an image file that uses uint16 or&lt;br&gt;
&amp;gt; floating point values.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I've had a stab at this, but can't get anywhere. I can't&lt;br&gt;
&amp;gt; even get blkproc to work as follows:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; fun =3D @mean2;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; IM2 =3D blkproc( IM1, [4 4], fun);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ??? Subscripted assignment dimension mismatch.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Error in =3D=3D&amp;gt; blkproc at 89&lt;br&gt;
&amp;gt; aa(border(1)+(1:ma),border(2)+(1:na)) =3D a;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Any suggestions for:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 1) How to get over the blkproc problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 2) How to add the precision change.&lt;br&gt;
&lt;br&gt;
dormant:&lt;br&gt;
You probably realize by now that you misspoke when you said that the&lt;br&gt;
averaging process causes an increase in dynamic range, and you want to&lt;br&gt;
keep this increase.  In fact, averaging (blurring) DEcreases dynamic&lt;br&gt;
range, as a window containing a pixel with the peak brightness will be&lt;br&gt;
brought down to a lesser average value and a window containing a pixel&lt;br&gt;
with the minimum brightness will be brought up to a higher average&lt;br&gt;
value, unless of course the entire window contained nothing but the&lt;br&gt;
peak or darkest value.&lt;br&gt;
&lt;br&gt;
What do you mean when you say &quot;dynamic range&quot;?  If all you wanted to&lt;br&gt;
do was to make sure that pixels with the greatest and least value were&lt;br&gt;
retained and not replaced by the average within the window, you could&lt;br&gt;
do that with some special custom written locally adaptive window&lt;br&gt;
processing code.  For example, take the morphological gray scale&lt;br&gt;
dilation of the image (to get the max values in the window), then the&lt;br&gt;
erosion (to get the mins), then the median or average (to get a mid-&lt;br&gt;
level value).  Then you could say something like if the window&lt;br&gt;
contains the max, or the average is in the upper third of the dynamic&lt;br&gt;
range, then take the value  from the dilation.  If the mean is in the&lt;br&gt;
middle third of values, then take the mean or median.  If the mean is&lt;br&gt;
in the darkest third of values, take the erosion value.  There are&lt;br&gt;
lots of schemes you could think up, so there is no one right answer.&lt;br&gt;
(I'm assuming you have the image processing toolkit.)&lt;br&gt;
&lt;br&gt;
Why is keeping the dynamic range so important?  What if the entire&lt;br&gt;
image lay between 100 and 150 gray levels and you had one sole pixel&lt;br&gt;
at 230 and one sole pixel at 20.  Would you want your subsampled image&lt;br&gt;
to go between 100 and 150 (I would) or would you (for some, as of yet&lt;br&gt;
unstated, reason) want it to go between 20 and 230 even though it was&lt;br&gt;
just due to two spurious (probably noise) pixels that gave you the&lt;br&gt;
wider dynamic range?&lt;br&gt;
Regards,&lt;br&gt;
ImageAnalyst</description>
    </item>
    <item>
      <pubDate>Fri, 16 May 2008 09:07:02 -0400</pubDate>
      <title>Re: reduce size of high-quality image</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/167928#432438</link>
      <author>tudor dima</author>
      <description>Hello everybody,&lt;br&gt;
&lt;br&gt;
I suspect Dormant was having in mind the relatively&lt;br&gt;
straightforward phenomena that when decreasing the&lt;br&gt;
resolution in a image-caption device one gets higher&lt;br&gt;
sensibility. This is simply due to the fact that adding N&lt;br&gt;
currents of N transistors will push the signal N times&lt;br&gt;
higher, and more parts of it will lay outside the noise in&lt;br&gt;
the previously darker areas (i.e. below noise threshold).&lt;br&gt;
&lt;br&gt;
Once the image is digitized, however, one can only think of&lt;br&gt;
the noise level of the monitor or printer (i.e. pushing the&lt;br&gt;
image above it); simply adding the pixel values will do the&lt;br&gt;
trick, although that would most likely &quot;burn&quot; the highs.&lt;br&gt;
Therefore one has to adaptively compress the dynamic range&lt;br&gt;
of the picture, exactly like ImageAnalyst said.&lt;br&gt;
&lt;br&gt;
This could also be interpreted as squeezing a difficult&lt;br&gt;
scene which originally had &quot;8-stops&quot; back within, say 6&lt;br&gt;
stops (therefore printable/viewable), all while pushing the&lt;br&gt;
shadows by S ISO-stops and the highlights by S-2 stops&lt;br&gt;
(where S is a function of the downsampling factor.&lt;br&gt;
&lt;br&gt;
The compressing curve, however, ain't no easy trick, I&lt;br&gt;
suspect it should be anti-log. Or one can generate two&lt;br&gt;
images and just cut the sky off the &quot;dark&quot; image and paste&lt;br&gt;
it into the &quot;light&quot; one, as in the good old days of BW&lt;br&gt;
silver-based technology :-)&lt;br&gt;
&lt;br&gt;
ImageAnalyst &amp;lt;imageanalyst@mailinator.com&amp;gt; wrote in message&lt;br&gt;
&amp;lt;abbe2799-9dfe-4eaa-b37e-89b02436e73f@d45g2000hsc.googlegroups.com&amp;gt;...&lt;br&gt;
&amp;gt; On Apr 20, 1:52=A0pm, &quot;dormant &quot;&lt;br&gt;
&amp;lt;rod.stew...@uwiseismic.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &amp;gt; I need to reduce the size of a high quality image, read from&lt;br&gt;
&amp;gt; &amp;gt; a TIFF file.&lt;br&gt;
&amp;gt; &amp;gt; [ ...snip...]&lt;br&gt;
&amp;gt; &amp;gt; Any suggestions for:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; 1) How to get over the blkproc problem.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; 2) How to add the precision change.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; dormant:&lt;br&gt;
&amp;gt; You probably realize by now that you misspoke when you&lt;br&gt;
said that the&lt;br&gt;
&amp;gt; averaging process causes an increase in dynamic range, and&lt;br&gt;
you want to&lt;br&gt;
&amp;gt; keep this increase.  In fact, averaging (blurring)&lt;br&gt;
DEcreases dynamic&lt;br&gt;
&amp;gt; range,&lt;br&gt;
&amp;gt; [...snip...]&lt;br&gt;
&amp;gt; Regards,&lt;br&gt;
&amp;gt; ImageAnalyst</description>
    </item>
  </channel>
</rss>

