88

Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Fundamentals of Texture Mapping and Image WarpingMaster's Thesisunder the direction of Carlo S�equinPaul S. HeckbertDept. of Electrical Engineering and Computer ScienceUniversity of California, Berkeley, CA 94720c 1989 Paul S. HeckbertJune 17, 1989This Postscript version is missing about 40 paste-up �gures. To get a complete version,order report no. UCB/CSD 89/516 from the Computer Science Division at the addressabove.

Page 2: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

AbstractThe applications of texture mapping in computer graphics and image distortion (warping) in imageprocessing share a core of fundamental techniques. We explore two of these techniques, the two-dimensional geometric mappings that arise in the parameterization and projection of textures ontosurfaces, and the �lters necessary to eliminate aliasing when an image is resampled during texturemapping or warping. With respect to mappings, this work presents a tutorial on three commonclasses of mapping: the a�ne, bilinear, and projective. For resampling, this work develops a newtheory describing the ideal, space variant antialiasing �lter for signals warped and resampled ac-cording to an arbitrary mapping. E�cient implementations of the mapping and �ltering techniquesare discussed and demonstrated.

Page 3: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Contents1 Introduction 51.1 Texture Mapping : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 51.2 Image Warping : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 61.3 Organization of this Thesis : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 82 Two-Dimensional Mappings 92.1 Naive Texture Mapping : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 92.1.1 Coordinate Systems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 92.1.2 A Naive Implementation of Texture Mapping : : : : : : : : : : : : : : : : : : 102.2 Simple Two-Dimensional Mappings : : : : : : : : : : : : : : : : : : : : : : : : : : : : 112.2.1 A�ne Mappings : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 132.2.2 Bilinear Mappings : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 142.2.3 Projective Mappings : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 172.2.4 Comparison of Simple Mappings : : : : : : : : : : : : : : : : : : : : : : : : : 212.3 Two-Dimensional Mappings in Texture Mapping : : : : : : : : : : : : : : : : : : : : 222.3.1 Parameterizing Planar Patches : : : : : : : : : : : : : : : : : : : : : : : : : : 222.3.2 Deducing Projective Mappings : : : : : : : : : : : : : : : : : : : : : : : : : : 232.3.3 Other Parameterizations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 232.3.4 Scanning Textures and Image Warps : : : : : : : : : : : : : : : : : : : : : : : 242.3.5 Incremental Techniques for Screen Order Scanning : : : : : : : : : : : : : : : 262.4 Example: Photomosaics by Image Warping : : : : : : : : : : : : : : : : : : : : : : : 262.5 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 273 Resampling Filters 303.1 Is Filtering Needed? : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 301

Page 4: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

3.2 Sampling: The Cause of Aliasing : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 303.2.1 Frequency Analysis of Aliasing : : : : : : : : : : : : : : : : : : : : : : : : : : 333.3 Antialiasing : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 363.3.1 Sampling at Higher Frequency : : : : : : : : : : : : : : : : : : : : : : : : : : 363.3.2 Pre�ltering : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 363.3.3 Some Low Pass Filters : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 373.4 Ideal Resampling Filters : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 413.4.1 General, Ideal Resampling Filters : : : : : : : : : : : : : : : : : : : : : : : : : 423.4.2 A�ne Mappings and Space Invariant Resampling : : : : : : : : : : : : : : : : 453.4.3 Two-Dimensional A�ne Mappings : : : : : : : : : : : : : : : : : : : : : : : : 453.4.4 Summary: Resampling A�ne Mappings : : : : : : : : : : : : : : : : : : : : : 463.5 Image Resampling in Practice : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 463.5.1 Resampling by Post�ltering : : : : : : : : : : : : : : : : : : : : : : : : : : : : 463.5.2 Image Processing Considerations : : : : : : : : : : : : : : : : : : : : : : : : : 473.5.3 Filter Shape : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 473.5.4 Resampling Filter Shape : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 473.5.5 Local A�ne Approximation : : : : : : : : : : : : : : : : : : : : : : : : : : : : 503.5.6 Magni�cation and Decimation Filters : : : : : : : : : : : : : : : : : : : : : : 513.5.7 Linear Filter Warps : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 533.5.8 Elliptical Gaussian Filters : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 533.5.9 An Implementation of Elliptical Gaussian Filters : : : : : : : : : : : : : : : : 573.6 Future Work : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 62A Source Code for Mapping Inference 66A.1 Basic Data Structures and Routines : : : : : : : : : : : : : : : : : : : : : : : : : : : 66A.1.1 poly.h : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 66A.1.2 pmap.h : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 66A.1.3 mx3.h : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 67A.1.4 mx3.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 67A.2 Inferring Projective Mappings from 2-D Quadrilaterals : : : : : : : : : : : : : : : : : 68A.2.1 pmap poly.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 68A.2.2 pmap gen.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 702

Page 5: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

A.2.3 mapping example.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 72A.3 Inferring A�ne Parameterizations from 3-D Polygons : : : : : : : : : : : : : : : : : 73A.3.1 pmap param.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 73A.3.2 param example.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 75B Ellipses 76B.1 Implicit Ellipse : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 76B.2 Transforming an Implicit Ellipse : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 77B.3 Ellipse Analysis by Rotation : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 77B.4 Ellipse Synthesis by Transforming a Circle : : : : : : : : : : : : : : : : : : : : : : : : 79B.5 Parametric Ellipse : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 79B.6 Converting Parametric to Implicit : : : : : : : : : : : : : : : : : : : : : : : : : : : : 80B.7 Converting Implicit to Parametric : : : : : : : : : : : : : : : : : : : : : : : : : : : : 81

3

Page 6: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

AcknowledgementsThanks to Charlie Gunn for clarifying projective geometry, Rick Sayre for his careful reading, andJules Bloomenthal for detailed critiques between runs on Granite Chief. My readers, ProfessorsCarlo S�equin and Brian Barsky, and Ed Catmull, provided helpful comments. Carlo S�equin and agrant from MICRO generously supported this research. Reference recommendations by ProfessorAvideh Zakhor and Ken Turkowski, formatting help from Ziv Gigus, and photographic assistancefrom Greg Ward were also invaluable. The guys of 508-7, John Hartman, Mike Hohmeyer, and KenShirri�, created the crucial camaraderie.This paper is based on research begun at the New York Institute of Technology ComputerGraphics Lab, where Lance Williams suggested numerous texture applications, Ned Greene andDick Lundin demanded faster Omnimax resampling programs, and Ephraim Cohen showed me the8� 8 system for projective mapping inference. Kevin Hunter suggested the decomposition into twosquare-to-quadrilateral mappings. Discussions of \resize bugs" with Pat Hanrahan and Tom Porterat Pixar underscored the importance of both reconstruction and pre�ltering during resampling.If only there were more time, we could do it all.

4

Page 7: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Chapter 1IntroductionIn this thesis, we are interested in the modeling and rendering problems common to texture mappingand image warping. We begin by reviewing the goals and applications of texture mapping and imagewarping.1.1 Texture MappingTexture mapping is a shading technique for image synthesis in which a texture image is mapped ontoa surface in a three dimensional scene, much as wallpaper is applied to a wall [Catmull74], [Blinn-Newell76], [Heckbert86b]. If we were modeling a table, for example, we might use a rectangularbox for the table top, and four cylinders for the legs. Unadorned, this table model would look quitedull when rendered. The realism of the rendered image can be enhanced immensely by mapping awood grain pattern onto the table top, using the values in the texture to de�ne the color at eachpoint of the surface. The advantage of texture mapping is that it adds much detail to a scenewhile requiring only a modest increase in rendering time. Texture mapping does not a�ect hiddensurface elimination, but merely adds a small incremental cost to the shading process. The techniquegeneralizes easily to curved surfaces [Catmull74].Texture mapping can be used to de�ne many surface parameters besides color. These include theperturbation of surface normal vectors to simulate bumpy surfaces (bump mapping), transparencymapping to modulate the opacity of a translucent surface, specularity mapping to vary the glossinessof a surface, and illumination mapping to model the distribution of incoming light in all directions.These applications are surveyed, and their original literature is cited, in [Carey-Greenberg85].In all of the varieties of texture mapping mentioned above, geometric mappings are fundamental.Two-dimensional mappings are used to de�ne the parameterization of a surface and to describe thetransformation between the texture coordinate system and the screen coordinate system. In texturemapping applications the latter mapping is usually fully determined by the 3-D transformationde�ned by the camera, the modeling transformations describing the geometry of the scene, and theparameterization that maps a texture onto a surface. There are many texture representations, butin this work we restrict ourselves to the most common: discrete 2-D images.When rendering a textured surface it is necessary to sample the texture image to producethe screen image. Except for scenes viewed with parallel projections, texture mappings are non-5

Page 8: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

a�ne, so they have nonuniform resampling grids, as shown in �gure 1.1 (a�ne mappings are thosecomposed of rotations, scales, and translations). Antialiasing non-a�ne texture mappings requiresa space variant texture �lter, however. Such �lters change shape as a function of position, and aremuch more di�cult to implement than space invariant �lters. Space variant �lters are particularlyimportant for texture mapping applications because of the extreme range of scales involved in many3-D scenes. (These issues are explored in detail in chapter 3.)1.2 Image WarpingImage warping is the act of distorting a source image into a destination image according to amapping between source space (u; v) and destination space (x; y). The mapping is usually speci�edby the functions x(u; v) and y(u; v). (We use the term \warp" instead of its synonyms \distortion"and \transformation" because of its conciseness and speci�city: \warp" speci�cally suggests amapping of the domain of an image, while \transformation" can mean a mapping of the imagerange as well).Image warping is used in image processing primarily for the correction of geometric distortionsintroduced by imperfect imaging systems [Gonzalez-Wintz87]. Camera lenses sometimes introducepincushion or barrel distortions, perspective views introduce a projective distortion, and othernonlinear optical components can create more complex distortions. In image processing, we doimage warping typically to remove the distortions from an image, while in computer graphics weare usually introducing one. Image warps are also used for artistic purposes and special e�ects ininteractive paint programs. For image processing applications, the mapping may be derived givena model of the geometric distortions of a system, but more typically the mapping is inferred froma set of corresponding points in the source and destination images. The point correspondence canbe automatic, as for stereo matching, or manual, as in paint programs. Most geometric correctionsystems support a limited set of mapping types, such as piecewise a�ne, bilinear, biquadratic, orbicubic mappings. Such mappings are usually parameterized by a grid of control points. A surveyof mapping and �ltering techniques for image processing is found in [Wolberg88].The appropriate antialiasing �lter for non-a�ne mappings in image warping is, in general, spacevariant, just as for texture mapping. Filter quality and e�ciency is less of a problem for imageprocessing, however, since the mappings used there usually have a more uniform sampling grid thanthose for texture mapping. When it is known a priori that the sampling grid is nearly uniform, a�xed \interpolation" �lter can be used with good results [Gonzalez-Wintz87]. Uniform resampling(often known as \sampling rate conversion") is a fairly common task for 1-D signals such as audio[Crochiere-Rabiner83]. Nonuniform sampling has received much less attention to date.

6

Page 9: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 1.1: a) A textured surface viewed in perspective. b) Nonuniform grid of texture samples inthe screen.7

Page 10: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

1.3 Organization of this ThesisThis thesis is split into two halves: chapter 2 contains a discussion of basic 2-D mappings, andchapter 3 develops and applies a theory for resampling �lters. There are also two appendices: the�rst contains source code for several mapping tasks, and the second summarizes the mathematicsof ellipses relevant to �ltering.

8

Page 11: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Chapter 2Two-Dimensional MappingsIn our discussion of mappings we restrict ourselves, for the most part, to 2-D images mappedto planar surfaces. The simplest classes of 2-D mappings are the a�ne, bilinear, and projectivetransformations. These mappings are well known in mathematics and have been used for years incomputer graphics. Despite their fundamental importance, however, the latter two mappings havereceived little attention in the computer graphics literature. Other aspects of texture mapping andimage warping, such as texture synthesis and �ltering, have received much more attention, probablybecause they have more apparent impact on image quality than simple 2-D mappings.We believe that texture mapping would be more common in rendering systems if basic 2-Dmappings were more widely understood. In this work we hope to revive appreciation for one classof mappings in particular, the projective mapping.2.1 Naive Texture Mapping2.1.1 Coordinate SystemsTo discuss texture mapping, we need to de�ne several coordinate systems. Texture space is the2-D space of surface textures and object space is the 3-D coordinate system in which 3-D geometrysuch as polygons and patches are de�ned. Typically, a polygon is de�ned by listing the objectspace coordinates of each of its vertices. For the classic form of texture mapping with which we areconcerned, texture coordinates (u; v) are assigned to each vertex. World space is a global coordinatesystem that is related to each object's local object space using 3-D modeling transformations(translations, rotations, and scales). 3-D screen space is the 3-D coordinate system of the display,a perspective space with pixel coordinates (x; y) and depth z (used for z-bu�ering). It is related toworld space by the camera parameters (position, orientation, and �eld of view). Finally, 2-D screenspace is the 2-D subset of 3-D screen space without z. When we use the phrase \screen space" byitself we mean 2-D screen space.The correspondence between 2-D texture space and 3-D object space is called the parameteri-zation of the surface, and the mapping from 3-D object space to 2-D screen space is the projectionde�ned by the camera and the modeling transformations (�gure 2.1). Note that when we are ren-dering a particular view of a textured surface, it is the compound mapping from 2-D texture space9

Page 12: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.1: The compound mapping is the composition of the surface parameterization and theviewing projection.to 2-D screen space that is of interest. For resampling purposes, once the 2-D to 2-D compoundmapping is known, the intermediate 3-D space can be ignored. The compound mapping in texturemapping is an example of an image warp, the resampling of a source image to produce a destinationimage according to a 2-D geometric mapping.2.1.2 A Naive Implementation of Texture MappingTo demonstrate the subtleties of 2-D mappings, we outline here an algorithm for texture mappingwithin a z-bu�er polygon renderer [Rogers 85]. This simple algorithm will produce a number ofvisual aws that are quite instructive.We begin by de�ning the object space coordinates (x; y; z) and texture coordinates (u; v) ateach vertex of each polygon. The polygons are transformed to screen space, yielding x, y, and zcoordinates for each vertex. We will need to compute z, u, and v at each pixel, and we would liketo do this with fast, incremental techniques. It is well known that the perspective transformationmaps lines to lines and planes to planes [Foley-van Dam 82], so linear interpolation is appropriatefor computing z. Linear interpolation is also used in Gouraud and Phong shading, so it might seemreasonable to interpolate the texture coordinates (u; v) linearly as well. Following this reasoning,we scan convert the polygon into pixels by linearly interpolating x, z, u, and v along the left andright sides of the polygon and linearly interpolating z, u, and v across each scan line. Havingtexture coordinates (u; v) at each pixel, we can sample the texture array and use the resulting coloras the screen pixel value.

10

Page 13: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

The inner loop of this primitive texture mapper will then be:for x = xleft to xrightif z < ZBUF[x,y] then is new point closer?ZBUF[x,y] = z update z-bu�er(r, g, b) = TEX[u,v] sample textureSCR[x,y] = (r, g, b) write screenz = z+dz(u, v) = (u, v) + (du, dv)where (a; b; c) denotes a vector. The increment values dz, du, and dv are calculated once per scanline. This code uses the texture as the output pixel color (i.e. no lighting e�ects) and it pointsamples the texture (i.e. no �ltering).Close examination of �gure 2.2 reveals some of the aws in the algorithm above. Aliasing(not visible here) would result from a high frequency texture. This can be eliminated by �lteringan area surrounding the texture point (u; v) rather than sampling just a single pixel [Feibush-Levoy-Cook80], [Heckbert86b]. More fundamentally, however, these images do not exhibit theforeshortening we expect from perspective (compare with �gure 2.3). The textured polygon alsoshows disturbing discontinuities along horizontal lines passing through each vertex. These discon-tinuities are artifacts of the linear interpolation of u and v. In animation, the horizontal rippleswill move distractingly as the camera rolls, since the ripples are rotation variant, and the lack offoreshortening will make the texture appear to swim across a surface. As we will see, this naivetexture mapper is correct only for a�ne mappings.These problems occur because the texture transformation e�ected by our linear interpolation ofu and v is inconsistent with the geometry transformation used to transform the vertices to screenspace. Linear interpolation of (u; v) in a scan line algorithm computes a bilinear mapping, whilethe actual image warp de�ned by perspective is a projective mapping. One ad hoc solution tothis inconsistency is to continue with linear interpolation, but to �nely subdivide the polygon. Ifthe texture coordinates are correctly computed for the vertices of the new polygons, the resultingpicture will exhibit less rippling. It is hard to know how �nely to subdivide the polygon, however.We can �nd more satisfactory, theoretically correct, solutions to these problems by studying simple,generic 2-D mappings. Later we will apply the generic techniques to texture mapping.2.2 Simple Two-Dimensional MappingsThere is a limitless variety of possible 2-D mappings. Mappings for applications of texture mappingor image warping must satisfy the needs of both the user and the implementer of the system.For a designer modeling a 3-D scene or the user of image distortion software, one of the mostimportant criteria for selecting a mapping is predictability. One form of predictability present inthe simplest mappings is the preservation of straight lines. If a texture mapping or image warpbends lines then the results are less predictable than those of a line-preserving mapping. Otherdesirable properties are the preservation of equispaced points, angles [Fiume-Fournier-Canale87],and areas. The implementer of such a system seeks e�cient, incremental computations and well-behaved functions (single-valued and invertible). We will see how well the simplest 2-D mappingsmeet these criteria. 11

Page 14: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.2: Left: A checkerboard texture. Right: Image produced by naive texture mapper usinglinear interpolation of u; v. Note horizontal lines of discontinuity passing through vertices (indicatedwith dashed lines).

