Graphics Programming Virtual Meetup

Discord

Twitter

A Pixel is not a Little Square!

A Pixel is not a Little Square!

A Pixel is not a Little Square!

(And a Voxel is not a Little Cube!)

Paper by: Alvy Ray Smith

The Little Square Model

  • A pixel (picture element) is a geometric square
  • Pixel (i, j) = {(x, y) | i-.5 ≤ x ≤i+.5, j-.5 ≤ y ≤j+.5}
  • Or "Half Integers": {(x, y) | i≤x≤i+1., j≤y≤j+1.}

What is a pixel?

  • A point sample
  • Color picture may contain 3 samples per point
  • not a square!

What is an image?

  • Rectilinear grid of point samples (pixels)
  • Viewing such a grid requires us to reconstruct it
  • Need an appropriate Reconstruction Filter
  • Nyquist-Shannon Sampling theorum tells us how that works

But first...

A (brief) diversion into Digital Image Processing

Nyquist-Shannon Sampling Theorum

  • Says that a finite bandwidth continuous function can be perfectly represented by discrete samples
  • The sampling rate needs to be twice the maximum frequency
    • if all frequencies x(t) are below B, then points only need to be spaced out at  intervals  of  1/ (2B)
  • Most easily seen in CD audio quality
    • Humans can only hear up to ~22khz, CD's sample at 44khz

Reconstruction Filter

  • Describes how to construct a smooth analog signal from digital input
  • A.K.A what a Digital Analog Converter (DAC) uses
  • Many different kinds of filters
    • Nearest neighbor aka box filter with size of 1
    • Bilinear interpolation - basic texture sampling
    • Gaussian

Box Filter

  • Not to be confused with an aquarium filter
  • Weights the neighbors contributions equally
  • Usually paired with nearest neighbor interpolation
  • Can be used to average out an image
    • Example: Mipmaps

Gaussian Filter

  • Weight samples based on Gaussian Distribution
  • Give most weight to center samples
  • Commonly used for blurring
  • More 'true to life', eg found in physical processes

Filter comparisons

This is for a single dimension and doesn't define the range of underlying samples

Interpolation comparison

  • Colored dots are the digital 'samples'
  • Black dot is the output value

Back to the Paper

Figure 1

Figure 1 cont.

Figure 2

Notes

  • Footprint is not rectangular
  • Filters overlap quite a bit
  • Box has 'jaggies' - sharp corners

WhyIs the Little square Model So Persistant?

Two principle reasons

  • Geometry based computer graphics
    • Render abstract geometry into viewable pixels
    • Fastest to assume rectangular viewport with square pixels
  • Video magnification of computer displays appear to show it
    • Zooming in shows 'bigger' pixels
    • It does the cheap box filter to quickly render
    • More accurate zooming is expensive

Scanners scan, not pixelate

  • The output image may be a rectangular grid of samples
  • Scanner head isn't a 'square', its an analog source turned into digital signals

Camera Sensors aren't perfect squares

  • Multiple individual color sensors arrayed in a grid
  • Means the samples aren't in the same point

CRT's don't display square pixels

  • Electron beam's intensity varies over time, is constantly drawing a cross a phosphor layer
  • Colors comes from shadow mask
    • Several different masks

LCD's kinda do have square pixels

  • Pixel colors are addressed as a rectilinear grid
  • No electron gun zooming around
  • OLED's don't on the other hand
    • Use a pentile display

Proposed Discrete to Continuous Mapping

  • Put the samples on the integers
  • Make the boundaries be (filterwidth/2) away from the outermost integer column boundary
    • Assume symmetric filters
  • Y increasing downwards is the preferred coordinate frame

Downscaling an image

  • Imagine a 640x480 image
  • Create the "minimal enclosing rectangle" using the symmetric bicubic filter (ala figure 2)
  • This would have boundaries (-2, 641) x (-2, 481)
  • Now we can downsample the sample points however we please
    • I'd like to imagine how each new sample would absorb the surrounding image
  • Contrast this to simply averaging the 2x2 blocks into single pixels, a basic box downscale

Thanks!

Questions?

BONUS SLIDE/LINKS

Graphics Programming Virtual Meetup

Made with Slides.com