Re: Fundamental Image Processing Question
- From: davem@xxxxxxxxx (Dave Martindale)
- Date: Sat, 19 Nov 2005 19:14:43 +0000 (UTC)
"Fred" <Fred@xxxxxxxxxxx> writes:
>If I have an explicit form for a continuous 2D image, what is the optimum
>method for using this to calculate the "perfect" pixel values for a discrete
>representage (bitmap)?
What is your criteria for "perfect"?
One definition of "perfect" is point sampling after low-pass filtering.
This can be shown (the sampling theorem) to allow you to perfectly
reconstruct all information in the source with a spatial frequency below
0.5 cycles/pixel, with no loss and no artifacts. Higher frequencies
cannot be represented accurately at this pixel density, and are lost.
Theoretically, you take your source image and convolve with a filter
that has a sharp cutoff above 0.5 cycles/pixels, then simply point
sample. In practice, if the source is really a continuous function, you
might be able to do the convolution analytically. If the source is a
high-res discrete image, you're talking about numerical integration.
Also, the theoretically perfect low-pass filter kernel is infinite in
size (it is sin(pi*x)/(pi*x), so most practical implementations have to
use an approximation to that.
However, this just says that the required information is in the file.
To get full predicted performance, it also depends on how you
display the image. All standard display devices are *not* point
displays, and add artifacts of their own. To minimize these artifacts,
you may have to use a display with 2X or 3X the pixel density of the
image file, using a high-quality reconstruction. Again, the perfect
reconstruction filter is not practical and you need to use an
approximation.
If you don't want to display the image that way, perhaps your "perfect"
image might want to be something that takes the display method into
account.
Also, the method above, with a square sampling grid, gives diagonal
resolution that is higher than horizontal/vertical resolution by a
factor of sqrt(2). You might prefer an image with the same resolution
in all directions.
Also, the method above gives an image that maintains high contrast right
up to the 0.5 cycles/pixel Nyquist limit, then nothing above that. It's
the "best" image possible at that sampling density, but it's quite
unlike the film and optical images we are used to seeing. The latter
has a slow and gentle decline of contrast with increasing frequency,
unlike the abrupt drop of the digital image.
So you see, "perfect" itself is not simply defined.
>For example, if I wanted to create an image of a 2D circular sinc function
>centred in an image how would I calculate the grayscale value for each
>pixel. Alternatively one could imagine a very very high resolution image
>which is being downsized to a much smaller size so that in real terms the
>source image can be considered continuous.
For the sinc, make sure that the highest horizontal or vertical
frequency present is 0.5 cycles/pixel, and simply point sample. For the
highres discrete source image, you need to apply a suitable lowpass
filter first.
>My intuition tells me that the pixel value should simply be the integral of
>the continuous function over the pixel on the basis that the pixels are
>non-overlapping squares which fully cover the 2D domain. However my
>experience tells me that things are never so simple - issues like aliasing
>and filtering come to mind.
This is generally *not* the right thing to do. It is equivalent to
filtering the source with a "box filter" with dimensions equal to one
output pixel, then sampling. If you look at the Fourier transform of a
box (f(x) = 1, -0.5<=x<=0.5, f(x)=0 elsewhere), you'll see that it
significantly attenuates some frequencies below the cutoff, while
passing substantial amounts of some frequencies above cutoff, producing
aliasing in some cases. You'll see staircasing on edges and sometimes
moire artifacts.
On the other hand, a box-filtered image does look sharper than a
properly-filtered image, and in some cases there are few artifacts. An
example is in downsizing computer screen images by an integer factor.
>Note that this is an "in principle" question, I'm not concerned about
>practicality or efficiency.
>Any pointers relevant to this subject would be greatly appreciated.
A search for "sampling theorem" and "image resampling" should get you
lots of references. The general case of resizing images includes
enlarging as well as reducing in size. The 60-second summary is:
To resample an image at a different pixel density, in theory you use a
reconstruction filter to convert from discrete to continuous domain.
Then you low-pass filter to 0.5 cycles/pixel at the new pixel pitch, in
the continuous domain. Then you point sample at the new pixel pitch,
converting from continuous to discrete.
But in practice, the reconstruction and sampling filters are usually the
same shape, except one has a larger cutoff than the other, so the one
with the larger cutoff frequency is redundant and can be eliminated. So
you only need one low-pass filter, with a cutoff frequency that depends
on input pixel spacing when enlarging and output pixel spacing when
reducing. Then if you combine the filtering and sampling operations,
the whole thing can be done in the discrete domain. And that's how it
is usually done. The argument then becomes what is the best tradeoff
between speed, image quality, and remaining artifacts for the filter
chosen.
Dave
.
- Follow-Ups:
- Re: Fundamental Image Processing Question
- From: Fred
- Re: Fundamental Image Processing Question
- References:
- Fundamental Image Processing Question
- From: Fred
- Fundamental Image Processing Question
- Prev by Date: Re: Next Landsat???
- Next by Date: Re: EM ALGORITHM
- Previous by thread: Re: Fundamental Image Processing Question
- Next by thread: Re: Fundamental Image Processing Question
- Index(es):
Relevant Pages
|
Loading