I need to reduce the size of a high quality image, read from
a TIFF file.
Say I want to reduce the image size by a factor of N
(normally 4). I would average the image using NxN blocks,
then decimate by N and use the output to create a new image.
But that would lose the increase in dynamic range that comes
from the averaging process. I want to retain that dynamic
range somehow, which means I have to change variable type
and then somehow create an image file that uses uint16 or
floating point values.
I've had a stab at this, but can't get anywhere. I can't
even get blkproc to work as follows:
On Apr 20, 1:52=A0pm, "dormant " <rod.stew...@uwiseismic.com> wrote:
> I need to reduce the size of a high quality image, read from
> a TIFF file.
>
> Say I want to reduce the image size by a factor of N
> (normally 4). I would average the image using NxN blocks,
> then decimate by N and use the output to create a new image.
>
> But that would lose the increase in dynamic range that comes
> from the averaging process. I want to retain that dynamic
> range somehow, which means I have to change variable type
> and then somehow create an image file that uses uint16 or
> floating point values.
>
> I've had a stab at this, but can't get anywhere. I can't
> even get blkproc to work as follows:
>
> >> fun =3D @mean2;
> >> IM2 =3D blkproc( IM1, [4 4], fun);
>
> ??? Subscripted assignment dimension mismatch.
>
> Error in =3D=3D> blkproc at 89
> aa(border(1)+(1:ma),border(2)+(1:na)) =3D a;
>
> Any suggestions for:
>
> 1) How to get over the blkproc problem.
>
> 2) How to add the precision change.
dormant:
You probably realize by now that you misspoke when you said that the
averaging process causes an increase in dynamic range, and you want to
keep this increase. In fact, averaging (blurring) DEcreases dynamic
range, as a window containing a pixel with the peak brightness will be
brought down to a lesser average value and a window containing a pixel
with the minimum brightness will be brought up to a higher average
value, unless of course the entire window contained nothing but the
peak or darkest value.
What do you mean when you say "dynamic range"? If all you wanted to
do was to make sure that pixels with the greatest and least value were
retained and not replaced by the average within the window, you could
do that with some special custom written locally adaptive window
processing code. For example, take the morphological gray scale
dilation of the image (to get the max values in the window), then the
erosion (to get the mins), then the median or average (to get a mid-
level value). Then you could say something like if the window
contains the max, or the average is in the upper third of the dynamic
range, then take the value from the dilation. If the mean is in the
middle third of values, then take the mean or median. If the mean is
in the darkest third of values, take the erosion value. There are
lots of schemes you could think up, so there is no one right answer.
(I'm assuming you have the image processing toolkit.)
Why is keeping the dynamic range so important? What if the entire
image lay between 100 and 150 gray levels and you had one sole pixel
at 230 and one sole pixel at 20. Would you want your subsampled image
to go between 100 and 150 (I would) or would you (for some, as of yet
unstated, reason) want it to go between 20 and 230 even though it was
just due to two spurious (probably noise) pixels that gave you the
wider dynamic range?
Regards,
ImageAnalyst
I suspect Dormant was having in mind the relatively
straightforward phenomena that when decreasing the
resolution in a image-caption device one gets higher
sensibility. This is simply due to the fact that adding N
currents of N transistors will push the signal N times
higher, and more parts of it will lay outside the noise in
the previously darker areas (i.e. below noise threshold).
Once the image is digitized, however, one can only think of
the noise level of the monitor or printer (i.e. pushing the
image above it); simply adding the pixel values will do the
trick, although that would most likely "burn" the highs.
Therefore one has to adaptively compress the dynamic range
of the picture, exactly like ImageAnalyst said.
This could also be interpreted as squeezing a difficult
scene which originally had "8-stops" back within, say 6
stops (therefore printable/viewable), all while pushing the
shadows by S ISO-stops and the highlights by S-2 stops
(where S is a function of the downsampling factor.
The compressing curve, however, ain't no easy trick, I
suspect it should be anti-log. Or one can generate two
images and just cut the sky off the "dark" image and paste
it into the "light" one, as in the good old days of BW
silver-based technology :-)
ImageAnalyst <imageanalyst@mailinator.com> wrote in message
<abbe2799-9dfe-4eaa-b37e-89b02436e73f@d45g2000hsc.googlegroups.com>...
> On Apr 20, 1:52=A0pm, "dormant "
<rod.stew...@uwiseismic.com> wrote:
> > I need to reduce the size of a high quality image, read from
> > a TIFF file.
> > [ ...snip...]
> > Any suggestions for:
> >
> > 1) How to get over the blkproc problem.
> >
> > 2) How to add the precision change.
>
> dormant:
> You probably realize by now that you misspoke when you
said that the
> averaging process causes an increase in dynamic range, and
you want to
> keep this increase. In fact, averaging (blurring)
DEcreases dynamic
> range,
> [...snip...]
> Regards,
> ImageAnalyst
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.