# 3MP from a 6MP?

Discussion in 'Digital Cameras' started by Ken Murphy, May 8, 2005.

1. ### Ken MurphyGuest

When set to 3MP, how does a 6MP camera generate the image? Logically,
I would expect it to throw away every other pixel, but is that really
what happens?

Ken Murphy, May 8, 2005

2. ### Mark²Guest

That's nice, but what has that to do with his question?

Mark², May 8, 2005

3. ### Ed MullikinGuest

Again, all very true, but I don't understand either. Is the light striking
the photosensitive focused on 3 megs instead of 6 megs? You are over this
individual's head, too. What are the mechanics of it? It it all done by
software?

Ed Mullikin, May 9, 2005
4. ### Dave MartindaleGuest

No. In the first place, throwing away every second pixel in a 6 MP
image would give you a 1.5 MP image, because it would be reduced in size
by a factor of 2 in both directions. If you only did the
every-second-pixel thing in one direction, you'd end up with a very
distorted image.

In the second place, even if you did want a 1.5 MP image, discarding
every second pixel would be the wrong way to do it. You'd get
unpleasant moire effects. One method that *would* work, and which is
pretty cheap, is to average together blocks of 2x2 input pixels to give
one output pixel. But that only works when the reduction in size is an
integer, and doesn't give the best quality either.

Instead, the camera uses a mathematical technique called resampling.
To change from 6 MP to 3 MP, the camera reduces the number of pixels by
sqrt(2) in each direction. For every 100 original pixels, it reduces
that to about 71. Essentially the camera takes the image data it does
have and builds a mathematical model of what the image probably looks
like *between* the existing pixels. Then it removes any detail that
would cause problems at the smaller image size. Then it calculates the
intensity of the image at the new pixel locations for the smaller image.

It sounds complex, and the math is somewhat complex, but it turns out to
be not *that* expensive to compute. It works for any ratio of input
to output size (not just integer ratios), and it avoids the moire errors

Dave

Dave Martindale, May 9, 2005
5. ### ASAARGuest

No. Ken's question lacks some precision, but many cameras allow
the selection of reduced resolutions that are half of the maximum,
and I think that's what he really meant. Not "When set to 1.5MP,
how does a 6MP camera . . .". It *could* be done by throwing away
1/2 of the pixels, but as you said, it definitely wouldn't be done
in a manner that would result in extremely warped images. Your
explanation of resampling may be what he was looking for, but if
not, it was probably useful for others. I started to provide a
similar reply several hours ago but wisely cancelled it, as my reply
would not have been nearly as clear.

ASAAR, May 9, 2005
6. ### Mark²Guest

I hope you noted the smiley...

Mark², May 9, 2005
7. ### Mark²Guest

It captures the scene on the full sensor...at full resolution.
Then...
....via software (called firmware in the camera) it re-samples the image much
in the way a photo editor does when you reduce file size and dimensions of
an image.

Mark², May 9, 2005
8. ### JPSGuest

In message <>,
If it did it that way, the image could become *extremely* jaggy; in this
particular case (halving the megapixels), it would have to drop about 4
out of every 14 pixels in any row or column, and detail would be pushed
up, left, down, and right, to distort the image. Instead, what should
happen is that the values for new pixels are mathematically interpolated
from the existing pixels, by temporarily creating small sections of the
image upscaled, and then calculating weighted averages centered around
the centers of the new pixels. That would be a good *fast* way; there
are better ways, but they take too long to do in-camera.
--

JPS, May 13, 2005
9. ### JPSGuest

In message <>,
Not exactly; a smaller image is often sharper. The larger image can be
more *detailed*; a different thing than sharpness. You get the sharpest
images by dropping pixels (nearest neighbor algorithm), but they are
sharp with artifacts, not detail.
--

JPS, May 13, 2005
10. ### JPSGuest

In message <d5mavj\$fdq\$>,
Unless, of course, the image was very soft to begin with.
--

JPS, May 13, 2005
11. ### JPSGuest

In message <>,
Maybe, but I'd have to know what you mean by "pixel ratio".
The Sigma SD9 does the equivalent of dropping pixels; it never records
2/3 of the focal plane to begin with, so the image is just like a higher
MP image with a majority of pixels dropped.
--

JPS, May 13, 2005
12. ### Zed PobreGuest

Actually, if you have a camera with an in-camera jpg sharpening mode,
that's almost exactly what it's doing. It's just a matter of
carefully choosing which information to discard, to replace with
another value chosen specifically to enhance contrast at sharp
transitions.

You might want to hunt down a guide on exactly what is happening when
you use an unsharp mask in an image editor, for instance.

Zed Pobre, May 13, 2005
13. ### Dave MartindaleGuest

No, I mean that if you only drop every second column in the horizontal
direction, but not drop every second row in the vertical direction,
you'll shrink the image scale by a factor of 2 in only one direction.
Circles will now become ellipses that are twice as tall as they are
wide. That's the kind of distortion I meant.

There are also aliasing artifacts, but I mentioned that elsewhere.

Dave

Dave Martindale, May 13, 2005