Figure 2.3: Image produced by projective warp algorithm of x2.3.5 using rational linear interpolationof texture coordinates. Note proper foreshortening.12

Page 15: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

A two-dimensional mapping is a mapping (transformation) that distorts a 2-D source space intoa 2-D destination space. It maps a source point (u; v) to a destination point (x; y), according tothe functions x(u; v) and y(u; v). We will discuss three classes of mappings: a�ne, bilinear, andprojective.Homogeneous NotationThe homogeneous representation for points provides a consistent notation for a�ne and projectivemappings. Homogeneous notation was used in projective geometry [Maxwell46], [Coxeter78] longbefore its introduction to computer graphics [Roberts66]. The homogeneous notation is oftenmisunderstood so we will take a moment to clarify its use and properties.In familiar Euclidean geometry we represent points of the real plane R2 by vectors of the form(x; y). Projective geometry deals with the projective plane, a superset of the real plane, whose ho-mogeneous coordinates are (x0; y0; w). In projective geometry the 2-D real point (x; y) is representedby the homogeneous vector p = (x0; y0; w) = (xw; yw;w), where w is an arbitrary nonzero number.Vectors of the form (xw; yw;w) for w 6= 0 form the equivalence class of homogeneous representationsfor the real point (x; y). To recover the actual coordinates from a homogeneous vector, we simplydivide by the homogeneous component; e.g., the homogeneous vector p = (xw; yw;w) = (x0; y0; w)represents the actual point (x; y) = (x0=w; y0=w). This division, a projection onto the w = 1 plane,cancels the e�ect of scalar multiplication by w. When representing real points with homogeneousnotation we could use any nonzero w, but it is usually most convenient to choose w = 1 so thatthe real coordinates can be recovered without division. Projective space also includes the points atin�nity: vectors of the form (x0; y0; 0), excluding (0; 0; 0). The points at in�nity lie on the line atin�nity. We will see later how augmentation of the real plane by these points simpli�es projectivegeometry.In homogeneous notation, 2-D points are represented by 3-vectors and 3-D points are representedby 4-vectors. For a�ne and projective mappings, we denote points in source space by ps = (u0; v0; q)and points in the destination space by pd = (x0; y0; w).2.2.1 A�ne MappingsA�ne mappings include scales, rotations, translations, and shears; they are linear mappings plus atranslation [Foley-van Dam82]. Formally, a mapping T (x) is linear i� T (x+ y) = T (x) + T (y) andT (�x) = �T (x) for any scalar �, and a mapping T (x) is a�ne i� there exists a constant c and alinear mapping L(x) such that T (x) = L(x) + c for all x. Obviously, linear mappings are a subsetof a�ne mappings.A general 2-D a�ne mapping may be written algebraically as:pd = psMsd( x y 1 ) = ( u v 1 )8>>>>>>: a d 0b e 0c f 19>>>>>>;Transform matrices are denoted Mab where a is the initial coordinate system and b is the �nalcoordinate system. Notice that we have chosen w = q = 1 without loss of generality. The 3 � 313

Page 16: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.4: A�ne warps of image at left.matrix Msd has 6 degrees of freedom. Geometrically, the vectors (a; d) and (b; e) are basis vectorsof the destination space, and (c; f) is the origin.As shown in �gure 2.4, a�ne mappings preserve parallel lines and preserve equispaced pointsalong lines (meaning that equispaced points along a line in the source space transform to equispacedpoints along a line in the destination space, although the spacing in the two coordinate systemsmay be di�erent). We can invert an a�ne mapping to �nd the destination-to-source transformationsimply by inverting the mapping matrix (i� Msd has an inverse). Similarly, a�ne mappings maybe composed by concatenating their matrices.Since an a�ne mapping has 6 degrees of freedom, it may be de�ned geometrically by specify-ing the source and destination coordinates of three points. The mapping and its inverse will benondegenerate if the three points are noncollinear in both spaces. To infer the a�ne transformmatrix from a three point correspondence that maps (uk; vk) to (xk; yk) for k = 0; 1; 2, we solve thefollowing matrix equation for Msd: Md =MsMsd= 8>>>>>>:x0 y0 1x1 y1 1x2 y2 19>>>>>>; = 8>>>>>>:u0 v0 1u1 v1 1u2 v2 19>>>>>>;8>>>>>>: a d 0b e 0c f 19>>>>>>;The above relation is 6 scalar equations in 6 unknowns a-f , but the system simpli�es easily intotwo 3� 3 systems, one for x and one for y.A�ne mappings can map any triangle in source space into any triangle in destination space,or map a source rectangle into a destination parallelogram, but no more general distortions arepossible. To warp a rectangle into a general quadrilateral, we will need a bilinear, projective, orsome other more complex mapping.2.2.2 Bilinear MappingsBilinear mappings are most commonly de�ned as a mapping of a square into a quadrilateral. Asshown in �gure 2.5, this mapping can be computed by linearly interpolating by fraction u along thetop and bottom edges of the quadrilateral, and then linearly interpolating by fraction v betweenthe two interpolated points to yield destination point (x; y) [Faux-Pratt79]:(x; y) = (1� u)(1� v)p00 + u(1 � v)p10 + (1� u)vp01 + uvp1114

Page 17: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.5: Bilinear mapping.The general form in matrix notation is:( x y ) = ( uv u v 1 )8>>>>>>>>>>: a eb fc gd h9>>>>>>>>>>;A bilinear mapping is a�ne if a = e = 0. The matrix of 8 coe�cients may be computed from thefour point correspondence of �gure 2.5 as follows:8>>>>>>>>>>: a eb fc gd h9>>>>>>>>>>; = 8>>>>>>>>>>: 1 �1 �1 1�1 1 0 0�1 0 1 01 0 0 09>>>>>>>>>>;8>>>>>>>>>>:x00 y00x10 y10x01 y01x11 y119>>>>>>>>>>;This mapping transforms a unit square into the general quadrilateral p00;p10;p11;p01, which ana�ne mapping cannot do.The bilinear mapping has an unusual mix of properties. Because of its linear interpolation, theforward transform from source to destination space preserves lines which are horizontal or vertical inthe source space, and preserves equispaced points along such lines, but it does not preserve diagonallines, as shown in �gure 2.6. Also, the composition of two bilinear mappings is not bilinear, butbiquadratic.The inverse mapping from destination space to source space is not a bilinear mapping either;in fact it is not single-valued. The inverse can be derived by solving for v in the x equation:v = x� bu� dau+ cand substituting into the y equation. The same can be done for u, yielding the two quadraticequations: (au+ c)(fu+ h� y)� (eu+ g)(bu + d� x) = 0(av + b)(gv + h� y)� (ev + f)(cv + d� x) = 0so Au2+Bu+C = 0Dv2+Ev+F = 015

Page 18: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.6: Bilinear warps of a test grid. a) Grid in source space. b) Warped grid in destinationspace for quadrilateral 1 (vertices marked with dots). Note curvature of diagonals. c) Warped gridin destination space for quadrilateral 2. Diagonals map to parabolas in destination space. Notefoldover of some diagonals (caused by the existence of two roots in quadratic equation).16

Page 19: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

where A = af�be B = ex�ay+ah�de+cf�bg C = gx�cy+ch�dgD = ag�ce E = ex�ay+ah�de�cf+bg F = fx�by+bh�dfWe can �nd (u; v) in terms of (x; y) by evaluating the coe�cients A, B, and C above and thencomputing: u = �B �pB2 � 4AC2A ; v = x� bu� dau+ cThe inverse transform is multi-valued, and is much more di�cult to compute than the forwardtransform.2.2.3 Projective MappingsThe projective mapping, also known as the perspective or homogeneous transformation, is a projec-tion from one plane through a point onto another plane [Maxwell46]. Homogeneous transformationsare used extensively for 3-D a�ne modeling transformations and for perspective camera transforma-tions [Foley-van Dam82]. The 2-D projective mappings studied here are a subset of these familiar3-D homogeneous transformations.The general form of a projective mapping is a rational linear mapping:x = au+ bv + cgu+ hv + i ; y = du+ ev + fgu+ hv + i (2.1)Manipulation of projective mappings is much easier in the homogeneous matrix notation:pd = psMsd= (x0 y0 w ) = (u0 v0 q )8>>>>>>: a d gb e hc f i 9>>>>>>;where (x; y) = (x0=w; y0=w) for w 6= 0, and (u; v) = (u0=q; v0=q) for q 6= 0.Although there are 9 coe�cients in the matrix above, these mappings are homogeneous, so anynonzero scalar multiple of these matrices gives an equivalent mapping. Hence there are only 8degrees of freedom in a 2-D projective mapping. We can assume without loss of generality thati = 1 except in the special case that source point (0; 0) maps to a point at in�nity. A projectivemapping is a�ne when g = h = 0.Projective mappings will in general map the line at in�nity to a line in the real plane. We canthink of this line as the horizon line of all vanishing points, by analogy to the perspective projection.A�ne mappings are the special case of projective mappings that map the line at in�nity into itself.By de�ning the projective mapping over the projective plane and not just the real plane, projectivemappings become bijections (one-to-one and onto), except when the mapping matrix is singular.For nondegenerate mappings the forward and inverse transforms are single-valued, just as for ana�ne mapping.Projective mappings share many of the desirable properties of a�ne mappings. Unlike bilinearmappings, which preserve equispaced points along certain lines, the projective mappings do notin general preserve equispaced points (�gure 2.7). Instead they preserve a quantity called the\cross ratio" of points [Coxeter78]. Like a�ne mappings, projective mappings preserve lines at all17

Page 20: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.7: Projective warps of a test grid controlled by the same quadrilaterals as �gure 2.6.a) Warped grid in destination space for quadrilateral 1. b) Warped grid in destination space forquadrilateral 2. Note the vanishing points.orientations. In fact, projective mappings are the most general line-preserving bijective mappings.Projective mappings may be composed by concatenating their matrices.Another remarkable property is that the inverse of a projective mapping is a projective mapping.This is intuitively explained by reversing the plane-to-plane mapping by which a projective mappingis de�ned. The matrix for the inverse mapping is the inverse or adjoint of the forward mapping. (Theadjoint of a matrix is the transpose of the matrix of cofactors [Strang80]; M�1 = adj(M)=det(M)).In homogeneous algebra, the adjoint matrix can be used in place of the inverse matrix whenever aninverse transform is needed, since the two are scalar multiples of each other, and the adjoint alwaysexists, while the inverse does not if the matrix is singular. The inverse transformation is thus:ps = pdMds= (u0 v0 q ) = ( x0 y0 w )8>>>>>>:A D GB E HC F I 9>>>>>>;= ( x0 y0 w )8>>>>>>: ei� fh fg � di dh� egch� bi ai� cg bg � ahbf � ce cd� af ae� bd9>>>>>>;When mapping a point by the inverse transform we compute (u; v) from (x; y). If w 6= 0 and q 6= 0then we can choose w = 1 and calculate:u = Ax+By + CGx+Hy + I ; v = Dx+Ey + FGx+Hy + I (2.2)18

Page 21: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Inferring Projective MappingsIn an interactive image warper one might specify the four corners of source and destination quadri-laterals with a tablet or mouse, and wish to warp one area to the other. This sort of task is anideal application of projective mappings, but how do we �nd the mapping matrix?A projective mapping has 8 degrees of freedom which can be determined from the source anddestination coordinates of the four corners of a quadrilateral. Let the correspondence map (uk; vk)to (xk; yk) for vertices numbered cyclically k = 0; 1; 2; 3. All coordinates are assumed to be real(�nite). To compute the forward mapping matrix Msd, assuming that i = 1, we have eightequations in the eight unknowns a-g:xk = auk + bvk + cguk + hvk + 1 ) uka+ vkb+ c� ukxkg � vkxkh = xkyk = duk + evk + fguk + hvk + 1 ) ukd+ vke+ f � ukykg � vkykh = ykfor k = 0; 1; 2; 3. This can be rewritten as an 8� 8 system:8>>>>>>>>>>>>>>>>>>>>>>>>>>>>:u0 v0 1 0 0 0 �u0x0 �v0x0u1 v1 1 0 0 0 �u1x1 �v1x1u2 v2 1 0 0 0 �u2x2 �v2x2u3 v3 1 0 0 0 �u3x3 �v3x30 0 0 u0 v0 1 �u0y0 �v0y00 0 0 u1 v1 1 �u1y1 �v1y10 0 0 u2 v2 1 �u2y2 �v2y20 0 0 u3 v3 1 �u3y3 �v3y3

9>>>>>>>>>>>>>>>>>>>>>>>>>>>>;8>>>>>>>>>>>>>>>>>>>>>>>>>>>>:abcdefgh9>>>>>>>>>>>>>>>>>>>>>>>>>>>>; = 8>>>>>>>>>>>>>>>>>>>>>>>>>>>>:

x0x1x2x3y0y1y2y39>>>>>>>>>>>>>>>>>>>>>>>>>>>>;This linear system can be solved using Gaussian elimination for the forward mapping coe�cientsa-h. If the inverse mapping is desired instead, then either we compute the adjoint of Msd or wefollow the same procedure, starting from equation (2.2) instead of (2.1), and solve an 8� 8 systemfor coe�cients A-H.In speed-critical special cases, there are more e�cient formulas for computing the mappingmatrix. The formula above handles the case where the polygon is a general quadrilateral in bothsource and destination spaces. We will consider three additional cases: square-to-quadrilateral,quadrilateral-to-square, and (again) the general quadrilateral-to-quadrilateral mapping.Case 1. The system is easily solved symbolically in the special case where the uv quadrilateralis a unit square. If the vertex correspondence is as follows:x y u vx0 y0 0 0x1 y1 1 0x2 y2 1 1x3 y3 0 1

19

Page 22: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

then the eight equations reduce to c = x0a+ c� gx1 = x1a+ b+ c� gx2 � hx2 = x2b+ c� hx3 = x3f = y0d+ f � gy1 = y1d+ e+ f � gy2 � hy2 = y2e+ f � hy3 = y3If we de�ne �x1 = x1 � x2 �x2 = x3 � x2 �x = x0 � x1 + x2 � x3�y1 = y1 � y2 �y2 = y3 � y2 �y = y0 � y1 + y2 � y3then the solution splits into two sub-cases:(a) �x = 0 and �y = 0. This implies that the xy polygon is a parallelogram, so the mappingis a�ne, and a = x1 � x0, b = x2 � x1, c = x0, d = y1 � y0, e = y2 � y1, f = y0, g = 0, h = 0.(b) �x 6= 0 or �y 6= 0 gives a projective mapping:g = �����x �x2�y �y2 ���� / �����x1 �x2�y1 �y2 ����h = �����x1 �x�y1 �y ���� / �����x1 �x2�y1 �y2 ����a = x1 � x0 + gx1b = x3 � x0 + hx3c = x0d = y1 � y0 + gy1e = y3 � y0 + hy3f = y0This computation is much faster than a straightforward 8 � 8 system solver. The mapping aboveis easily generalized to map a rectangle to a quadrilateral by pre-multiplying with a scale andtranslation matrix.Case 2. The inverse mapping, a quadrilateral to a square, can also be optimized. It turns outthat the most e�cient algorithm for computing this is not purely symbolic, as in the previous case,but numerical. We use the square-to-quadrilateral formulas just described to �nd the inverse of thedesired mapping, and then take its adjoint to compute the quadrilateral-to-square mapping.Case 3. Since we can compute quadrilateral-to-square and square-to-quadrilateral mappingsquickly, the two mappings can easily be composed to yield a general quadrilateral-to-quadrilateralmapping (�gure 2.8). This solution method is faster than a general 8� 8 system solver.Source code to infer a projective mapping from a quadrilateral correspondence is contained inxA.2. 20

Page 23: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.8: Quadrilateral to quadrilateral mapping as a composition of simpler mappings.2.2.4 Comparison of Simple MappingsAs mentioned previously, a�ne and projective mappings are closed under composition, but bilinearmappings are not. The three basic mapping classes compose as follows:+ MAP1 � MAP2 ) a�ne bilinear projectivea�ne a�ne bilinear projectivebilinear bilinear biquadratic rational bilinearprojective projective rational biquadratic projectiveThus, the composition of two bilinear mappings is a biquadratic mapping.Since (nonsingular) a�ne and projective mappings are closed under composition, have an iden-tity and inverses, and obey the associative law, they each form a group under the operation ofcomposition. Bilinear mappings do not form a group in this sense.We summarize the properties of a�ne, bilinear, and projective mappings below:PROPERTY AFFINE BILINEAR PROJECTIVEpreserves parallel lines yes no nopreserves lines yes noy yespreserves equispaced points yes noy nomaps square to parallelogram quadrilateral quadrilateraldegrees of freedom 6 8 8closed under composition yes no, biquadratic yesclosed under inversion yes no, solve quadratic yessingle-valued inverse yes no yesforms a group yes no yesincremental forward mapping 2 adds 2 adds 2 divs, 3 addszincremental inverse mapping 2 adds 1 square root, more 2 divs, 3 addsyexcept for horizontal and vertical lines in source spacezsee x2.3.5 21

Page 24: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

