5.3: Transformaciones de imagen bidimensionales
- Page ID
- 82389
\( \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}\)Ahora volvemos nuestra atención a operar sobre la matriz de puntos\(G\) para producir las transformaciones deseadas. Consideraremos el escalado de rotación y la traslación (movimiento) de objetos. La rotación y el escalado se realizan por multiplicación matricial con una matriz de transformación cuadrada\(A\). Si llamamos a la matriz de puntos transformada\(\mathrm{G}_{\text {new }}\), tenemos
\[\left[\mathrm{G}_{\text {new }}\right]=[\mathrm{A}][\mathrm{G}] \nonumber \]
Llamamos a\(A\) un operador de matriz porque “opera”\(G\) a través de la multiplicación matricial. En contraste, la traducción debe hacerse por adición matricial.
En una sección posterior verá que es ventajoso realizar todas las operaciones por operadores matriciales y que podemos modificar nuestra representación de imagen para permitir que la traslación se realice con un operador de matriz como rotación y escalado. Llamaremos a la representación modificada coordenadas homogéneas.
Rotación
Vimos en el capítulo sobre álgebra lineal que la matriz que gira los puntos por un ángulo\(\theta\) es
\ [A=R (\ theta) =\ left [\ begin {array} {cc}
\ cos\ theta & -\ sin\ theta\
\ sin\ theta &\ cos\ theta
\ end {array}\ derecha]\ nonumber\]
Cuando se aplica a la matriz de puntos\(G\), este operador de matriz gira cada punto por el ángulo\(\theta\), independientemente del número de puntos.
Podemos usar la matriz de rotación para hacer la rotación de un solo punto del ejemplo de “Gráficos vectoriales: Introducción”. Tenemos una matriz de puntos que consiste únicamente en el punto (3,1):
\ [\ mathrm {G} =\ left [\ begin {array} {l}
3\\
1
\ end {array}\ derecha]\ nonumber\]
La matriz de transformación necesaria es\(R(\theta)\) con\(\theta = \frac{\pi}{6}\). Luego, el punto girado viene dado por
\ [\ mathrm {G} _ _ {\ text {new}} =\ mathrm {R}\ izquierda (\ frac {\ pi} {6}\ derecha)\ mathrm {G} =\ left [\ begin {array} {ll}
\ cos\ izquierda (\ frac {\ pi} {6}\ derecha) & -\ sin\ izquierda (\ frac {\ pi} {6} derecha)\\
\ sin\ izquierda (\ frac {\ pi} {6}\ derecha) &\ cos\ izquierda (\ frac {\ pi} {6}\ derecha)
\ end {array}\ derecha]\ izquierda [\ begin {array} {l}
3\\
1
\ end {array}\ right]\ approx\ left [\ begin {array} {l}
2.10\\
2.37
\ end {array}\ derecha]\ nonumber\]
Escalado
Un objeto se puede ampliar o reducir en cada dimensión de forma independiente. El operador de matriz que escala una imagen por un factor de\(s_x\) a lo largo del eje x y\(s_y\) a lo largo del eje y es
\ [\ mathrm {A} =\ mathrm {S}\ izquierda (s_ {x}, s_ {y}\ derecha) =\ izquierda [\ begin {array} {ll}
s_ {x} & 0\\
0 & s_ {y}
\ end {array}\ derecha]\ nonumber\]
La mayoría de las veces tomamos\(s_x=s_y\) para escalar una imagen por la misma cantidad en ambas dimensiones.
Escriba las siguientes matrices. Simplifica y da respuestas numéricas a dos decimales:
- \(\mathrm{R}\left(\frac{\pi}{2}\right)\);
- \(\mathrm{S}(3,2)\);
- \(\mathrm{R}\left(-\frac{\pi}{4}\right)\);
- \(\mathrm{S}(-1,1)\).
Reflexiones
¿Qué hace S (−1,1)? S (1, −1)? S (−1, −1)? S (1,1)?
Dado\ (G=\ left [\ begin {array} {llll}
0 & -1.5 & 4 & 4\\
0 & 5 & 2.3 & -1
\ end {array}\ right]\) y\(\theta=\frac{\pi}{3}\) buscar\(\mathrm{G}_{\text {new }}=\mathrm{R}(\theta) \mathrm{G}\). Dar respuestas numéricas a dos decimales.
Aplicar cada una de las transformaciones del Ejercicio 1 y 2 a la imagen
\ [\ mathrm {G} =\ left [\ begin {array} {llll}
1 & 1 & 2 & 2\
1 & 2 & 2 & 1
\ end {array}\ right];\ quad\ mathrm {H} =\ left [\ begin {array} {llll}
1 & 2 & 3 & 4\
2 & 3 & 4 & 1
\ end {array} \ derecha]\ nonumber\]
Esboza la imagen original y cada transformación de la misma.
Traducción
Un objeto se puede mover agregando un vector constante\(b\) a cada punto del objeto. Por ejemplo,\ (b=\ left [\ begin {array} {l}
20\\
-5
\ end {array}\ right]\) moverá un objeto 20 unidades a la derecha y 5 unidades hacia abajo. Podemos escribir esto en términos de la matriz de puntos como
\[\mathrm{G}_{\text {new }}=\mathrm{G}+\mathrm{b} 1^{T} \nonumber \]
donde 1 (leer “el uno-vector”) es un vector de\(n\) 1's:
\ [1=\ left [\ begin {array} {c}
1\\
1\\
\ vdots\\
1
\ end {array}\ derecha]\ nonumber\]
En MATLAB, se puede obtener 1 por unos (n, 1). El producto exterior de\(b\) con 1 en la Ecuación 7 simplemente sirve para hacer\(n\) copias de\(b\) manera que se pueda agregar una copia a cada punto en\(G\).