# Re: The Sigma-Foveon pixel rationale

Discussion in 'Digital Photography' started by Dave Martindale, Apr 1, 2004.

1. ### Dave MartindaleGuest

John Navas <> writes:

>>Resampling a
>>rotated square grid to a normal square grid is pretty simple, while
>>resampling a hex grid to a square grid seems rather expensive. That's
>>why I distinguish between square and hex grids.

>I suspect resampling (2) to (1) would be comparable to resampling hex
>( (4) or (5) ) to (1).

I think it's easier, but they're all harder that resampling rotated
square grid images (what Fuji does).

Resampling the rotated square grid (3) to a row/column square grid with
twice as many pixels is (nearly) trivial: You can set up the output
grid so that half of the output pixels align with input pixels, so you
get half the output with no processing at all. The other half of the
output pixels are located equidistant between 4 input pixels, and you
can use any of the common resampling methods (bicubic spline, B-spline,
Lanczos) designed for square grid resampling, because the input *is* a
square grid. That's it.

With the half-pixel-shift quincunx (2), you might plausibly resample it
to either a square grid with the same number of pixels, or 4 times as
many pixels. In the same-size case, all the rows and columns are
already spaced properly, but every second row needs a half-pixel shift.
You might get away with applying a standard resampling filter,
treating the grid as a rotated square, but the axes aren't really at 90
degrees to each other so this isn't quite right. Or you could treat it
as a hex grid where the hex angles aren't quite 60 degrees.

The true hex grid (4&5) are worse yet because the output grid can have
either its rows or columns aligned with the input ones, but not both
(unless you're willing to accept non-square pixels. So almost none of
the input pixels can pass directly to the output, and each output pixel
is located somewhere other than half-way between some set of four input
pixels.

I have a paper somewhere that discusses hexagonal-grid images and how
to process them, but I remember the resampling as being hard. I think
it treated the image as a regular 2D grid in space, but with the space
having basis vectors 60 degrees apart. Because of this, the 2D
reconstruction filter used isn't separable, which makes the image
processing more expensive.

Dave

Dave Martindale, Apr 1, 2004

2. ### Guest

In message <c4gdpc\$d54\$>,
(Dave Martindale) wrote:

>Resampling the rotated square grid (3) to a row/column square grid with
>twice as many pixels is (nearly) trivial: You can set up the output
>grid so that half of the output pixels align with input pixels, so you
>get half the output with no processing at all. The other half of the
>output pixels are located equidistant between 4 input pixels, and you
>can use any of the common resampling methods (bicubic spline, B-spline,
>Lanczos) designed for square grid resampling, because the input *is* a
>square grid. That's it.

I thought that you would want to resample the whole thing; isn't that
the best way to do it? I think even the firmware in the cameras use
full resampling; in a TIFF file from my Sony F707, there was no ramping
to and from any subgrid in any of the channels, or the luminance. Any
pixel was equally capable of being a peak or low point.
--

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
John P Sheehy <>
><<> <>>< <>>< ><<> <>>< ><<> ><<> <>><

, Apr 1, 2004

3. ### Dave MartindaleGuest

writes:

>I thought that you would want to resample the whole thing; isn't that
>the best way to do it? I think even the firmware in the cameras use
>full resampling; in a TIFF file from my Sony F707, there was no ramping
>to and from any subgrid in any of the channels, or the luminance. Any
>pixel was equally capable of being a peak or low point.

You're thinking of linear interpolation, where any new pixels calculated
between the position of existing pixels would necessarily be smaller in
value than the larges neighbour. But that's only true of linear
interpolation. Higher-order interpolation methods can generate new
pixel values that are higher (or lower) in intensity than any existing
value.

For example, bicubic interpolation effectively fits a smooth surface to
a 4x4 grid of input pixels. If the pattern of the pixels is such that
the surface looks like a hill with the peak somewhere between the input
values, then the output pixel value will be larger if it falls at the
peak.

Interpolation using something like an 8-lobed Lanczos filter calculates
each output pixel based on 256 (16x16) input pixels. It's even better
at preserving whatever high-frequency information is present in the
original image.

Generally, you wouldn't be able to tell whether any output pixel was
original data or resampled data when using a good filter. And when the
size ratio is not an integer in resampling, *none* of the output pixels
are likely to be input pixels. But for the special case resampling
you'd need in digital cameras, it makes sense to align the grids and
reuse input values where you can.

Dave

Dave Martindale, Apr 1, 2004