For the designer, a�ne mappings are the simplest of the three classes. If more generality isneeded, then projective mappings are preferable to bilinear mappings because of the predictabilityof line-preserving mappings. For the implementer, the group properties of a�ne and projectivemappings make their inverse mappings as easy to compute as their forward mappings. Bilinearmappings are computationally preferable to projective mappings only when the forward mappingis used much more heavily than the inverse mapping.2.3 Two-Dimensional Mappings in Texture MappingAs mentioned earlier, texture mapping consists of a transformation of 2-D texture space to a 3-D surface via the parameterization, and then a projection of that surface into 2-D screen space.Two-dimensional mappings are central to each of these transformations. Parameterization is a2-D mapping of a texture onto a surface in 3-D, and rendering uses a 2-D mapping to control theresampling of the texture to produce a screen image. We can thus make use of the 2-D mappingsdiscussed above in both modeling and rendering textured surfaces.2.3.1 Parameterizing Planar PatchesThe 2-D mappings described earlier can be used to parameterize polygons and other planar surfaces.A surface parameterization describes surface points in 3-D object space in terms of two parametersu and v. We call a parameterized plane a planar patch.Planes are most easily parameterized a�nely, by selecting two linearly independent basis vectorsin the plane and a point in the plane. These three 3-D points de�ne the 9 degrees of freedom of ana�ne parameterization or a�ne patch. An a�ne patch is given by:( x y z ) = ( u v 1 )8>>>>>>: a d gb e hc f i 9>>>>>>;Just as with purely 2-D mappings, a�ne patches allow arbitrary triangle-to-triangle and rectangle-to-parallelogram mappings, but not rectangle-to-arbitrary-quadrilateral mappings. Source code toinfer an a�ne mapping from the texture and object space coordinates of a polygon is given in xA.3.Occasionally one may need more generality than is provided by a�ne mappings, for example,to distort a rectangular brick texture into a trapezoidal keystone. For this we need bilinear orprojective patches (the latter also known as rational linear patches). The general form of a bilinearpatch is: ( x y z ) = ( uv u v 1 )8>>>>>>>>>>: a e ib f jc g kd h l 9>>>>>>>>>>;and projective patches have the form:( x0 y0 z0 w ) = (u0 v0 q )8>>>>>>: a d g jb e h kc f i l 9>>>>>>;(The coe�cients a� l are unrelated between these three forms, of course).22

Page 25: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Like a�ne patches, projective patches are always planar. Bilinear patches can be nonplanar,however. The general bilinear patch has 12 degrees of freedom, while planar bilinear patches andprojective patches have 11 degrees of freedom. The coe�cients of a bilinear or projective patch canbe inferred from a four point correspondence between texture space and object space.Bilinear patches are sometimes used in texture mapping [Hourcade-Nicolas83], [Catmull-Smith80]when nonplanar quadrilaterals are needed. Projective patches are usually preferable for planarquadrilaterals, however, because of their superior properties. Occasionally, practitioners have usedbilinear patches when projective patches would have been more appropriate. For example, bilin-ear parameterizations were proposed for point-in-quadrilateral testing in a ray tracing machine[Ullner83]. In that algorithm, a ray is intersected with the plane of a polygon to determine theintersection point in object space. Next, point inclusion is determined by inverting the bilinearmapping, transforming object space coordinates to texture space, and testing if (u; v) lies within aunit square. The hardware designed was quite complex, as it involved square roots. If projectivepatches had been used instead then the inverse mapping could have been much simpler. (There arefaster methods for point-in-quadrilateral testing than transforming to a unit square, of course.)2.3.2 Deducing Projective MappingsIf a chain of transformations from texture space to screen space is known, then we can synthesizethe compound mapping matrix; there is no need to infer it from vertex correspondences. Thecompound mapping is most easily found for projective mappings.We use the following notation:COORDINATE SYSTEM REAL HOMOGENEOUS2-D texture space (u; v) pt = (u0; v0; q)3-D object space (xo; yo; zo) po = (xowo; yowo; zowo; wo)3-D screen space (x; y; z) p� = (x0; y0; z0; w)2-D screen space (x; y) ps = (x0; y0; w)To synthesize the texture-to-screen transform, we concatenate the 3� 4 projective parameteri-zation matrix Mto that maps texture space to object space, the 4 � 4 modeling and (perspectiveor parallel) viewing matrix Mo� that maps object space to 3-D screen space, and a 4 � 3 matrixM�s that discards z to arrive at 2-D screen space:Mts =MtoMo�M�s= 8>>>>>>: � � � �� � � �� � � �9>>>>>>;8>>>>>>>>>>: � � � �� � � �� � � �� � � �9>>>>>>>>>>;8>>>>>>>>>>: 1 0 00 1 00 0 00 0 19>>>>>>>>>>;The resulting matrix Mts is the 3� 3 matrix for the projective compound mapping.2.3.3 Other ParameterizationsThere are many other surface parameterization schemes besides those described here; we have cov-ered only the simplest planar parameterizations. For curved surfaces, parameterization ease varies23

Page 26: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

with modeling technique. Parameterizations are inherent when a surface is modeled parametrically[Faux-Pratt79], but can be di�cult to construct for implicit surfaces. One method for fabricatinga parameterization uses the coordinates of 3-D object space as texture parameters rather thanattempt to construct surface-following parameters. These coordinates become arguments to a pro-cedural or tabular solid texture [Perlin85], [Peachey85], and result in objects appearing carved froma solid, rather than covered by a pattern. Two-dimensional textures can also be projected ontosurfaces as decals [Bier-Sloan86].2.3.4 Scanning Textures and Image WarpsTo render a texture mapped surface we must compose the parameterization and projection map-pings. As shown in the mapping composition table earlier, some combinations of parameteri-zation and projection compose elegantly; others do not. For example, an a�ne- or projective-parameterized plane viewed with a perspective projection yields a projective compound mapping,but a bilinear-parameterized plane viewed in perspective gives a more complex compound transfor-mation, a rational bilinear mapping. This suggests that perspective projections of textured planesare equally easy to render when an a�ne or projective parameterization is used, and di�cult torender for a bilinear parameterization.There are three general approaches to drawing a texture mapped surface or performing an imagewarp: scanning in screen space, scanning in texture space, and scanning in multiple passes. Thethree algorithms are outlined below:SCREEN ORDER:for yfor xcompute u(x,y) and v(x,y)SCR[x,y] = TEX[u,v]

24

Page 27: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

TEXTURE ORDER:for vfor ucompute x(u,v) and y(u,v)SCR[x,y] = TEX[u,v]MULTI-PASS:for vfor ucompute x(u,v)TEMP[x,v] = TEX[u,v]for xfor vcompute y(x,v)SCR[x,y] = TEMP[x,v]where TEX is the texture array, SCR is the screen array, and TEMP is an intermediate array.The multi-pass outline given above is two-pass, but there are variations using three or more passes.Note that resampling should involve �ltering, not point sampling, an issue we ignore here.Screen order, sometimes called inverse mapping, is the most common method. Each pixel inscreen space is inverse-transformed to texture space and the texture pixel there is read. When usingscreen order we need to invert the mapping, which is easy for projective mappings but di�cult forbilinear mappings. Screen order scanning is preferred when the screen must be written sequentially,the mapping is readily invertible, and the texture is random access.The second scanning method is texture order. Scanning in texture order may seem simplerthan screen order, since it does not require the inverse mapping, but preventing holes or overlapsin screen space is tricky [Shantz-Lien87]. One solution is to add mapped samples into a screenspace accumulator bu�er with a �lter function. Texture order is preferable only when the texture-to-screen mapping is di�cult to invert, or when the texture image must be read sequentially andwill not �t in random access memory.Multi-pass methods decompose a 2-D mapping into two or more 1-D mappings. In the two-passform, the �rst pass processes the rows of an image and the second pass processes the columns.Multi-pass methods have been used for both texture mapping [Catmull-Smith80], [Smith87] andfor image processing [Wolberg88], to perform geometric correction of images [Fraser-Schowengerdt-Briggs85] or a�ne image warps [Paeth86]. These methods work particularly well for a�ne andprojective mappings, where the 1-D resampling warps for each pass are a�ne and projective (ratio-nal linear), respectively. Bilinear mappings are possible as well, but they require rational quadraticresampling warps [Catmull-Smith80]. Multi-pass methods are the preferred scanning order whenthe texture cannot be accessed randomly but it has rapid row and column access, and a bu�er forthe intermediate image is available.25

Page 28: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

2.3.5 Incremental Techniques for Screen Order ScanningA�ne image warps can be computed by linearly interpolating u and v along the sides of a polygonand across each scan line, as implemented in the naive texture mapper presented earlier. Suchwarps are appropriate for a�nely parameterized polygons viewed with parallel projection.It is now clear how to perform correct texture mapping for projective mappings as well. Asdiscussed earlier, polygons that are viewed in perspective and parameterized either a�nely orwith a projective mapping will have a projective compound mapping. The algorithm for scanningprojective warps is nearly the same as that for a�ne warps, the only di�erence being that wecannot linearly interpolate u and v. For projective mappings, u and v are rational linear, notlinear, functions of the screen coordinates. So we linearly interpolate the quantities uq, vq, and q,which are linear in x and y, and perform two divisions per pixel:for x = xleft to xrightif z < ZBUF[x,y] then is new point closer?ZBUF[x,y] = z update z-bu�er(r, g, b) = TEX[uq/q,vq/q] sample textureSCR[x,y] = (r, g, b) write screenz = z+dz(uq, vq, q) = (uq, vq, q) + (duq, dvq, dq)Divisions are necessary at each pixel for projective mappings because u and v are rational linearfunctions of x. (Of course, if g = h = 0 then q = 1 and the extra work is unnecessary, but thisoccurs exactly when the projective mapping happens to be a�ne.) The additional cost of twodivisions per pixel is modest even when an inexpensive texture �lter (such as point sampling) isused, and is negligible when a more expensive �lter is used. When performing projective mappingsfor image distortion applications rather than texture mapping we would use the same algorithmbut without the z-bu�er.Rational linear interpolation of u and v in this way eliminates the ripple, rotation variance,and foreshortening problems mentioned earlier (�gure 2.3). This solution to those problems ispreferable to polygon subdivision because it totally eliminates the artifacts, at a minor increasein complexity. (Note that Gouraud and Phong shading in perspective, computed using linearinterpolation, also give rotation variant artifacts, albeit much less visible than those of texturecoordinate interpolation. Rotation variance of these smooth shading techniques can also be �xedusing rational linear interpolation.)2.4 Example: Photomosaics by Image WarpingWe now present an application of image warps. Figure 2.9 shows two photographs taken from thesame viewpoint but with di�erent camera rotations. The �elds of view overlap, so an image mosaiccan be created by texture mapping each photograph onto an imaginary plane perpendicular toits line of sight and rendering the 3-D scene with a perspective view from the original viewpoint(�gure 2.10). (The photographs are from Florence, site of the renaissance of perspective.) Themapping was found by measuring the coordinates of four pairs of corresponding points in theregion of overlap, and using projective mapping inference techniques described in x2.2.3 and xA.2.26

Page 29: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Assuming no lens aberration or vignetting, the two images will merge without discontinuity, andwe can simulate the photograph that would have resulted from any combination of camera zoomand orientation. In fact, if a panorama of photographs were taken, views in any direction could besynthesized [Greene86].2.5 SummaryTwo-dimensional mappings are a fundamental operation in texture mapping and image warping. Intexture mapping, the modeling task of parameterization and the rendering task of scan conversionboth use two-dimensional mappings. Image processing uses two-dimensional mappings for thegeometric correction of distorted images.We have discussed the most basic mappings: a�ne, bilinear, and projective. A�ne mappingsare very simple and e�cient, and may be constructed from any three-point correspondence. The twogeneralizations of a�ne mappings, bilinear and projective, can be constructed from any four-pointcorrespondence. When generality beyond an a�ne mapping is needed, the projective mapping ispreferable in most respects. Geometrically, the projective mapping is line preserving; computation-ally, it is closed under composition and inversion, so it adapts easily to any scanning order. Toperform projective texture mapping or image warping, linear interpolation of texture coordinatesis inappropriate. Instead we interpolate homogeneous texture coordinates and perform a divisionat each pixel. The additional cost is often negligible relative to a�ne mapping.

27

Page 30: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.9: Images for photomosaic test. Photographs from the interior of the Pitti Palace,Florence. The �elds of view overlap, but the perspectives are di�erent, since the camera was tiltedup for the top image. 28

Page 31: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 2.10: Photomosaic by image warping. Synthesized image in which �gure 2.9 (top) waswarped to register with �gure 2.9 (bottom), and the two were overlayed.29

Page 32: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Chapter 3Resampling Filters3.1 Is Filtering Needed?Earlier, in our naive implementation of texture mapping, we used point sampling to read datafrom the texture image: the center of the screen pixel was mapped to texture space and the valueat the nearest texture pixel was read. This technique is simple, fast, and works well for someimages (�gure 3.1). If we point sample images containing high frequencies, however, objectionablemoire patterns can result (�gure 3.2). This artifact is called texture aliasing. The e�ect is verydistracting in animation, where the moire pattern can boil and sparkle from frame to frame. Similarartifacts occur in image warping applications. Such artifacts are intolerable in realistic still imagesor animation, so we will endeavor to eradicate them.Aliasing has been studied extensively in the �eld of digital signal processing. The readeris referred to the elementary [Jackson86], [Hamming83] and advanced [Oppenheim-Schafer75],[Brigham74], [Pratt78], [Dudgeon-Mersereau84] texts for derivations of the theory we summarizein this chapter.Most of the theoretical research on resampling to date has been driven by audio applications,and is consequently limited to 1-D uniform resampling (i.e. a�ne mappings) [Crochiere-Rabiner83].Signal processing theory has been applied by computer graphicists to problems of edge antialias-ing [Crow77] with good results. Existing theory is lacking for problems of resampling non-a�nemappings, however [Smith83], so most of the �lters developed for texture mapping [Catmull74],[Blinn-Newell76], [Feibush-Levoy-Cook80], [Williams83], [Crow84], [Heckbert86b] have been basedon �lter design heuristics and subjective quality comparisons.First we will review the causes of aliasing during resampling. We then develop a theory ofideal resampling �lters that eliminate aliasing during resampling. We close this chapter with ademonstration of the use of resampling �lter theory for texture mapping.3.2 Sampling: The Cause of AliasingThe aliasing problem in computer graphics and image processing is due to the digital nature of ourcomputers. Whereas images in nature and geometric models of objects have a continuous spatial30

Page 33: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.1: Texture mapping with point sampling. Texture resolution is close to screen resolution,so little aliasing results.

Figure 3.2: Texture mapping with point sampling, with more extreme compression. Note moire nearhorizon. 31

Page 34: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.3: Sampling and reconstruction of a continuous signal.domain, images in a computer are represented by a discrete array of samples. We will focus onone-dimensional signals for the moment, and return to multidimensional signals (such as images)later.When a digital signal is created from an analog signal it is sampled in space and quantizedin value. We are unconcerned with quantization here, so we will call continuous-space signalssimply continuous signals and call discrete-space signals discrete signals. Figure 3.3 (left) showsthe conversion of a continuous signal ac into a discrete signal a by periodic sampling. This signalcould represent the intensity pro�le of one scan line of an image, or perhaps an audio signal varyingover time. Regardless of the signal's meaning, conversion to and from a discrete representation hasa number of consequences.To explain these consequences we need to de�ne some �lter terminology [Jackson86]. A systemthat processes an input signal a to produce an output signal or response b is called a �lter. A�lter is called space invariant (or time invariant) if a spatial shift in the input causes an equalshift in the output: input a(x � s) gives output b(x� s) for any shift s. A �lter is called linear ifscaling or superposition in its input causes equivalent scaling or superposition in its output: input�1a1(x) + �2a2(x) gives output �1b1(x) + �2b2(x) for all �1, �2. If a �lter is both linear and spaceinvariant then it is uniquely characterized by its impulse response h(x), the output resulting froman impulse input. (An impulse �(x) is a sample occurring at x = 0 and is zero elsewhere). Sinceany input signal can be represented in the limit by an in�nite sum of shifted and scaled impulses,the output of a linear, space invariant �lter, by these properties, will be a superposition of shifted,scaled impulse responses. This operation is the convolution of the input signal a with the �lter h.The convolution of signals f and g is (f �� g)(x) = R+1�1 f(t)g(x� t) dt. Later we will consider moregeneral, space variant �lters.The di�culties with discrete representation become evident when we try to reconstruct a contin-uous signal from a discrete signal. This is done by convolving the sampled signal with a reconstruc-tion �lter. The theoretically ideal reconstruction �lter is the sinc function, (sinc(x) = sin(�x)=�x).(We will discuss the derivation of the sinc �lter later.) As shown in �gure 3.3 (right), reconstruc-tion with a sinc does not always recover the original signal. Why not? Judging this �gure visually,the approximation appears best toward the left where the original signal varies slowly, but is poortoward the right, where the original signal varies with high frequency. This behavior suggeststhat reconstruction accuracy is a function of frequency. Aliasing is best understood in terms of afrequency analysis of signals and �lters using the Fourier transform [Brigham74].32

Page 35: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

