# 5.5: Homogeneous Coordinates

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$

( \newcommand{\kernel}{\mathrm{null}\,}\) $$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\id}{\mathrm{id}}$$

$$\newcommand{\Span}{\mathrm{span}}$$

$$\newcommand{\kernel}{\mathrm{null}\,}$$

$$\newcommand{\range}{\mathrm{range}\,}$$

$$\newcommand{\RealPart}{\mathrm{Re}}$$

$$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$

$$\newcommand{\Argument}{\mathrm{Arg}}$$

$$\newcommand{\norm}[1]{\| #1 \|}$$

$$\newcommand{\inner}[2]{\langle #1, #2 \rangle}$$

$$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

$$\newcommand{\vectorA}[1]{\vec{#1}} % arrow$$

$$\newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow$$

$$\newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vectorC}[1]{\textbf{#1}}$$

$$\newcommand{\vectorD}[1]{\overrightarrow{#1}}$$

$$\newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}}$$

$$\newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}}$$

$$\newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

$$\newcommand{\avec}{\mathbf a}$$ $$\newcommand{\bvec}{\mathbf b}$$ $$\newcommand{\cvec}{\mathbf c}$$ $$\newcommand{\dvec}{\mathbf d}$$ $$\newcommand{\dtil}{\widetilde{\mathbf d}}$$ $$\newcommand{\evec}{\mathbf e}$$ $$\newcommand{\fvec}{\mathbf f}$$ $$\newcommand{\nvec}{\mathbf n}$$ $$\newcommand{\pvec}{\mathbf p}$$ $$\newcommand{\qvec}{\mathbf q}$$ $$\newcommand{\svec}{\mathbf s}$$ $$\newcommand{\tvec}{\mathbf t}$$ $$\newcommand{\uvec}{\mathbf u}$$ $$\newcommand{\vvec}{\mathbf v}$$ $$\newcommand{\wvec}{\mathbf w}$$ $$\newcommand{\xvec}{\mathbf x}$$ $$\newcommand{\yvec}{\mathbf y}$$ $$\newcommand{\zvec}{\mathbf z}$$ $$\newcommand{\rvec}{\mathbf r}$$ $$\newcommand{\mvec}{\mathbf m}$$ $$\newcommand{\zerovec}{\mathbf 0}$$ $$\newcommand{\onevec}{\mathbf 1}$$ $$\newcommand{\real}{\mathbb R}$$ $$\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}$$ $$\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}$$ $$\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}$$ $$\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}$$ $$\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}$$ $$\newcommand{\laspan}[1]{\text{Span}\{#1\}}$$ $$\newcommand{\bcal}{\cal B}$$ $$\newcommand{\ccal}{\cal C}$$ $$\newcommand{\scal}{\cal S}$$ $$\newcommand{\wcal}{\cal W}$$ $$\newcommand{\ecal}{\cal E}$$ $$\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}$$ $$\newcommand{\gray}[1]{\color{gray}{#1}}$$ $$\newcommand{\lgray}[1]{\color{lightgray}{#1}}$$ $$\newcommand{\rank}{\operatorname{rank}}$$ $$\newcommand{\row}{\text{Row}}$$ $$\newcommand{\col}{\text{Col}}$$ $$\renewcommand{\row}{\text{Row}}$$ $$\newcommand{\nul}{\text{Nul}}$$ $$\newcommand{\var}{\text{Var}}$$ $$\newcommand{\corr}{\text{corr}}$$ $$\newcommand{\len}[1]{\left|#1\right|}$$ $$\newcommand{\bbar}{\overline{\bvec}}$$ $$\newcommand{\bhat}{\widehat{\bvec}}$$ $$\newcommand{\bperp}{\bvec^\perp}$$ $$\newcommand{\xhat}{\widehat{\xvec}}$$ $$\newcommand{\vhat}{\widehat{\vvec}}$$ $$\newcommand{\uhat}{\widehat{\uvec}}$$ $$\newcommand{\what}{\widehat{\wvec}}$$ $$\newcommand{\Sighat}{\widehat{\Sigma}}$$ $$\newcommand{\lt}{<}$$ $$\newcommand{\gt}{>}$$ $$\newcommand{\amp}{&}$$ $$\definecolor{fillinmathshade}{gray}{0.9}$$

In the previous section we were able to combine rotation and scaling into a single composite operation by matrix multiplication. Unfortunately, translation cannot yet be included in the composite operator since we do it by addition rather than by multiplication.

## Example $$\PageIndex{1}$$

Suppose we wish to rotate the image $$G$$ by $$\frac{\pi}{3}$$ about the point (−10,10). Our rotation matrix R($$\theta$$) always rotates about the origin, so we must combine three transformations to accomplish this:

1. translate the point (−10,10) to the origin;
2. rotate $$\frac{\pi}{3}$$ radians about the origin; and
3. translate the origin back to (−10,10).

For step (i), we have $$b_{0}=\left[\begin{array}{l} 10 \\ -10 \end{array}\right]$$ and

$\mathrm{G}_{1}=\mathrm{G}+\mathrm{b}_{0} 1^{T} \nonumber$

For step (ii),

\begin{align} \mathrm{G}_{2} &=\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{G}_{1} \nonumber \\ &=\mathrm{R}\left(\frac{\pi}{3}\right)\left[\mathrm{G}+\mathrm{b}_{0} 1^{T}\right] \nonumber \\ &=\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{G}+\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{b}_{0} 1^{T} . \end{align} \nonumber

For step (iii), we can use −$$b_0$$ from step (i):

\begin{align} \mathrm{G}_{\text {new }} &=\mathrm{G}_{2}-\mathrm{b}_{0} 1^{T} \nonumber \\ &=\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{G}+\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{b}_{0} 1^{T}-\mathrm{b}_{0} 1^{T} \nonumber \\ &=\mathrm{R}\left(\frac{\pi}{3}\right) \mathrm{G}+\left[\left(\mathrm{R}\left(\frac{\pi}{3}\right)-\mathrm{I}\right) \mathrm{b}_{0}\right] 1^{T} . \end{align} \nonumber

In this example we were unable to find a single matrix operator $$A$$ to do the entire job. The total transformation took the form

$\mathrm{G}_{\text {new }}=\mathrm{AG}+\mathrm{b} 1^{T} \nonumber$

This is called an affine transformation because it involves both multiplication by $$A$$ and addition of a constant matrix. This is in contrast to the more desirable linear transformation, which involves only multiplication by $$A$$.

We will now move toward a modified representation of the image and the operators by rewriting the last equation as

$\mathrm{G}_{\text {new }}=[\mathrm{Ab}]\left[\begin{array}{l} \mathrm{G} \\ 1^{T} \end{array}\right] \nonumber$

where in the example we had $$A = \mathrm{R}\left(\frac{\pi}{3}\right)$$ and $$b=\left(\mathrm{R}\left(\frac{\pi}{3}\right)-\mathrm{I}\right) b_{0}$$.

## Exercise $$\PageIndex{1}$$

Show that, for any matrices A,B,C,D of compatible sizes,

$\mathrm{AB}+\mathrm{CD}=\left[\begin{array}{ll} A & \mathrm{C} \end{array}\right]\left[\begin{array}{l} \mathrm{B} \\ \mathrm{D} \end{array}\right] \nonumber$

The matrix $$\left[\begin{array}{l} \mathrm{G} \\ 1^{T} \end{array}\right]$$ looks like

$\left[\begin{array}{lll} x_{1} & x_{2} & x_{n} \\ y_{1} & y_{2} & y_{n} \\ 1 & 1 & 1 \end{array}\right] \nonumber$

and the points $$(x_i,y_i,1)$$ are called homogeneous coordinates. We can modify Equation 5 so that the new point matrix is also in homogeneous coordinates:

$\left[\begin{array}{l} \mathrm{G}_{\text {new }} \\ 1^{T} \end{array}\right]=\left[\begin{array}{ll} \mathrm{A} & \mathrm{b} \\ \mathrm{O}^{T} & 1 \end{array}\right]\left[\begin{array}{l} \mathrm{G} \\ 1^{T} \end{array}\right] \nonumber$

In the new representation, each point in the image has a third coordinate, which is always a 1. The homogeneous transformation is a 3×3 matrix,

$\mathrm{A}_{h}=\left[\begin{array}{ll} \mathrm{A} & \mathrm{b} \\ 0^{T} & 1 \end{array}\right] \text { , } \nonumber$

which is capable of translation, rotation, and scaling all by matrix multiplication. Thus, using homogeneous coordinates, we can build composite transformations that include translation.

In homogeneous coordinates, we have

$\mathrm{R}(\theta)=\left[\begin{array}{lll} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{array}\right] \nonumber$

$\mathrm{S}\left(s_{x}, s_{y}\right)=\left[\begin{array}{lll} s_{x} & 0 & 0 \\ 0 & s_{y} & 0 \\ 0 & 0 & 1 \end{array}\right] \nonumber$

$\mathrm{T}\left(t_{x}, t_{y}\right)=\left[\begin{array}{lll} 1 & 0 & t_{x} \\ 0 & 1 & t_{y} \\ 0 & 0 & 1 \end{array}\right] \nonumber$

## Example $$\PageIndex{2}$$

The composite transformation to triple the size of an image and then move it 2 units to the left is

$\mathrm{A}=\left[\begin{array}{lll} 1 & 0 & -2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right]\left[\begin{array}{lll} 3 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \end{array}\right]=\left[\begin{array}{lll} 3 & 0 & -2 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \end{array}\right] \nonumber$

On the other hand, the composite transformation to move an image 2 units to the left and then triple its size is

$\mathrm{B}=\left[\begin{array}{lll} 3 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \end{array}\right]\left[\begin{array}{lll} 1 & 0 & -2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right]=\left[\begin{array}{lll} 3 & 0 & -6 \\ 0 & 3 & 0 \\ 0 & 0 & 1 \end{array}\right] \nonumber$

In the latter case, the distance of the translation is also tripled.

## Exercise $$\PageIndex{2}$$

Find a single composite transformation in homogeneous coordinates that rotates an image by angle $$\theta$$ about point $$(x_i,y_i)$$ as in Example 1.

This page titled 5.5: Homogeneous Coordinates is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Louis Scharf (OpenStax CNX) via source content that was edited to the style and standards of the LibreTexts platform.