3.2.1 Frequency Analysis of AliasingThe units of frequency can be either angular frequency in radians per unit distance, denoted !, orrotational frequency in cycles per unit distance, denoted f . The two are related by ! = 2�f . Wewill use angular frequency !.The response of a linear, space invariant system to a sinusoidal (complex exponential) input is acomplex exponential of the same frequency but altered amplitude and phase. The complex functionF (!) describing the amplitude and phase of these responses at each frequency ! is the system'sfrequency response. Complex exponentials are the eigenfunctions of the system, and the frequencyresponse is the set of eigenvalues. The frequency response of a �lter can be computed as the Fouriertransform of its impulse response. The Fourier transform of a signal (as opposed to a �lter) is calledthe signal's spectrum. To relate the Fourier transform pair f and F , we write f(x) $ F (!), andwe say that f(x) lies in the spatial domain and F (!) lies in the frequency domain.The Fourier transform is de�ned asF (!) = Z +1�1 f(x)e�j!x dxand the inverse Fourier transform describes the signal in terms of its spectrum:f(x) = 12� Z +1�1 F (!)ej!x d!Some other important properties of the Fourier transform:(1) The Fourier transform of a convolution of two signals is the product of their Fouriertransforms: f �� g $ FG.(2) The Fourier transform of a product of two signals is the convolution of their Fouriertransforms: fg $ F ��G=2�.(3) When a signal is scaled up spatially, its spectrum is scaled down in frequency, and viceversa. This is an uncertainty principle for signals: a signal cannot be narrow bothspatially and spectrally [Hamming83].(4) The Fourier transform of a real function is a conjugate-symmetric function.(5) The Fourier transform of a periodic function is a discrete function, and vice versa.Using frequency analysis we can understand the aws in our previous reconstruction. As shownin �gure 3.4, examination of the spectrum of the signal before and after sampling reveals theproblem. Sampling the continuous signal ac(x) to arrive at the discrete signal in a(x) is equivalentto multiplying it by an impulse train (�gure 3.4b): a(x) = ac(x)i(x=T ), where T is the sampleperiod and i(x) is a sum of unit-spaced impulses: i(x) = P+1n=�1 �(x � n). The discrete signal isa product of signals, and multiplication in the spatial domain corresponds to convolution in thefrequency domain, so the spectrum of the discrete signal is the convolution of the spectrum ofthe continuous signal with the spectrum of the sampling grid: A(!) = Ac(!) �� I(!)=2�. But theFourier transform of an impulse train i(x=T ) is another impulse train I(!) = !si(!=!s), where!s = 2�=T is the spatial sampling frequency. Convolution with an impulse train superposes a33

Page 36: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.4: Sampling above the Nyquist rate (no aliasing).34

Page 37: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.5: Sampling below the Nyquist rate (aliasing).35

Page 38: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.6: Ideal antialiasing is pre�ltering before sampling.sequence of translated replicas of the spectrum Ac, making the spectrum of the sampled signalperiodic (�gure 3.4c).If the replicated spectra do not overlap in the spectrum of the discrete signal then we canreconstruct the continuous signal by eliminating all replicas except the central one (�gure 3.4e).We can do this with a multiplication in the frequency domain, which corresponds to a �lteringoperation. The type of �lter needed for reconstruction is thus a low pass �lter, a �lter that passeslow frequencies and stops high frequencies (�gure 3.4d). The frequency response of an ideal lowpass �lter with cuto� !c is a box function: H(!) = 1 for ! � !c and 0 otherwise, and its impulseresponse is a sinc, as mentioned earlier. For reconstruction we want a cuto� frequency at theNyquist frequency !s=2 = �=T , which is half the sampling frequency.If the replicas overlap, as in �gure 3.5, it is impossible to extract the original spectrumAc from Aonce the replicas are summed. This is aliasing. The high frequencies of the continuous signal, whenreplicated and summed by the sampling process, masquerade, or alias, as low frequencies. Aliasingneed not occur if the continuous signal is band limited. A signal is band limited with bandwidth!b if it has no frequencies above !b: Ac(!) = 0 for j!j � !b. For a band limited continuoussignal, aliasing will not occur if the bandwidth is less than the Nyquist frequency (!b < !s=2). Anequivalent statement is the Sampling Theorem [Shannon49], which states that a continuous signalwith bandwidth !b can be reconstructed exactly if the sampling frequency is at least twice thebandwidth (!s > 2!b).3.3 AntialiasingTypically a continuous input signal is not band limited, yet we would like to perform meaningfulprocessing anyway. There are two general methods for antialiasing, that is, reducing aliasing, inthis situation: (1) sampling at a higher frequency, and (2) pre�ltering the signal.3.3.1 Sampling at Higher FrequencySampling at a higher frequency won't eliminate aliasing if the input signal is not band limited,but it will usually reduce it, since most signals of interest have decreasing amplitude in the highfrequencies. Unfortunately, increasing the sampling frequency is often prohibitively expensive inboth memory and time. Furthermore, it is impossible to pick a sampling frequency that is adequatefor all input signals, since most are not bandlimited.3.3.2 Pre�ltering 36

Page 39: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

The more theoretically correct antialiasing method is pre�ltering. A pre�lter is a low pass �lterapplied to a signal before sampling (�gure 3.6). If h is the pre�lter then the new, pre�ltered inputsignal is a0c = ac �� h, and the discrete signal is its sampling: a = a0ci. If we use an ideal low pass�lter with cuto� at the Nyquist frequency !s=2 then the �ltered continuous signal a0c will be bandlimited and we can reconstruct it exactly from a, as shown in �gure 3.7.The widths of a �lter in the spatial and frequency domains are inversely related. The widthof the nonzero portion of an impulse response is called its support. A �lter with �nite support iscalled a �nite impulse response (FIR) �lter, and a �lter with in�nite support is an in�nite impulseresponse (IIR) �lter. The uncertainty principle thus implies that a �nite impulse response �lterhas in�nite frequency response and a �nite frequency response �lter has in�nite impulse response.Therefore, an ideal low pass �lter, because it has �nite frequency response, is not an FIR �lter. FIR�lters are precisely the class of �lters most common in image processing, however, because theyare the easiest 2-D �lters to design and implement [Dudgeon-Mersereau84]. And since FIR �ltersare usually implemented using convolution, the expense of which is proportional to the support, wedesire �lters with small support. Narrowing the support broadens the frequency response, generallydecreasing the quality of the �lter, however. The uncertainty principle for signals thus causes atradeo� between the e�ciency of an FIR �lter and its quality.When antialiasing in practice, then, no pre�lter is an ideal low pass �lter, so some aliasing isinevitable during sampling. Antialiasing amounts to the design of pre�lters that can be implementede�ciently yet admit minimal aliasing.In actual systems, reconstruction is done with a less-than-ideal reconstruction �lter. The re-construction �lter that smooths between scan lines of a video signal on a cathode ray tube is not asinc, but is approximately Gaussian. When a non-ideal reconstruction �lter is known a priori thenthe pre�lter methods above are inappropriate; we can do better with pre�lters that are adapted tothe reconstruction �lter [Kajiya-Ullner81], [Hummel83].So far we have spoken only of spatial aliasing. Aliasing can occur in time as well. Such temporalaliasing is visible in movies when a fast-moving wheel appears to spin backwards. This \wagonwheel e�ect" is due to the poor pre�ltering performed by �lm camera shutters that stay open foronly a fraction of the frame time. If cameras e�ected a better temporal low pass �lter then afast-moving wheel would appear as a blur in movies, as it does to the naked eye.3.3.3 Some Low Pass FiltersLow pass �lters are usually designed with the frequency domain constraints shown in �gure 3.8[Jackson86]. As stated earlier, the ideal low pass �lter is a box in frequency space, but such a �lteris not realizable as an FIR �lter, so the ideal is padded with tolerances to make it realizable. Thepass band is the range of frequencies that are passed relatively unchanged by the �lter, the stopband is the range of frequencies that are nearly eliminated by the �lter, and the transition band isthe intermediate range of frequencies. High quality �lters have small tolerances on the pass andstop bands and a narrow transition band, at the expense of wide support in the spatial domain.Low pass �lters will often ripple in the pass band, the stop band, or in both bands. The centralhump of the frequency response is called the main lobe and the other ripples are called side lobes.The height of the �rst side lobe relative to the main lobe is one quantitative measure of �lterquality. 37

Page 40: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.7: Ideal pre�ltering eliminates aliasing.38

Page 41: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.8: Filter design parameters.To design an FIR �lter we often start with an IIR �lter and window it, multiplying the IIR�lter by a window function of �nite support. Window functions are usually even, positive functionsthat decay smoothly to zero [Hamming83]. Windowing with a box amounts to truncation of theimpulse response; this is one of the poorest window functions. We will need to window if we choosean IIR �lter such as a Gaussian or sinc.We now examine three classes of low pass �lters, the b-spline �lters, Gaussians, and Sinc �lters.The following �lters are normalized to have unit area in the spatial domain, and have horizontalscale appropriate for reconstruction of unit-spaced samples.B-Spline FilterThe simplest set of �lters are those derived from a box �lter by repeated self-convolution. We startwith an unweighted average or �rst order box:b1(x) = � 1 jxj � 1=20 jxj > 1=2 $ sin!=2!=2 = sin�f�f = sincfwhere f = !=2� is the rotational frequency. Its frequency response is a sinc, as shown at right. This�lter, when sampled, is trivial to implement, (involving several additions and one multiplication),but its frequency response is far from ideal, with high side lobes.We can make higher quality �lters by cascading n of these box �lters in series. A cascade of�lters is equivalent to a single �lter whose impulse response is the convolution of all of its component�lters, so we de�ne the nth order b-spline �lter to be:bn(x) = n timesz }| {b1(x) �� b1(x) �� � � � �� b1(x) $ sincnfThe �rst two b-spline �lters are pictured in �gure 3.9 (top).The b-spline functions are common in signal processing, computer aided geometric design, andprobability. Unfortunately, each discipline has its own names for these functions, and there has beenlittle cross-pollination to date, with the exception of a few papers [Hou-Andrews78], [Goldman83],39

Page 42: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.9: B-Spline, Gaussian, and Sinc �lters in the spatial domain (left) and frequency domain(right). Top: Box (�rst order b-spline) and tent (second order b-spline) �lters. Center: Gaussian�lters. Bottom: Sinc �lter. From [Blinn89]. 40

Page 43: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

[Heckbert86a]. In the �eld of splines these functions are known as the uniform b-spline basisfunctions [Bartels-Beatty-Barsky87]. In probability these functions arise as the probability densityof the sum of n uniform random variables.B-spline �lters of low order (n = 1 or 2) make relatively poor low pass �lters because the envelopeof their frequency responses decay only as !�n. Nevertheless, these two are perhaps the mostcommonly used low pass �lters in image processing because of the simplicity of implementation. Intwo dimensions, the second order box �lter is called bilinear interpolation.Gaussian FilterThe impulse response and frequency response of a Gaussian �lter have similar shape, as shown in�gure 3.9 (center):g�2(x) = 1�p2�e�x2=2�2 $ G�2(!) = e��2!2=2 = p2�� g1=�2(!)For reconstruction of unit-spaced samples we want a standard deviation of about � = 1=2.The b-spline �lters are FIR approximations to the Gaussian. By the Central Limit Theoremof probability [Bracewell78], as n increases, bn broadens and approaches a Gaussian (normal dis-tribution) in shape. The standard deviation of these functions grows as the square root of n:bn(x) � g�2(x) where � = pn=12. An FIR approximation to the Gaussian can also be made bywindowing. Its tails diminish rapidly, so a Gaussian can be truncated (windowed with a box) withlittle loss of quality.Sinc FilterThe sinc �lter is an ideal low pass �lter with a sharp cuto� in its frequency response:sinc(!cx=�) = sin(!cx)�x $ b1� !2!c� = � 1 j!j � !c0 j!j > !cThe sinc �lter has an ideal frequency response but its impulse response decays slowly (with anenvelope of 1=x), so windowing causes signi�cant degradation of the �lter.3.4 Ideal Resampling FiltersFor texture mapping and image warping, the sampling grids of the source and destination imagesdi�er, so the image must be resampled. To avoid aliasing during resampling, we need to �lterthe source image before it is sampled. The resampling �lter required depends on the mappingthat de�nes the warp being performed (�gure 3.10). We refer to the entire process of �ltering andsampling as resampling.Most previous work on resampling �lters has concentrated on the special case of a�ne warps, forwhich the resampling �lter is space invariant. A common task in audio processing is the conversionof a discrete 1-D signal from one sampling rate to another [Crochiere-Rabiner83]. The terminology41

Page 44: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.10: Forward and inverse mapping controlling a warp.of earlier researchers di�ers somewhat from ours: where they perform \interpolation" or \decima-tion" at a \uniform sampling rate" during \sampling rate conversion" for a \multirate" task, weperform \magni�cation" or \decimation" according to \a�ne mappings" during \resampling" fora \warping" task. For image processing we �nd our terminology more appropriate and concise.For their applications, Crochiere and Rabiner use 1-D space invariant resampling �lters, butsince we are interested in resampling �lters for arbitrary 2-D mappings, our �lters must be spacevariant, requiring new theory.3.4.1 General, Ideal Resampling FiltersWe de�ne proper sampling of a continuous signal as sampling at a frequency meeting the Nyquistcriterion, and ideal resampling as a process that inputs a properly sampled signal, warps it, andoutputs a properly sampled signal { with minimum information loss. As shown in �gures 3.11 and3.12 (top), the procedure for ideal resampling consists of four steps: reconstruction, warp, pre�lter,and sample [Smith83]:1. Reconstruct the continuous signal from the discrete input signal.2. Warp the domain of the continuous signal.3. Pre�lter the warped, continuous signal.4. Sample this signal to produce the discrete output signal.A closely related procedure is described by [Clark-Palmer-Lawrence85]. The problem theyaddress is the reconstruction of a continuous signal from a discrete signal sampled with nonuniformspacing, whereas our problem, resampling, involves the creation of a uniformly sampled discreteoutput signal from a uniformly sampled discrete input. Their goals are somewhat di�erent, buttheir method, like ours, describes a sampling grid in terms of a mapping.We will derive the resampling formula for general, n-dimensional signals. Given an input signalf(u), a forward mapping x = m(u) from source coordinates u to destination coordinates x, theinverse mapping u =m�1(x), a reconstruction �lter r(u) and a pre�lter h(x), we want to computethe output signal g(x). For 2-D (image) resampling, the source coordinates are u = (u; v) and the42

Page 45: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.11: The four steps of ideal resampling: reconstruction, warp, pre�lter, and sample.destination coordinates are x = (x; y). Theoretically, the reconstruction �lter and pre�lter will beideal low pass �lters (we will later approximate them by FIR �lters).The progression of signals is:discrete input signal f(u); integer ureconstructed input signal fc(u) = f(u) �� r(u) =Pk2Zn f(k) r(u� k)warped signal gc(x) = fc(m�1(x))continuous output signal g0c(x) = gc(x) �� h(x) = RRn gc(t)h(x � t) dtdiscrete output signal g(x) = g0c(x) i(x)When resampling we never actually construct a continuous signal; we compute its value only atthe relevant sample points (�gure 3.12, bottom). The steps above suggest a multi-pass approachin which we convolve, then warp, then convolve, but we can reorder the computations to grouptogether all the operations needed to produce a given output sample. Expanding the above relations43

Page 46: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.12: Resampling �lter block diagram. Top: conceptual model. Bottom: implementation.in reverse order, we have, for x on the integer lattice:g(x) = g0c(x)= ZRn fc(m�1(t)) h(x� t) dt= ZRn h(x� t) Xk2Zn f(k) r(m�1(t)� k) dt= Xk2Zn f(k) �(x;k)where: �(x;k) = ZRn h(x� t) r(m�1(t)� k) dt (3.1)We call �(x;k) the resampling �lter. The resampling �lter �(x;k) speci�es the weight of the inputsample at location k for an output sample at location x. It is space variant in general.This equation expresses the resampling �lter as a destination space integral of the pre�lter witha warped reconstruction �lter, but we can also express it as the source space integral of a warpedpre�lter with the reconstruction �lter. Assuming m�1(x) is invertible, we can change variables bysubstituting t =m(u). We call the following the Resampling Formula:�(x;k) = ZRn h(x�m(u)) r(u� k) ���@m@u ��� du (3.2)where j@m=@uj is the determinant of the Jacobian matrix [Strang80]. In 1-D, j@m=@uj = dm=du,and in 2-D, ���@m@u ��� = ����xu xvyu yv ����44

Page 47: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

where xu = @x=@u, etc. Formula (3.2) for the resampling �lter will often be more convenient forcomputation than formula (3.1).3.4.2 A�ne Mappings and Space Invariant ResamplingIn the special case of a�ne mappings, the forward mapping is x = m(u) = l(u) + c and theinverse mapping is u = m�1(x) = l�1(x) + c�1 where l(u) and l�1(x) are linear mappings andc and c�1 are constants. The Jacobian of an a�ne mapping is a constant transformation matrixJ = @m=@u interrelating source and destination spaces. The linear mappings can be expressedin terms of the Jacobian: l(u) = uJ and l�1(x) = xJ�1. For a�ne mappings, the identityl�1(x� y) =m�1(x)�m�1(y) allows the resampling �lter to be expressed as a convolution:�(x;k) = Z h(x�m(u)) r(u� k) ���@m@u ��� du= Z h0(l�1(x�m(u))) r(u� k) du where h0(u) = ���@m@u ���h(l(u)) = jJjh(uJ)= Z h0(m�1(x)� u) r(u� k) du= �0(m�1(x)� k) where �0(u) = h0(u) �� r(u)The resampling �lter for an a�ne mapping is thus space invariant, or more precisely, the �lterq(u;k) = �(m(u);k) is space invariant, sinceq(u� t;k� t) = �0(m�1(m(u� t))� (k� t)) = �0(u� k) = q(u;k)The output signal is therefore a convolution of the input with the resampling �lter:g(x) =Xk f(k) �0(m�1(x)� k)= (f �� �0)(m�1(x))3.4.3 Two-Dimensional A�ne MappingsThe equations above apply in any number of dimensions. Specializing for 2-D a�ne mappings, wehave the forward and inverse mappings:( x y 1 ) = ( u v 1 )8>>>>>>: a d 0b e 0c f 19>>>>>>;(u v 1 ) = ( x y 1 )8>>>>>>:A D 0B E 0C F 19>>>>>>;= ( x y 1 ) 1ae� bd 8>>>>>>: e �d 0�b a 0bf � ce cd� af ae� bd9>>>>>>;The Jacobian is the constant matrix: @m@u = J = 8>>: a db e9>>;45

Page 48: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

and the Jacobian determinant is jJj = ae� bd. The output signal is the convolution:g(x) = g(x; y) = (f �� �0)(m�1(x))= (f �� �0)(Ax+By+C; Dx+Ey+F )where the resampling �lter is: �0 = h0 �� rand the warped pre�lter is:h0(u) = h0(u; v) = jJjh(uJ)= (ae�bd)h(au+bv; du+ev)3.4.4 Summary: Resampling A�ne MappingsWe have seen that the mapping, the sampling grid, and the resampling �lter are all closely inter-related. The interrelationships are particularly simple for a�ne mappings. For an a�ne mapping,ideal resampling reduces to a space invariant �lter, which can be computed easily using convolution.For a given mapping m(u), the following statements are thus equivalent:� mapping is a�ne� Jacobian of mapping is constant� ideal resampling �lter is space invariant� ideal resampling �lter is a convolution� resampling grid is uniform3.5 Image Resampling in PracticeIn practice, analytic signal representations are rare, so we usually must perform �ltering numerically.Consequently, the �lters used for resampling must have �nite impulse response, and the low pass�lters used for reconstruction and pre�ltering must be less than ideal. Computation of the mappingitself or the integral implied by the resampling formula can also be impractical. These realities forceus to approximate the ideal resampling �lter.3.5.1 Resampling by Post�lteringIf the mapping is not a�ne then the resampling �lter is in general space variant. Space variantresampling �lters are much more di�cult to implement than space invariant �lters, so one mightbe tempted to sample before �ltering in such cases. This method, called post�ltering, is a simpleralternative to resampling with pre�ltering:1. Reconstruct the continuous signal from the discrete input signal.2. Warp the domain of the input signal.46

Page 49: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

3. Sample the warped signal at high resolution.4. Post�lter the high resolution signal to produce a lower resolution output signal.The computational advantage of post�ltering is that the post�lter is discrete and space invariant.Post�ltering eliminates aliasing if the sampling frequency meets the Nyquist criterion, butmany continuous signals are not so conveniently band limited. Band unlimited signals are commonin texture mapping. Continuous, synthetic images such as textured, in�nite planes viewed inperspective have unlimited high frequencies near the horizon. Increasing the sampling frequencymay reduce, but will not eliminate, the aliasing in such images.3.5.2 Image Processing ConsiderationsImage processing manipulates two-dimensional signals with spatial coordinates x and y and fre-quency coordinates !x and !y. Most \images" in image processing are intensity images, in whichvalues are proportional to light intensity. These intensity images are always nonnegative since\negative light" does not exist. Filters with negative lobes will occasionally output negative pixelvalues which must be corrected in some way.When displaying a picture antialiased with the linear theory above, it is essential that displayedintensity be proportional to the computed intensity. Most video displays have a nonlinear responseapproximately described by a power law of the form (displayed intensity) = (input) , where 2 < < 3 depending on the monitor. To compensate for this nonlinearity we must perform gammacorrection. The most popular correction method uses pixel values proportional to intensity anda hardware colormap containing the function (monitor input) = C(pixel value)1= [Catmull79].Without gamma correction, e�orts toward antialiasing are hampered.3.5.3 Filter ShapeA general 2-D �lter has an impulse response (or point spread function) of two variables h(x; y).Two common classes of image �lter are those that are separable into a product of 1-D functions:h(x; y) = hx(x)hy(y) or circularly symmetric: h(x; y) = hr(px2 + y2). The Gaussian is unique inthat it is both circularly symmetric and separable: e�r2 = e�x2�y2 = e�x2e�y2 .We describe the shape of 2-D �lters in terms of their pro�le (their cross sectional shape) andtheir regions (the shape of one or more iso-value contours), as shown in �gure 3.13. The ideal lowpass �lter for reconstructing images sampled on a square grid is the 2-D sinc: sinc(x)sinc(y), whosefrequency response is a square box (square region, box pro�le).In algebraic terminology, we call the destination space region corresponding to a source spaceregion the image of the source space region, and the source region corresponding to a destinationregion the preimage of the destination region (�gure 3.14).3.5.4 Resampling Filter ShapeWhen we design a resampling �lter we are free to choose the �lter's region in one space (eithersource space or destination space), but the mapping determines the region in the other space. The47

Page 50: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.13: Pro�le and regions of a 2-D �lter impulse response. (For the elliptical Gaussian �lterpictured, the regions are ellipses and the pro�le is a Gaussian).

Figure 3.14: For non-a�ne mappings, the preimages of circular screen space regions (bottom) arevarying shapes in texture space (top).48

Page 51: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.15: A nonuniform resampling grid and the corresponding space variant �lter regions.Circular regions in screen space (left) map to elliptical regions in texture space (right). Since thetexture regions vary in size, eccentricity, and orientation, the �lter is space variant. Dots markpixel centers.ideal resampling �lter is de�ned by the resampling formula:�(x;k) = Z h(x�m(u)) r(u� k) ���@m@u ��� duThis �lter does ideal reconstruction and pre�ltering, and it is adaptive to the mapping being per-formed. Depending on the mapping, the sampling grid could be nonuniform and the ideal resam-pling �lter could have arbitrary, space variant shape (�gure 3.15). Its pre�lter and reconstruction�lter are 2-D sinc functions, so its support will in general be in�nite (IIR).In practice, resampling �lters are approximations to the ideal, with �nite support and a limitedclass of region shapes. Resampling �lters can be categorized by the approximations they make tothe shape of the reconstruction �lter, pre�lter, and mapping function.For resampling we are most frequently interested in the source regions for square or circulardestination regions. These are the region shapes most common in 2-D �ltering, corresponding toseparable and circularly symmetric �ltering, respectively. Square regions in destination space havea curvilinear quadrilateral preimage in source space for an arbitrary mapping. For projective ora�ne mappings the preimage of a square is a quadrilateral or parallelogram, respectively. Circulardestination regions have an arbitrary preimage for general mappings, but for projective or a�nemappings the preimage is a conic curve or ellipse, respectively. The conic resulting from a projectivemapping will be an ellipse except when the destination circle crosses the \horizon line", the image ofthe line at in�nity, in which case the conic will be a parabola or hyperbola. These correspondences49

Page 52: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.16: Source regions for various destination regions and mapping classes.are summarized in �gure 3.16 and in the table below.Source Regions for Various Destination Regions and Mapping Classes:DESTINATION REGIONMAPPING CLASS square circlegeneral mapping arbitrary arbitraryprojective mapping quadrilateral conic curvea�ne mapping parallelogram ellipse3.5.5 Local A�ne ApproximationTo simplify the resampling formula we substitute for the mappingm its local a�ne approximation.The local a�ne approximation to m(u) in the neighborhood of u0 =m�1(x0) is:mu0(u) = x0 + (u� u0)Ju0where Ju0 = @m@u (u0)is the Jacobian matrix evaluated at u0. The above approximation is most accurate in the neigh-borhood of u0. In the resampling formula for �(x0;k), the pre�lter h(x0 � m(u)) weights the50

Page 53: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

integral most heavily in the neighborhood of u �m�1(x0) = u0, where the approximate mappingis most accurate, so we can use the local a�ne mapping to �nd a approximate resampling �lter.The impulse response of the approximate �lter thus has the form:�u0(x0;k) = Z h(x0 �mu0(u)) r(u� k)jJu0 j duSince mu0 is an a�ne mapping, this integral is a convolution, simplifying evaluation of the resam-pling formula. The resulting �lter is still space variant, however, since the local a�ne approximationand its associated �lter are position-dependent.3.5.6 Magni�cation and Decimation FiltersThe approximations to the reconstruction �lter, pre�lter, and mapping must often be crude for the�lter resulting from the resampling formula to be practical. To simplify the integral, it is commonto assume that either the reconstruction �lter or the pre�lter is an impulse (delta function).We cover several classes of approximate resampling �lters below. First we discuss the specialcases of magni�cation and decimation �lters, which respectively ignore the pre�lter and reconstruc-tion �lter. Then, returning to the general case, we derive a resampling �lter with a Gaussian pro�leand elliptical region.Magni�cation FiltersWhen the mapping magni�es the source image, the size and shape of the ideal resampling �lteris dominated by the reconstruction �lter (�gure 3.17b). If we assume the pre�lter is an impulseh = �, then the magni�cation �lter is:�(x;k) � r(m�1(x)� k)This is an unwarped reconstruction �lter centered on u = m�1(x). Its support is independent ofthe mapping, typically 1-4 pixels. Such �lters are called interpolation �lters in image processing.Common magni�cation �lters are the box (nearest neighbor), bilinear, and cubic b-spline [Hou-Andrews78].Decimation FiltersWhen the mapping shrinks the source image, the size and shape of the ideal resampling �lter isdominated by the warped pre�lter (�gure 3.17c), so if we assume the reconstruction �lter is animpulse r = �, then the decimation �lter is:�(x;k) � ���@m@u ���h(x�m(k))This is a pre�lter centered on u = m�1(x), warped according to the mapping m. Its support insource space is proportional to the reciprocal of the scale factor of the mapping. Since the scalefactors of mappings are unlimited, a decimation �lter could have arbitrary support: one pixel or amillion pixels. 51

Page 54: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.17: The region of an a�ne resampling �lter is the convolution of the regions of its warpedpre�lter h0 and its reconstruction �lter r. When magnifying, the reconstruction �lter dominates,and when decimating, the warped pre�lter dominates. Behavior for non-a�ne mappings is similar.

Figure 3.18: The ideal resampling �lter (left) is always wider than both the warped pre�lter and thereconstruction �lter. If a decimation �lter is used on a mapping that magni�es in some directionthen the �lter can miss all sample points (right).The region of a decimation �lter is completely determined by the destination region of thepre�lter and the mapping class. Pre�lters are usually chosen to have a square or circular destinationregion, in which case the source region will be a parallelogram or ellipse, respectively.Magni�cation/Decimation TransitionsMany �lter implementations for texture mapping and image warping use a combination of magni-�cation and decimation �lters, switching from decimation to magni�cation when the scale of themapping rises above 1. This rule is ambiguous in 2-D, however, where the scale is given not bya scalar, but by a 2 � 2 Jacobian matrix. In 2-D, a mapping could decimate along one axis butmagnify along another. An ad hoc solution to this di�culty is to use a magni�cation �lter whenboth axes are magni�ed, and a decimation �lter otherwise. This is not totally satisfactory, however.If a mapping magni�es along just one axis, then its decimation �lter could become so narrow thatit misses all sample points (�gure 3.18). In this case we can arti�cially fatten the �lter along thatdimension to have support of at least one pixel.52

Page 55: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

As an alternative we can develop uni�ed classes of resampling �lters that make smoother transi-tions from magni�cation to decimation. To do this we cannot assume that either the reconstruction�lter or pre�lter is an impulse. Before we investigate one such uni�ed resampling �lter, based onGaussians, we must �rst lay some groundwork regarding �lter warps.3.5.7 Linear Filter WarpsWhen a 1-D �lter's impulse response is widened by a factor a, its amplitude must be scaled by 1=a topreserve unit area under the �lter. Thus, widening h(x) by factor a yields h(x=a)=a. The analogousrule for broadening a multidimensional �lter by a transformation matrix A is jAj�1h(xA�1).When a �lter's impulse response is widened, its frequency response narrows. For the transformpair h(x) $ H(!), broadening by a gives: h(x=a)=a $ H(a!). To �nd the multidimensionalgeneralization, we simply evaluate a Fourier transform:jAj�1h(xA�1) $ Z +1�1 jAj�1h(xA�1)e�jx!!T dxwhere !! is the frequency vector (!x; !y). Substituting x = yA yieldsjAj�1 Z +1�1 h(y)e�jyA!!T jAj dy = Z +1�1 h(y)e�jy(!!AT )T dyso jAj�1h(xA�1) $ H(!!AT )3.5.8 Elliptical Gaussian FiltersWe can avoid the problematic transitions between decimation and magni�cation �lters if we restrictourselves to pre�lters and reconstruction �lters with elliptical regions and Gaussian pro�le (�gure3.19). Elliptical �lter regions are a natural choice for resampling, since the ideal resampling �ltercan be approximated using a mapping's local a�ne approximation, and ellipses are closed undera�ne mappings. These elliptical Gaussian �lters have a number of useful properties for imageresampling.As discussed in appendix B, the equation Ax2+Bxy+Cy2 = F describes a family of concentricellipses, so we can construct �lters of elliptical region and Gaussian pro�le using an impulse responseof the form: �e�(Ax2+Bxy+Cy2)The derivation is simplest if we de�ne elliptical Gaussians as warps of circular Gaussians. Usingquadratic forms and other matrix notation (summarized in xB.1) simpli�es the algebra considerably.De�nitionA circular Gaussian of unit variance is:gI(u) = 12�e� 12uuT = 12�e� 12 (u2+v2)53

Page 56: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.19: Impulse response of an elliptical Gaussian �lter.where u = (u; v).If we apply a warp x = uM, where M is a 2� 2 matrix, then by the warping law, the warped�lter is: jMj�1gI(xM�1) = 12�jMje� 12xM�1M�1TxT = 12�jMje� 12x(MTM)�1xTWe de�ne the impulse response of the elliptical Gaussian �lter with variance matrix V as:gV(x) = 12�jVj1=2 e� 12xV�1xT = 12�pAC �B2=4 e� 12(x y )8>>>: A B=2B=2 C 9>>>;�18>>>:xy9>>>;where V = 8>>>: A B=2B=2 C 9>>>;Then the warped �lter can be written:jMj�1gI(xM�1) = gMTM(x)Functions of this form arise in statistics, where they are called multivariate Gaussian density func-tions, and are used to model the joint probability distribution of correlated random variables[Rao73].Variance Matrix of an Elliptical GaussianNote that for all elliptical Gaussian �lters constructed this way, V is symmetric and jVj = AC �B2=4 = jMj2 > 0. The converse is true as well: for any nonsingular, symmetric matrix V, thereis an elliptical Gaussian �lter, since any such matrix can be decomposed into the form V =MTM(see xB.7). We call V the variance matrix since it plays a role analogous to the scalar variance ofa 1-D Gaussian. The eigenvalues of V are the variances along the principal axes (major and minoraxes) of the ellipse and the eigenvectors are the principal axes. If jVj were zero or negative thenthe �lter's regions would not be ellipses but parabolas or hyperbolas, respectively.54

Page 57: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Frequency Response of a Circular GaussianThe Fourier transform of a unit variance circular Gaussian �lter is:gI(x) $ GI(!!) = 12� Z +1�1 e� 12xxT e�jx!!T dx= 12� Z +1�1 e� 12 (x+j!!)(x+j!!)T� 12!!!!T dx= e� 12!!!!T2� Z +1�1 e� 12yyT dy where y = x+ j!!but Z +1�1 e� 12yyT dy = Z +1�1 Z +1�1 e� 12 (x2+y2) dx dy = 2�so the Fourier transform of a unit variance circular Gaussian is a scaled unit variance circularGaussian: GI(!!) = e� 12!!!!T = 2�gI(!!)Frequency Response of an Elliptical GaussianWe can �nd the frequency response of an elliptical Gaussian from that of a circular Gaussian usingthe warping properties of the Fourier transform. Since jAj�1h(xA�1)$ H(!!AT ), we have:jMj�1gI(xM�1) $ GI(!!MT ) = e� 12!!MTM!!TIf we de�ne GV(!!) = e� 12!!V!!Tthen the transform pair can be rewritten:gMTM(x) $ GMTM(!!)Summarizing, the frequency response of an elliptical Gaussian with any nonsingular, symmetricvariance matrix V is a scaled elliptical Gaussian with variance matrix V�1:12�jVj1=2 e� 12xV�1xT = gV(x) $ GV(!!) = e� 12!!V!!T = 2�jVj1=2gV�1(!!)Written in scalar notation,12�pAC �B2=4 e� 12 (Cx2�Bxy+Ay2)=(AC�B2=4) $ e� 12 (A!2x+B!x!y+C!2y)ConvolutionElliptical Gaussians are closed under convolution. This is most easily proven in the frequencydomain: gV1(x) �� gV2(x) $ GV1(!!)GV2(!!) = e� 12!!V1!!T e� 12!!V2!!T= e� 12!!(V1+V2)!!T= GV1+V2(!!)55

Page 58: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

so gV1(x) �� gV2(x) = gV1+V2(x)Thus, variances add when elliptical Gaussians are convolved, as in 1-D.Linear WarpsAny linear warp y = xK of an elliptical Gaussian yields another elliptical Gaussian:jKj�1gV(yK�1) = 1jKj2�jVj1=2 e� 12 (yK�1)V�1(yK�1)T= 12�jKT j1=2jVj1=2jKj1=2 e� 12yK�1V�1K�1TyT= 12�jKTVKj1=2 e� 12y(KTVK)�1yT= gKTVK(y)Elliptical Gaussian ResamplingIf we use elliptical Gaussian �lters as the reconstruction �lter and pre�lter, and employ the locala�ne approximation to the mapping, then the resampling �lter will be an elliptical Gaussian. Sinceelliptical Gaussians are closed under convolution and linear warps, the resampling formula is easilyevaluated. For a�ne warps, the resampling �lter is:�(x;k) = �0(m�1(x)� k) where �0 = h0 �� r and h0(u) = jJjh(uJ)In matrix notation, the mapping is x = m(u) = uJ + c. If the reconstruction �lter and pre�lterare elliptical Gaussians r(u) = gVr(u) and h(x) = gVh(x) then the warped pre�lter is an ellipticalGaussian: h0(u) = jJjh(uJ) = jJjgVh(uJ) = gJ�1TVhJ�1(u)as is the entire resampling �lter:�0(u) = (h0 �� r)(u) = gJ�1TVhJ�1(u) �� gVr(u) = gJ�1TVhJ�1+Vr(u)The result is a simple approximation to the ideal resampling �lter. We can easily verify thatthe �lter is shaped appropriately at all scales. The determinant of the transformation matrix Jmeasures the scale of the mapping. When jJj < 1, we are decimating, and jJ�1j is large, so Vh isscaled up to dominate the variance matrix. When jJj > 1, we are magnifying, and jJ�1j is small,so Vh is scaled down, and Vr dominates.This uni�ed scheme for reconstruction and pre�ltering guarantees that the resampling �lter isalways wider than both the reconstruction and pre�lters, so there is no danger that the �lter willfall between samples.To implement elliptical Gaussian �lters in practice, we truncate the Gaussian to give it a �niteimpulse response. Typically, the ideal reconstruction �lter and pre�lter both have identity variance,so Vr = Vh = I, and �0(u) = gJ�1TJ�1+I(u). 56

Page 59: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

In summary, the closure property of ellipses under a�ne warps suggests their appropriate-ness as regions for resampling �lters. Elliptical Gaussian �lters are closed under a�ne warps andconvolution,2 so they form a convenient class of �lters for image resampling. Elliptical Gaussian�lters may be used for non-a�ne warps by using the local a�ne approximation to a mapping asdetermined by the Jacobian at each destination pixel. This is ideal to the extent that the Gaussianis an ideal low pass �lter and the mapping is a�ne.3.5.9 An Implementation of Elliptical Gaussian FiltersWe conclude with an application of resampling �lter theory: an implementation of elliptical Gaus-sian �lters.As mentioned earlier, the preimage through a projective mapping of a circular region in screenspace is (usually) an elliptical region in texture space, and the preimage of a circle through ana�ne mapping is an ellipse. This observation inspired the author to develop the Elliptical WeightedAverage (EWA) Filter in an earlier work [Greene-Heckbert86]. The original derivation of the EWA�lter was based on heuristics, but now, using the theory of resampling �lters, we can justify mostof those choices and improve on others.Elliptical Weighted Average FilterWe will �rst summarize the EWA �lter as it was originally conceived (the following is excerptedwith minor changes from [Greene-Heckbert86]).We assume the texture is being resampled by screen order scanning. At each screen pixel wecompute the Jacobian of the mapping. We think of this Jacobian as two basis vectors in texturespace, with their origin at the preimage of the screen pixel's center. The Jacobian constitutes a locala�ne approximation to the mapping. The shape of the EWA �lter region is then the (arbitrarilyoriented) ellipse de�ned by these two vectors (�gure B.2). The �lter pro�le is stored in a lookuptable for speed, so it could be arbitrary. Since the EWA �lter gives independent control of regionand pro�le, it is an example of �lter design by the transformation method [Dudgeon-Mersereau84].The EWA �lter is a direct convolution method, so its cost is proportional to the area of thetexture region, like other high quality texture �lters [Heckbert86b], but its coe�cient of proportion-ality is lower than most. To speed computation, EWA uses a biquadratic function of the followingform as its radial index: Q(u; v) = Au2 +Buv + Cv2where u = 0; v = 0 are the translated texture coordinates of the center of the ellipse. WhenAC � B2=4 > 0 and A > 0, this function is an elliptical paraboloid, concave upward. By properchoice of the coe�cients A, B, and C, the contours of this function can match any ellipse. Pointsinside the ellipse satisfyQ(u; v) < F for some threshold F , so Q can be used for both ellipse inclusiontesting and �lter table indexing. In texture space, the contours of Q are concentric ellipses (�gure3.20), but when mapped to screen space, they are nearly circular. We can associate with eachelliptical contour the radius r of its corresponding screen space circle. Since Q is quadratic, Q isproportional to r2. It would be most natural to index a �lter pro�le function by r, but this would2Elliptical Gaussian �lters with nonsingular variance matrices form a group under convolution.57

Page 60: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.20: Regions of an elliptical Gaussian (or EWA) �lter are concentric ellipses. Dots aretexture pixel centers. Algorithm scans pixels inside box; only those inside the contour Q = Fcontribute to the weighted average.require the computation of r = pQ at each pixel. To avoid this cost, we pre-warp the �lter lookupfunction f(r) to create a weight lookup table:WTAB[Q] = f(pQ)The pro�le used in the implementation was a Gaussian: f(r) = e��r2 , for whichWTAB[Q] = e��Q.A table length of several thousand was used.

58

Page 61: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

To evaluate Q e�ciently, the method of �nite di�erences is employed. Since Q is quadratic,two additions su�ce to update Q for each pixel. The following pseudocode implements the EWA�lter for monochrome pictures; it is easily modi�ed for color. Integer variables are in lower caseand oating point variables are in upper case.Let texture[u,v] be a 2-dimensional array holding texture image< Compute texture space ellipse center (U0,V0) from screen coordinates (x; y) >< Compute (Ux,Vx) = (ux; vx) and (Uy,Vy) = (uy; vy) >Now �nd ellipse coe�cients: (see appendix B)A = Vx*Vx+Vy*VyB = -2*(Ux*Vx+Uy*Vy)C = Ux*Ux+Uy*UyF = (Ux*Vy-Uy*Vx)^2< scale A, B, C, and F equally so that F = WTAB length >Ellipse is AU2+BUV +CV 2 = F , where U = u�U0, V = v�V 0EWA(U0,V0,A,B,C,F)begin< Find bounding box around ellipse: u1 � u � u2, v1 � v � v2 >NUM = 0DEN = 0DDQ = 2*AU = u1-U0for v=v1 to v2 do begin scan the boxV = v-V0DQ = A*(2*U+1)+B*V Q(U+1; V )�Q(U; V )Q = (C*V+B*U)*V+A*U*Ufor u=u1 to u2 do beginif Q<F then begin ignore pixel if Q out of rangeWEIGHT = WTAB[floor(Q)]NUM = NUM+WEIGHT*texture[u,v] read and weight texture pixelDEN = DEN+WEIGHT denominator (for normalization)endQ = Q+DQDQ = DQ+DDQendendif DEN=0 then return bilinearfilt(U0,V0) if ellipse fell between pixelsreturn NUM/DENendThe above code requires 1 oating point multiply, 4 oating point adds, 1 integerization, and1 table lookup per texture pixel. This implementation can be optimized further by removingredundant calculations from the v loop and, with proper checking, by using integer arithmeticthroughout. 59

Page 62: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Higher Quality Elliptical Weighted AverageIn retrospect, we recognize that an EWA �lter with Gaussian pro�le is an elliptical Gaussianresampling �lter. The coe�cients A, B, and C computed in the pseudocode above form a conicmatrix Q (xB.1) whose inverse is the variance matrix of the elliptical Gaussian:V = Q�1 = 8>>>: A B=2B=2 C 9>>>;�1 = J�1TJ�1 where J�1 = 8>>>:ux vxuy vy 9>>>;Since there is no term for reconstruction, the old EWA is a decimation �lter. In e�ect, the re-construction �lter is an impulse, and the pre�lter a Gaussian. One would expect such a �lter tooccasionally \fall between the pixels" for scale factors of 1 or greater, and this indeed happens.With the resampling theory presented here, we can correct this aw. The change is trivial: insteadof V = J�1TJ�1, we use V = J�1TJ�1 + I. With this change in ellipse shape, the new EWA�lter is a uni�ed resampling �lter that is, in e�ect, using Gaussians for both reconstruction andpre�ltering. The necessary modi�cations to the preceding pseudocode are as follows:A = Vx*Vx+Vy*Vy+1B = -2*(Ux*Vx+Uy*Vy)C = Ux*Ux+Uy*Uy+1F = A*C-B*B/4Optimized Elliptical Weighted AverageDepending on the mapping, some screen pixels can map to immense texture regions requiringexcessive computation time with the algorithm above. In such cases it is of great bene�t to useEWA on an image pyramid [Heckbert86b]. An image pyramid (�gure 3.21) is a sequence of imagesf0(x; y) : : : fK(x; y) whose base level image f0 is the original texture image of resolution M � Npixels, and each pyramid level fk is made by decimating the level below, fk�1, by a factor of two[Williams83], [Rosenfeld84]. The resolution of image fk is thus M=2k � N=2k, and there will beK = log2(min(M;N)) + 1 pyramid levels. To �lter a circle of diameter d using an image pyramidwe choose a level in which the circle is small (but not so small that accuracy is lost). A reasonablecriterion is to choose the pyramid level in which the diameter is at least 3 and less than 6 pixels.Using a pyramid �ltering in level k is thus 4k times faster than �ltering in level 0 (�ltering withouta pyramid). Using the level selection rule above, we can �lter any circle with a minimum of 9 anda maximum of 25 pixel accesses, independent of the size of the circle in the original texture image.Filtering elliptical regions isn't as simple as �ltering circular regions. An in�nite checkered planein perspective (�gure 3.2) is a particularly di�cult test scene, since the image contains unlimitedhigh frequencies at many orientations. Pixels near the horizon map to very eccentric ellipses, someof which are 5 pixels wide and 5000 pixels long in images of this sort. We de�ne eccentricity tobe e = (major axis)=(minor axis). If the pyramid level selection rule chooses the level in whichthe minor axis (the smallest diameter) of the ellipse is between 3 and 6 pixels, then an ellipsewith eccentricity e will lie in a rectangle of area at least 9e. Since eccentricities are unbounded forarbitrary mappings, this area is unbounded, so the cost of EWA �ltering of ellipses is unbounded.For large eccentricities (say > 50) the algorithm will run very slowly. Note that it is unacceptable60

Page 63: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.21: 3-D image pyramid.

Figure 3.22: 4-D image pyramid.61

Page 64: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

to choose the pyramid level based on the major axis of the ellipse, since this could scale down theellipse so much that the minor axis of the ellipse becomes less than one pixel, producing inaccurateresults.One approach to speed �ltering of eccentric texture regions is the expansion of the imagepyramid to contain a greater variety of pre-warped images. A standard (3-D) image pyramid canbe generalized to 4-D by scaling an image di�erentially in x and y, as shown in �gure 3.22. While a3-D image pyramid �lters using square regions, a 4-D pyramid �lters using axis-aligned rectangles.A 3-D pyramid is indexed by three parameters: x, y, and scale, while a 4-D pyramid is indexedby four: x, y, xscale, and yscale. One can e�ciently �lter an axis-aligned rectangle with a 4-D pyramid, but for arbitrarily oriented ellipses the same problems remain as for a 3-D pyramid.Arbitrarily oriented ellipses could be �ltered e�ciently if the pyramid were expanded even further,yielding a 5-D angled pyramid, which contains an image �ltered with both di�erential scaling androtation. Angled pyramids are indexed by the �ve parameters of an ellipse: x, y, major radiusa, minor radius b, and angle � (�gure B.1). Experimentation with nonstandard pyramids is anarea of active research [Heckbert86b]; it is not yet known if their time bene�ts relative to standardpyramids compensate for their increased storage costs.Even if we restrict ourselves to standard pyramids, other optimizations are possible for speedingthe �ltering of eccentric ellipses. If we are willing to sacri�ce quality then we can simply clampthe eccentricities to some limit emax. Ellipses can be rounded by either fattening, shortening, orboth. Fattening the ellipse (increasing its minor axis) will cause lateral blurring, and shorteningthe ellipse (decreasing its major axis) will cause longitudinal aliasing. It is probably best to optfor blurring. Tests show that a threshold of emax = 20 or 30 produces very good results. Notethat clamping the eccentricity of the EWA �lter bounds the computation required for one �lteringoperation, thereby making EWA a constant cost �lter. Figure 3.23 contrasts the results for twoeccentricity thresholds.Eccentricity clamping is achieved in the implementation as follows. From the variance matrixcontaining the coe�cients A, B, C of the ellipse's implicit equation we can �nd the major andminor radii, a and b, of the ellipse. If the eccentricity e = a=b exceeds a threshold eccentricity emaxthen we fatten the ellipse by modifying its minor radius: b0 = a=emax, and compute a new variancematrix. Equations for converting the implicit formula for an ellipse into its radii and angle, andvice versa, are given in xB.3 and xB.4.3.6 Future WorkThere are a number of areas for future research. As mentioned, antialiasing pre�lters are usu-ally implemented using FIR designs. Perhaps IIR �lters would make more e�cient pre�lters andresampling �lters.We have seen how the theory of resampling �lters can aid the development of high quality,e�cient, space variant �lters for texture mapping and image warping. The theory can hopefullyhelp us design even higher quality, more e�cient �lters in the future. We have pursued the ellip-tical Gaussian here because its closure properties make it an elegant resampling �lter. There are,however, a number of 1-D �lters of higher quality than the Gaussian [Hamming83], [Turkowski88].We would like to �nd less drastic measures than eccentricity clamping to bound the expense offuture resampling �lters. Highly nonlinear mappings can lead to concave �lter regions [Fournier-62

Page 65: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure 3.23: Top: EWA �lter with eccentricity clamped to 1 (a circular �lter). Note lateral blurringalong vertical edges. Bottom: EWA �lter with eccentricity clamped to 16 or less. Note improvedresolution of diagonal frequencies (horizon at right).63

Page 66: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Fiume88], which would be poorly �ltered using a local a�ne approximation, so we should also �ndrules to determine when the local a�ne approximation is acceptable, and when it is not.

64

Page 67: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

ConclusionsWe have seen that the fundamentals of texture mapping and image warping have much in common.Both applications require (1) the description of a mapping between a source image and a destinationimage, and (2) resampling of the source image to create the destination image according to amapping function. The �rst task is a geometric modeling problem, and the latter is a renderingand image processing problem.We have demonstrated the desirability of certain properties in a mapping: preservation ofparallel lines, straight lines, and equispaced points, and closure under composition and inversion.We have found that a�ne mappings, while being the least general of the mapping classes considered,enjoy all of these properties, while projective mappings have more generality and yet retain mostof these properties. Projective mappings are needed for texture mapping if a perspective cameratransformation is used. We have shown that projective warps can be performed very e�cientlyusing rational linear interpolation.To improve the quality of rendering for texture mapping and image warping, we have developeda new theory of ideal image resampling. This theory describes the �lter shape needed for perfectantialiasing during the resampling implied by an arbitrary mapping. We have explored one class of�lter that conforms nicely to this theory, the elliptical Gaussian, but there are undoubtedly others.In addition to assisting the design of higher quality, more e�cient �lters, this theory should providea standard against which existing �lter schemes can be compared.

65

Page 68: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Appendix ASource Code for Mapping InferenceSource code to infer projective mappings from a four point 2-D correspondence, and to infer a�nemappings from a three point 3-D correspondence, is given below in the C programming language.A.1 Basic Data Structures and RoutinesBelow are listed the polygon and vertex data types, and some generic routines for manipulating3� 3 matrices.A.1.1 poly.h#define POLY_NMAX 8 /* max #sides to a polygon */typedef struct { /* A POLYGON VERTEX */double u, v; /* texture space coords */double sx, sy; /* screen space coords */double x, y, z; /* object space coords */} poly_vert;typedef struct { /* A POLYGON */int n; /* number of sides */poly_vert vert[POLY_NMAX]; /* vertices */} poly;A.1.2 pmap.h/* pmap return codes */#define PMAP_BAD -1 /* mapping doesn't exist (bad correspondence) */#define PMAP_AFFINE 0 /* mapping is affine */#define PMAP_PROJECTIVE 1 /* mapping is projective */

66

Page 69: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

A.1.3 mx3.hdouble mx3d_adjoint();/* |a b|* |c d|*/#define DET2(a,b, c,d) ((a)*(d) - (b)*(c))A.1.4 mx3.c/** mx3.c: routines for manipulating 3x3 matrices* These matrices are commonly used to represent a 2-D projective mapping.*/#include <math.h>#include "mx3.h"/* mx3_adjoint: b = adjoint(a), returns determinant(a) */double mx3d_adjoint(a, b)double a[3][3], b[3][3];{ b[0][0] = DET2(a[1][1], a[1][2], a[2][1], a[2][2]);b[1][0] = DET2(a[1][2], a[1][0], a[2][2], a[2][0]);b[2][0] = DET2(a[1][0], a[1][1], a[2][0], a[2][1]);b[0][1] = DET2(a[2][1], a[2][2], a[0][1], a[0][2]);b[1][1] = DET2(a[2][2], a[2][0], a[0][2], a[0][0]);b[2][1] = DET2(a[2][0], a[2][1], a[0][0], a[0][1]);b[0][2] = DET2(a[0][1], a[0][2], a[1][1], a[1][2]);b[1][2] = DET2(a[0][2], a[0][0], a[1][2], a[1][0]);b[2][2] = DET2(a[0][0], a[0][1], a[1][0], a[1][1]);return a[0][0]*b[0][0] + a[0][1]*b[0][1] + a[0][2]*b[0][2];}/* mx3_mul: matrix multiply: c = a*b */mx3d_mul(a, b, c)double a[3][3], b[3][3], c[3][3];{ c[0][0] = a[0][0]*b[0][0] + a[0][1]*b[1][0] + a[0][2]*b[2][0];c[0][1] = a[0][0]*b[0][1] + a[0][1]*b[1][1] + a[0][2]*b[2][1];c[0][2] = a[0][0]*b[0][2] + a[0][1]*b[1][2] + a[0][2]*b[2][2];c[1][0] = a[1][0]*b[0][0] + a[1][1]*b[1][0] + a[1][2]*b[2][0];c[1][1] = a[1][0]*b[0][1] + a[1][1]*b[1][1] + a[1][2]*b[2][1];c[1][2] = a[1][0]*b[0][2] + a[1][1]*b[1][2] + a[1][2]*b[2][2];c[2][0] = a[2][0]*b[0][0] + a[2][1]*b[1][0] + a[2][2]*b[2][0];c[2][1] = a[2][0]*b[0][1] + a[2][1]*b[1][1] + a[2][2]*b[2][1];c[2][2] = a[2][0]*b[0][2] + a[2][1]*b[1][2] + a[2][2]*b[2][2];} 67

Page 70: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

/* mx3d_transform: transform point p by matrix a: q = p*a */mx3d_transform(p, a, q)double p[3], q[3];double a[3][3];{ q[0] = p[0]*a[0][0] + p[1]*a[1][0] + p[2]*a[2][0];q[1] = p[0]*a[0][1] + p[1]*a[1][1] + p[2]*a[2][1];q[2] = p[0]*a[0][2] + p[1]*a[1][2] + p[2]*a[2][2];}A.2 Inferring Projective Mappings from 2-D QuadrilateralsIn texture mapping applications when the camera transformation (object space to screen spacetransform OS) is not known, or in image warping applications with no intermediate 3-D objectspace, a projective warp can be inferred from the screen and texture coordinates of the four verticesof a quadrilateral (x2.2.3). (We use the terms \screen space" and \texture space" here, but thiscode applies to general 2-D quadrilateral mappings.)Below is a table listing computational cost of the critical subroutines, measured by the countsof divides, multiplies, and adds. OPERATION ) / � ++ SUBROUTINEpmap quad quad (double projective case) 4 65 69pmap square quad (a�ne case) 0 0 10pmap square quad (projective case) 2 10 21mx3 adjoint 0 18 9mx3 mul 0 27 18Following is a routine pmap poly to �nd the projective mapping from a four point correspon-dence.A.2.1 pmap poly.c#include "poly.h"#include "pmap.h"#include "mx3.h"#define X(i) p->vert[i].sx /* screen coordinates */#define Y(i) p->vert[i].sy#define U(i) p->vert[i].u /* texture coordinates */#define V(i) p->vert[i].v/** pmap_poly: find the projective mapping ST from screen to texture space68

Page 71: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

* given the screen and texture coordinates at the vertices of a polygon,* which are passed in the fields (sx,sy) and (u,v) of p->vert[i], respectively.*/pmap_poly(p, ST)poly *p;double ST[3][3];{ double scr[4][2]; /* vertices of screen quadrilateral */if (p->n!=4)ERROR("only do quadrilaterals at the moment\n");/* if edges 0-1 and 2-3 are horz, 1-2 and 3-0 are vert */if (V(0)==V(1) && V(2)==V(3) && U(1)==U(2) && U(3)==U(0)) {scr[0][0] = X(0); scr[0][1] = Y(0);scr[1][0] = X(1); scr[1][1] = Y(1);scr[2][0] = X(2); scr[2][1] = Y(2);scr[3][0] = X(3); scr[3][1] = Y(3);return pmap_quad_rect(U(0), V(0), U(2), V(2), scr, ST);}/* if edges 0-1 and 2-3 are vert, 1-2 and 3-0 are horz */else if (U(0)==U(1) && U(2)==U(3) && V(1)==V(2) && V(3)==V(0)) {scr[0][0] = X(1); scr[0][1] = Y(1);scr[1][0] = X(2); scr[1][1] = Y(2);scr[2][0] = X(3); scr[2][1] = Y(3);scr[3][0] = X(0); scr[3][1] = Y(0);return pmap_quad_rect(U(1), V(1), U(3), V(3), scr, ST);}/* if texture is not an orthogonally-oriented rectangle */else return pmap_quad_quad(p, ST);}/** pmap_quad_quad: find the projective mapping ST from screen to texture space* given the screen and texture coordinates at the vertices of a quadrilateral.** Method: concatenate screen_quad->mid_square and* mid_square->texture_quad transform matrices.* The alternate method, solving an 8x8 system of equations, takes longer.*/pmap_quad_quad(p, ST)poly *p;double ST[3][3];{ int type1, type2;double quad[4][2], MS[3][3];double SM[3][3], MT[3][3]; /* screen->mid and mid->texture */quad[0][0] = X(0); quad[0][1] = Y(0);quad[1][0] = X(1); quad[1][1] = Y(1);69

Page 72: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

quad[2][0] = X(2); quad[2][1] = Y(2);quad[3][0] = X(3); quad[3][1] = Y(3);type1 = pmap_square_quad(quad, MS);if (mx3d_adjoint(MS, SM) == 0.)ERROR("pmap_quad_quad: warning: determinant=0\n");quad[0][0] = U(0); quad[0][1] = V(0);quad[1][0] = U(1); quad[1][1] = V(1);quad[2][0] = U(2); quad[2][1] = V(2);quad[3][0] = U(3); quad[3][1] = V(3);type2 = pmap_square_quad(quad, MT);if (type1==PMAP_BAD || type2==PMAP_BAD) return PMAP_BAD;mx3d_mul(SM, MT, ST);return type1|type2; /* PMAP_PROJECTIVE prevails */}A.2.2 pmap gen.c/** pmap_gen.c: general routines for 2-D projective mappings.* These routines are independent of the poly structure,* so we do not think in terms of texture and screen space.*/#include <stdio.h>#include "pmap.h"#include "mx3.h"#define TOLERANCE 1e-13#define ZERO(x) ((x)<TOLERANCE && (x)>-TOLERANCE)#define X(i) quad[i][0] /* quadrilateral x and y */#define Y(i) quad[i][1]/** pmap_quad_rect: find mapping between quadrilateral and rectangle.* The correspondence is:** quad[0] --> (u0,v0)* quad[1] --> (u1,v0)* quad[2] --> (u1,v1)* quad[3] --> (u0,v1)** This method of computing the adjoint numerically is cheaper than* computing it symbolically.*/pmap_quad_rect(u0, v0, u1, v1, quad, QR)double u0, v0, u1, v1; /* bounds of rectangle */double quad[4][2]; /* vertices of quadrilateral */70

Page 73: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

double QR[3][3]; /* quad->rect transform (returned) */{ int ret;double du, dv;double RQ[3][3]; /* rect->quad transform */du = u1-u0;dv = v1-v0;if (du==0. || dv==0.) {ERROR("pmap_quad_rect: null rectangle\n");return PMAP_BAD;}/* first find mapping from unit uv square to xy quadrilateral */ret = pmap_square_quad(quad, RQ);if (ret==PMAP_BAD) return PMAP_BAD;/* concatenate transform from uv rectangle (u0,v0,u1,v1) to unit square */RQ[0][0] /= du;RQ[1][0] /= dv;RQ[2][0] -= RQ[0][0]*u0 + RQ[1][0]*v0;RQ[0][1] /= du;RQ[1][1] /= dv;RQ[2][1] -= RQ[0][1]*u0 + RQ[1][1]*v0;RQ[0][2] /= du;RQ[1][2] /= dv;RQ[2][2] -= RQ[0][2]*u0 + RQ[1][2]*v0;/* now RQ is transform from uv rectangle to xy quadrilateral *//* QR = inverse transform, which maps xy to uv */if (mx3d_adjoint(RQ, QR)==0.)ERROR("pmap_quad_rect: warning: determinant=0\n");return ret;}/** pmap_square_quad: find mapping between unit square and quadrilateral.* The correspondence is:** (0,0) --> quad[0]* (1,0) --> quad[1]* (1,1) --> quad[2]* (0,1) --> quad[3]*/pmap_square_quad(quad, SQ)double quad[4][2]; /* vertices of quadrilateral */double SQ[3][3]; /* square->quad transform */{ double px, py;px = X(0)-X(1)+X(2)-X(3);py = Y(0)-Y(1)+Y(2)-Y(3); 71

Page 74: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

if (ZERO(px) && ZERO(py)) { /* affine */SQ[0][0] = X(1)-X(0);SQ[1][0] = X(2)-X(1);SQ[2][0] = X(0);SQ[0][1] = Y(1)-Y(0);SQ[1][1] = Y(2)-Y(1);SQ[2][1] = Y(0);SQ[0][2] = 0.;SQ[1][2] = 0.;SQ[2][2] = 1.;return PMAP_AFFINE;}else { /* projective */double dx1, dx2, dy1, dy2, del;dx1 = X(1)-X(2);dx2 = X(3)-X(2);dy1 = Y(1)-Y(2);dy2 = Y(3)-Y(2);del = DET2(dx1,dx2, dy1,dy2);if (del==0.) {ERROR("pmap_square_quad: bad mapping\n");return PMAP_BAD;}SQ[0][2] = DET2(px,dx2, py,dy2)/del;SQ[1][2] = DET2(dx1,px, dy1,py)/del;SQ[2][2] = 1.;SQ[0][0] = X(1)-X(0)+SQ[0][2]*X(1);SQ[1][0] = X(3)-X(0)+SQ[1][2]*X(3);SQ[2][0] = X(0);SQ[0][1] = Y(1)-Y(0)+SQ[0][2]*Y(1);SQ[1][1] = Y(3)-Y(0)+SQ[1][2]*Y(3);SQ[2][1] = Y(0);return PMAP_PROJECTIVE;}}A.2.3 mapping example.c/* example use of pmap_poly to infer projective mapping from a quadrilateral */#include "poly.h"#define SIZE 50main(){ static poly p = {4,/* u v sx sy */{0, 0, 0, 0}, /* vert[0] */{1, 0, 40, 0}, /* vert[1] */{1, 1, 30, 30}, /* vert[2] */{0, 1, 10, 20} /* vert[3] */ 72

Page 75: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

};double ST[3][3];double scr[3], tex[3];int x, y;/* compute screen to texture transform ST */pmap_poly(&p, ST);/* scan a square area of screen space, transforming to texture space */for (y=0; y<SIZE; y++)for (x=0; x<SIZE; x++) {scr[0] = x;scr[1] = y;scr[2] = 1.;mx3d_transform(scr, ST, tex);tex[0] /= tex[2];tex[1] /= tex[2];printf("scr(%d,%d) transforms to tex(%g,%g)\n",x, y, tex[0], tex[1]);}}A.3 Inferring A�ne Parameterizations from 3-D PolygonsFollowing is a routine pmap param that computes the 3 � 4 texture space to object space trans-formation matrix (TO) using the texture space and object space correspondence at three selectedvertices of a polygon. When concatenated with the 4� 3 object space to screen space matrix OS,the 3 � 3 texture to screen transform TS results. The adjoint of this matrix gives the screen totexture transform ST.A 3 � 4 homogeneous matrix form for a�ne parameterizations is used rather than the 3 � 3form discussed in section x2.3.1 for greater compatibility with the 4� 4 matrices used elsewhere ina typical 3-D modeling system. This matrix TO transforms from homogeneous 2-D texture pointsto homogeneous 3-D object space points:(x0 y0 z0 w ) = ( u v 1 )8>>>>>>: a d g 0b e h 0c f i l 9>>>>>>;A.3.1 pmap param.c#include <math.h>#include "mx3.h"#include "poly.h"#define MINDEL 1e-7/** pmap_param: find 3x4 affine parameterization that maps texture space* to object space. The texture and object space coordinates of each* vertex are passed in the fields (u,v) and (x,y,z) of g->vert[i], resp.73

Page 76: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

*/pmap_param(g, TO)poly *g;double TO[3][4]; /* texture to object transform */{ int i;double del, pu, pv, qu, qv, p, q, am, bm, cm;poly_vert *a, *b, *c;/* find three consecutive vertices with noncollinear texture coords */a = &g->vert[g->n-2];b = &g->vert[g->n-1];c = &g->vert[0];pu = b->u-a->u; pv = b->v-a->v;for (i=0; i<g->n; i++, a++, b++, c++, pu=qu, pv=qv) {qu = c->u-b->u; qv = c->v-b->v;del = pu*qv-pv*qu;if (fabs(del)>MINDEL) break;}if (i>=g->n)ERROR("degenerate polygon");/** compute texture to object transform from those three vertices.* (note that the correspondences at other vertices are ignored;* they are assumed to obey the same affine mapping)*/am = DET2(b->u, c->u, b->v, c->v);bm = DET2(c->u, a->u, c->v, a->v);cm = DET2(a->u, b->u, a->v, b->v);p = b->x-a->x;q = c->x-b->x;TO[0][0] = DET2(p , q , pv, qv);TO[1][0] = DET2(pu, qu, p , q );TO[2][0] = a->x*am+b->x*bm+c->x*cm;p = b->y-a->y;q = c->y-b->y;TO[0][1] = DET2(p , q , pv, qv);TO[1][1] = DET2(pu, qu, p , q );TO[2][1] = a->y*am+b->y*bm+c->y*cm;p = b->z-a->z;q = c->z-b->z;TO[0][2] = DET2(p , q , pv, qv);TO[1][2] = DET2(pu, qu, p , q );TO[2][2] = a->z*am+b->z*bm+c->z*cm;TO[0][3] = 0.;TO[1][3] = 0.;TO[2][3] = del;}74

Page 77: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

A.3.2 param example.c/* example use of pmap_param to compute parameterization of a polygon */#include "poly.h"main(){ static poly p = {4,/* u v sx sy x y z */{0, 0, 0, 0, 4, 2, 6}, /* vert[0] */{1, 0, 40, 0, 5, 3, 8}, /* vert[1] */{1, 1, 30, 30, 5, 7,12}, /* vert[2] */{0, 1, 10, 20, 4, 6,10} /* vert[3] *//** note: sx and sy are ignored,* This test polygon is a square in texture space (u,v)* and a planar parallelogram in object space (x,y,z)*/};double TO[3][4];double obj[4], u, v;int i;/* compute texture to object transform TO */pmap_param(&p, TO);for (i=0; i<p.n; i++) {u = p.vert[i].u;v = p.vert[i].v;obj[0] = u*TO[0][0] + v*TO[1][0] + TO[2][0];obj[1] = u*TO[0][1] + v*TO[1][1] + TO[2][1];obj[2] = u*TO[0][2] + v*TO[1][2] + TO[2][2];obj[3] = u*TO[0][3] + v*TO[1][3] + TO[2][3];obj[0] /= obj[3];obj[1] /= obj[3];obj[2] /= obj[3];printf("tex(%g,%g) transforms to obj(%g,%g,%g)\n",u, v, obj[0], obj[1], obj[2]);}}

75

Page 78: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Appendix BEllipsesHere we summarize the analytic geometry of ellipses. Ellipses can be described in both implicitand parametric forms. The ellipse is one class of conic curve, so most of the general formulas forellipses apply to other conics (hyperbolas and parabolas) as well.B.1 Implicit EllipseThe implicit equation for a conic is a second order polynomial in two variables:Ax2 +Bxy + Cy2 +Dx+Ey � F = 0Since this equation has six coe�cients, any nonzero scalar multiple of which is equivalent, a conichas �ve degrees of freedom. We can assume without loss of generality that A � 0. Conics can beclassi�ed according to the sign of the discriminant � = AC � B2=4. The conic is an ellipse when� > 0, a parabola if � = 0, and a hyperbola if � < 0.We will deal exclusively with ellipses (conics) centered on the origin, in which case D = E = 0,and we have the canonical conic: Ax2 +Bxy + Cy2 = FA formula that is quadratic in every term in this manner is known as a quadratic form. This conicequation can be written in matrix form to facilitate transformations [Roberts66]:pQpT = F( x y )8>>>: A B=2B=2 C 9>>>;8>>>:xy9>>>; = Fwhere Q is the conic matrix. A conic centered on the origin is uniquely speci�ed to within a scalefactor by any 2 � 2 symmetric matrix Q and a scalar F . Conics centered on the origin thus havethree degrees of freedom. The conic is an ellipse i� both eigenvalues of this matrix are positive (thematrix is positive de�nite).

76

Page 79: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure B.1: Ellipse parameterized by major radius a, minor radius b, and angle �.B.2 Transforming an Implicit EllipseGiven a linear transformation: p = p0M= (x y ) = (x0 y0 )8>>>:m00 m01m10 m119>>>;we can transform the conic A0x02 + B0x0y0 + C 0y02 = F 0. The coe�cients of the new conic Ax2 +Bxy +Cy2 = F are found by substituting p0 = pM�1 into the conic equation:p0Q0p0T = F 0 where Q0 = 8>>>: A0 B0=2B0=2 C 0 9>>>;pM�1Q0M�1TpT = F 0pQpT = F = F 0where the matrix of the transformed conic is:Q =M�1Q0M�1TB.3 Ellipse Analysis by RotationAn ellipse is most intuitively parameterized by its major radius a, minor radius b, and angle �(�gure B.1). An orthogonal ellipse (with � = 0) satis�es the familiar equation (x=a)2 + (y=b)2 = 1,which is an implicit conic equation with no cross term: A0 = 1=a2, B0 = 0, C 0 = 1=b2, F 0 = 1.We can determine the ellipse parameters a, b, and � by rotating an arbitrary ellipse until the crossterm vanishes. 77

Page 80: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Starting with the orthogonal ellipse p0Q0p0T = F 0 with conic matrixQ0 = 8>>>:A0 00 C 09>>>;and transforming it by a rotation M = 8>>>: cos � sin �� sin � cos �9>>>;we get the rotated ellipse pQpT = F whereQ =M�1Q0M�1T= 8>>>: A B=2B=2 C 9>>>; = 8>>>: cos � � sin �sin � cos � 9>>>;8>>>:A0 00 C 09>>>;8>>>: cos � sin �� sin � cos �9>>>;= 8>>>:A0 cos2 � + C 0 sin2 � (A0 �C 0) sin � cos �(A0 � C 0) sin � cos � A0 sin2 � + C 0 cos2 �9>>>;The rotated ellipse thus has coe�cients:A = A0 cos2 � + C 0 sin2 �B = (A0 � C 0) sin 2�C = A0 sin2 � + C 0 cos2 �F = F 0Note that rotation leaves the trace of the matrix (the sum of the diagonal elements) and thediscriminant (the matrix determinant) unchanged:trace = A+ C = A0 + C 0discriminant = AC �B2=4 = A0C 0 �B02=4 = A0C 0We can invert the equations above to �nd the orthogonal ellipse in terms of the rotated ellipse:A� C = (A0 � C 0)(cos2 � � sin2 �) = (A0 � C 0) cos 2�so BA� C = tan 2�and � = 12 tan�1� BA� C �Substituting one invariant, C 0 = A+C �A0 into the other, we get a quadratic equation in A0:A02 � (A+ C)A0 + (AC �B2=4) = 0so the coe�cients of the orthogonal ellipse are:A0; C 0 = A+ C �p(A� C)2 +B2278

Page 81: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

There are two solutions since a rotation of 90 degrees leaves the ellipse orthogonal but swaps A0and C 0. These two values are the eigenvalues of the conic matrices Q and Q0. The orthogonalellipse can be rewritten (A0=F )x2 + (C 0=F )y2 = 1 so the major and minor radii are:a = s FA0 b = s FC 0where A0 and C 0 are chosen such that A0 � C 0 and a � b. Note that these formulas allow the radiiof an ellipse to be determined from its implicit coe�cients without trigonometry.B.4 Ellipse Synthesis by Transforming a CircleAn arbitrary ellipse can be created by scaling and rotating a circle. Starting with the implicitequation for a circle with conic matrix Q0 = 8>>>: 1 00 19>>>;and F 0 = 1, we scale the circle di�erentially to have radii a and b and rotate it to have angle �using the transformation matrix:M = 8>>>: a 00 b9>>>;8>>>: cos � sin �� sin � cos �9>>>; = 8>>>: a cos � a sin ��b sin � b cos �9>>>;The resulting ellipse has conic matrix: Q =M�1Q0M�1T= 8>>>: A B=2B=2 C 9>>>; = 1ab 8>>>: b cos � �a sin �b sin � a cos � 9>>>;8>>>: 1 00 19>>>;8>>>: b cos � b sin ��a sin � a cos �9>>>; 1ab= 1a2b2 8>>>: b2 cos2 � + a2 sin2 � (b2 � a2) cos � sin �(b2 � a2) cos � sin � a2 cos2 � + b2 sin2 �9>>>;The ellipse thus has coe�cients: A = a2 cos2 � + b2 sin2 �B = (b2 � a2) sin 2�C = a2 sin2 � + b2 cos2 �F = a2b2B.5 Parametric EllipseThere are many parameterizations of an ellipse, but the following trigonometric one seems to bethe most natural.A parametric equation for a unit circle is:p(t) = (x(t) y(t) ) = ( cos t sin t )79

Page 82: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

Figure B.2: Ellipse shape is determined by two basis vectors (ux; vx) and (uy; vy) which form rowsof the Jacobian for the mapping from (x; y) space to (u; v) space. The basis for a given ellipse is notunique; pictured here are three bases of di�erent phase for the same ellipse. Center parameterizationis canonical because its basis vectors are orthogonal.When transformed by a scale and rotation we get the parametric ellipse:p0 = pMsMr = ( cos t sin t )8>>>: a 00 b9>>>;8>>>: cos � sin �� sin � cos �9>>>;= ( a cos � cos t� b sin � sin t; a sin � cos t+ b cos � sin t )B.6 Converting Parametric to ImplicitGiven a parametric circle in one coordinate system, p = (x; y) = (cos t; sin t), and a linear trans-formation to another coordinate system p0 = pM= ( u v ) = ( cos t sin t )8>>>:ux vxuy vy 9>>>;the circle transforms to an ellipse in the second coordinate system. The ellipse is centered on (0,0)and passes through the points (ux; vx) and (uy; vy) at parameter values t with a 90 degree phasedi�erence (�gure B.2). The matrix M is the Jacobian of the mapping from (x; y) space to (u; v)space.The implicit equation for this ellipse can be found by substituting p = p0M�1 into the identityppT = cos2 t+ sin2 t = 1: p0M�1M�1Tp0T = 1p0Qp0T = 1whereQ =M�1M�1T = 8>>>: vy �vx�uy ux 9>>>;8>>>: vy �uy�vx ux 9>>>;(uxvy � uyvx)2 = 8>>>: v2x + v2y �uxvx � uyvy�uxvx � uyvy u2x + u2y 9>>>;(uxvy � uyvx)280

Page 83: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

So the ellipse has implicit coe�cients: A = v2x + v2yB = �2(uxvx + uyvy)C = u2x + u2yF = (uxvy � uyvx)2B.7 Converting Implicit to ParametricThe trigonometric parameterization for an ellipse has four degrees of freedom, but the implicit formhas only three. The extra degree of freedom in the parametric form results from the arbitrary phaseof the basis vectors of the ellipse (�gure B.2); there is a one-dimensional space of basis vector pairsfor a given ellipse. To eliminate this ambiguity we choose as a canonical basis the major and minoraxes of the ellipse, which are always perpendicular. Such a basis, and such a parameterization, areunique within permutations and sign changes of the basis vectors.The basis vectors of the ellipse are the rows of the Jacobian M:M = 8>>>:ux vxuy vy 9>>>;The Jacobian is related to the implicit conic matrix byQ =M�1M�1TThis conic matrix is closely related to the �rst fundamental matrix of a surface in di�erentialgeometry [Faux-Pratt79]. We wish to solve the above equation forM under the constraint that thebasis is orthogonal, i.e. M�1TM�1 is diagonal. If its rows are orthogonal, then M can be writtenin the form M = �R = 8>>>: a 00 b9>>>;8>>>: cos � sin �� sin � cos �9>>>;so the conic matrix is Q =M�1M�1T = R�1��1��1TR�1T = R�1��2Rsince � is diagonal and R is orthonormal. If we can extract � and R from any conic matrix thenwe can solve for its Jacobian. This can be done by �nding the diagonal form for Q,Q = S�1ASwhere A is the diagonal matrix of the eigenvalues of Q, and the columns of S are the correspondingeigenvectors [Strang80]. If the eigenvectors are chosen to have unit length then we can equateR = S and ��2 = A.The eigenvalues of a 2� 2 symmetric matrix Q areA = 8>>>:�1 00 �29>>>; = 8>>>: (q + t)=2 00 (q � t)=29>>>;81

Page 84: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

where p = A� Cq = A+ Ct = sgn(p)qp2 +B2and sgn(x) = ��1 x < 0+1 x � 0When t 6= 0, The unit eigenvectors of Q are the columns ofS = 8>>>>>>: q t+p2t sgn(Bp)q t�p2t�sgn(Bp)q t�p2t q t+p2t 9>>>>>>;The eigenvectors of M are then given by � = A�1=2:a; b = ��1=21 ; ��1=22 = s 2q � tso the Jacobian is:M = 8>>>:ux vxuy vy 9>>>; = �R= 8>>>>>>:q 2q+t 00 q 2q�t 9>>>>>>;8>>>>>>: q t+p2t sgn(Bp)q t�p2t�sgn(Bp)q t�p2t q t+p2t 9>>>>>>;= 8>>>>>>: q t+pt(q+t) sgn(Bp)q t�pt(q+t)�sgn(Bp)q t�pt(q�t) q t+pt(q�t) 9>>>>>>;When t = 0, the ellipse is a circle, so basis vectors of any phase will be orthogonal. A convenientJacobian in this case is: M = 8>>>: 1=pA 00 1=pA9>>>;The parametric ellipse de�ned by a Jacobian is:p0(s) = (u(s); v(s)) = (ux cos s+ uy sin s; vx cos s+ vy sin s)

82

Page 85: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

References[Bartels-Beatty-Barsky87] Richard Bartels, John Beatty, Brian Barsky, An Introduction toSplines for Use in Computer Graphics and Geometric Modeling, Morgan Kaufmann Pub-lishers, Palo Alto, CA, 1987.[Bier-Sloan86] Eric A. Bier, Kenneth R. Sloan, Jr., \Two-Part Texture Mappings", IEEE Com-puter Graphics and Applications, vol. 6, no. 9, Sept. 1986, pp. 40-53.[Blinn-Newell76] James F. Blinn, Martin E. Newell, \Texture and Re ection in Computer Gen-erated Images", CACM, vol. 19, no. 10, Oct. 1976, pp. 542-547.[Blinn89] James F. Blinn, \Return of the Jaggy", IEEE Computer Graphics and Applications,vol. 9, no. 2, Mar. 1989, pp. 82-89.[Bracewell78] Ronald N. Bracewell, The Fourier Transform and Its Applications, McGraw-Hill,New York, 1978.[Brigham74] E. Oran Brigham, The Fast Fourier Transform, Prentice-Hall, Englewood Cli�s,NJ, 1974.[Carey-Greenberg85] Richard J. Carey, Donald P. Greenberg, \Textures for Realistic ImageSynthesis", Computers and Graphics, vol. 9, no. 2, 1985, pp. 125-138.[Catmull74] Edwin E. Catmull, A Subdivision Algorithm for Computer Display of Curved Sur-faces, PhD thesis, Dept. of CS, U. of Utah, Dec. 1974.[Catmull79] Edwin E. Catmull, \A Tutorial on Compensation Tables", Computer Graphics (SIG-GRAPH '79 Proceedings), vol. 13, no. 2, Aug. 1979, pp. 1-7.[Catmull-Smith80] Edwin E. Catmull, Alvy Ray Smith, \3-D Transformations of Images inScanline Order", Computer Graphics (SIGGRAPH '80 Proceedings), vol. 14, no. 3, July1980, pp. 279-285.[Clark-Palmer-Lawrence85] James J. Clark, Matthew R. Palmer, Peter D. Lawrence, \A Trans-formation Method for the Reconstruction of Functions from Nonuniformly Spaced Samples",IEEE Trans. on Acoustics, Speech, and Signal Processing, vol. ASSP-33, no. 4, Oct. 1985,pp. 1151-1165.[Coxeter78] H. S. M. Coxeter, Non-Euclidean Geometry, U. of Toronto Press, 1978.[Crochiere-Rabiner83] Ronald E. Crochiere, Lawrence R. Rabiner,Multirate Digital Signal Pro-cessing, Prentice Hall, Englewood Cli�s, NJ, 1983.83

Page 86: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

[Crow77] Franklin C. Crow, \The Aliasing Problem in Computer-Generated Shaded Images",CACM, vol. 20, Nov. 1977, pp. 799-805.[Crow84] Franklin C. Crow, \Summed-Area Tables for Texture Mapping", Computer Graphics(SIGGRAPH '84 Proceedings), vol. 18, no. 3, July 1984, pp. 207-212.[Dudgeon-Mersereau84] Dan E. Dudgeon, Russell M. Mersereau, Multidimensional Digital Sig-nal Processing, Prentice Hall, Englewood Cli�s, NJ, 1984.[Faux-Pratt79] I. D. Faux, M. J. Pratt, Computational Geometry for Design and Manufacture,Ellis Horwood Ltd., Chichester, England, 1979.[Feibush-Levoy-Cook80] Eliot A. Feibush, Marc Levoy, Robert L. Cook, \Synthetic TexturingUsing Digital Filters", Computer Graphics (SIGGRAPH '80 Proceedings), vol. 14, no. 3,July 1980, pp. 294-301.[Fiume-Fournier-Canale87] Eugene Fiume, Alain Fournier, V. Canale, \Conformal TextureMapping", Eurographics '87, 1987, pp. 53-64.[Foley-van Dam82] James D. Foley, Andries van Dam, Fundamentals of Interactive ComputerGraphics, Addison-Wesley, Reading, MA, 1982.[Fournier-Fiume88] Alain Fournier, Eugene Fiume, \Constant-Time Filtering with Space-VariantKernels", Computer Graphics (SIGGRAPH '88 Proceedings), vol. 22, no. 4, Aug. 1988, pp.229-238.[Fraser-Schowengerdt-Briggs85] Donald Fraser, Robert A. Schowengerdt, Ian Briggs, \Rec-ti�cation of Multichannel Images in Mass Storage Using Image Transposition", ComputerVision, Graphics, and Image Processing, vol. 29, no. 1, Jan. 1985, pp. 23-36.[Goldman83] Ronald N. Goldman, \An Urnful of Blending Functions", IEEE Computer Graphicsand Applications, vol. 3, Oct. 1983, pp. 49-54.[Gonzalez-Wintz87] Rafael C. Gonzalez, Paul Wintz, Digital Image Processing (2nd ed.), Add-ison-Wesley, Reading, MA, 1987.[Greene86] Ned Greene, \Environment Mapping and Other Applications of World Projections",Graphics Interface '86, May 1986, pp. 108-114.[Greene-Heckbert86] Ned Greene, Paul S. Heckbert, \Creating Raster Omnimax Images fromMultiple Perspective Views Using The Elliptical Weighted Average Filter", IEEE ComputerGraphics and Applications, vol. 6, no. 6, June 1986, pp. 21-27.[Hamming83] R. W. Hamming, Digital Filters, Prentice Hall, Englewood Cli�s, NJ, 1983.[Heckbert86a] Paul S. Heckbert, \Filtering by Repeated Integration", Computer Graphics (SIG-GRAPH '86 Proceedings), vol. 20, no. 4, Aug. 1986, pp. 317-321.[Heckbert86b] Paul S. Heckbert, \Survey of Texture Mapping", IEEE Computer Graphics andApplications, vol. 6, no. 11, Nov. 1986, pp. 56-67.[Hou-Andrews78] Hsieh S. Hou, Harry C. Andrews, \Cubic Splines for Image Interpolation andDigital Filtering", IEEE Trans. Acoustics, Speech, and Signal Processing, vol. ASSP-26, no.6, Dec. 1978, pp. 508-517. 84

Page 87: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

[Hourcade-Nicolas83] J. C. Hourcade, A. Nicolas, \Inverse Perspective Mapping in ScanlineOrder onto Non-Planar Quadrilaterals", Eurographics '83, 1983, pp. 309-319.[Hummel83] Robert Hummel, \Sampling for Spline Reconstruction", SIAM J. Appl. Math, vol.43, no. 2, Apr. 1983, pp. 278-288.[Jackson86] Leland B. Jackson, Digital Filters and Signal Processing, Kluwer Academic Publish-ers, Boston, 1986.[Kajiya-Ullner81] James T. Kajiya, Michael K. Ullner, \Filtering High Quality Text for Displayon Raster Scan Devices", Computer Graphics (SIGGRAPH '81 Proceedings), vol. 15, no. 3,Aug. 1981, pp. 7-15.[Maxwell46] E. A. Maxwell, The Methods of Plane Projective Geometry, Based on the Use ofGeneral Homogeneous Coordinates, Cambridge U. Press, London, 1946.[Oppenheim-Schafer75] Alan V. Oppenheim, Ronald W. Schafer, Digital Signal Processing,Prentice-Hall, Englewood Cli�s, NJ, 1975.[Paeth86] Alan W. Paeth, \A Fast Algorithm for General Raster Rotation", Graphics Interface'86, May 1986, pp. 77-81.[Peachey85] Darwyn R. Peachey, \Solid Texturing of Complex Surfaces", Computer Graphics(SIGGRAPH '85 Proceedings), vol. 19, no. 3, July 1985, pp. 279-286.[Perlin85] Ken Perlin, \An Image Synthesizer", Computer Graphics (SIGGRAPH '85 Proceed-ings), vol. 19, no. 3, July 1985, pp. 287-296.[Pratt78] W. K. Pratt, Digital Image Processing, John Wiley and Sons, New York, 1978.[Rao73] C. Radhakrishna Rao, Linear Statistical Inference and Its Applications, 2nd ed., JohnWiley, NY, 1973.[Roberts66] Lawrence G. Roberts, Homogeneous Matrix Representation and Manipulation of N-Dimensional Constructs, MS-1405, Lincoln Lab, Lexington, MA, July 1966.[Rogers85] David F. Rogers, Procedural Elements for Computer Graphics, McGraw-Hill, NewYork, 1985.[Rosenfeld84] Azriel Rosenfeld, Multiresolution Image Processing and Analysis, Springer, Berlin,1984.[Shannon49] Claude E. Shannon, \Communication in the Presence of Noise", Proc. IRE, vol.37, no. 1, Jan. 1949, pp. 10-21.[Shantz-Lien87] Michael Shantz, Sheue-Ling Lien, \Shading Bicubic Patches", Computer Graph-ics (SIGGRAPH '87 Proceedings), vol. 21, no. 4, July 1987.[Smith83] Alvy Ray Smith, Digital Filtering Tutorial for Computer Graphics, Parts I and II,Lucas�lm Technical Memos 27 & 44, Pixar, San Rafael, CA, Mar. 1983, July 1983.[Smith87] Alvy Ray Smith, \Planar 2-Pass Texture Mapping and Warping", Computer Graphics(SIGGRAPH '87 Proceedings), vol. 21, no. 4, July 1987, pp. 263-272.85

Page 88: Con - Semantic Scholar · 2015-07-29 · tutorial on three common classes of mapping: the a ne, bilinear, and pro jectiv e. F or resampling, this w ork dev elops a new theory describing

[Strang80] Gilbert Strang, Linear Algebra and Its Applications, 2nd ed., Academic Press, NewYork, 1980.[Turkowski88] Ken Turkowski, Several Filters for Sample Rate Conversion, Technical Report No.9, Apple Computer, Cupertino, CA, May 1988.[Ullner83] Mike K. Ullner, Parallel Machines for Computer Graphics, PhD thesis, CaliforniaInstitute of Technology, 1983.[Williams83] Lance Williams, \Pyramidal Parametrics", Computer Graphics (SIGGRAPH '83Proceedings), vol. 17, no. 3, July 1983, pp. 1-11.[Wolberg88] George Wolberg, Geometric Transformation Techniques for Digital Images: A Sur-vey, TR CUCS-390-88, Dept. of CS, Columbia U., Dec. 1988.

86