Formelsammlung Visual Computing

Kompakte Sammlung aller wichtigen Formeln des Kurses, nach Themen geordnet. Ergänzend zu den Spickzetteln. Verweise auf das jeweilige Kapitel in Klammern.

Transformationen (Kap. 5)

Punkt als Spaltenvektor, homogene Koordinate w=1w=1. Verkettung ist nicht kommutativ; zuerst angewandte Transformation steht rechts.

T(tx,ty,tz)=(100tx010ty001tz0001)S(sx,sy,sz)=(sx0000sy0000sz00001)T(t_x,t_y,t_z)=\begin{pmatrix}1&0&0&t_x\\0&1&0&t_y\\0&0&1&t_z\\0&0&0&1\end{pmatrix}\quad S(s_x,s_y,s_z)=\begin{pmatrix}s_x&0&0&0\\0&s_y&0&0\\0&0&s_z&0\\0&0&0&1\end{pmatrix} Rx(α)=(10000cosαsinα00sinαcosα00001) Ry(α)=(cosα0sinα00100sinα0cosα00001) Rz(α)=(cosαsinα00sinαcosα0000100001)R_x(\alpha)=\begin{pmatrix}1&0&0&0\\0&\cos\alpha&-\sin\alpha&0\\0&\sin\alpha&\cos\alpha&0\\0&0&0&1\end{pmatrix}\ R_y(\alpha)=\begin{pmatrix}\cos\alpha&0&\sin\alpha&0\\0&1&0&0\\-\sin\alpha&0&\cos\alpha&0\\0&0&0&1\end{pmatrix}\ R_z(\alpha)=\begin{pmatrix}\cos\alpha&-\sin\alpha&0&0\\\sin\alpha&\cos\alpha&0&0\\0&0&1&0\\0&0&0&1\end{pmatrix}
  • Drehung/Skalierung um Referenzpunkt p\vec{p}: M=T(+p)RT(p)M = T(+\vec{p})\cdot R\cdot T(-\vec{p}).
  • Homogenisierung (perspective divide): (X,Y,Z,W)(X/W,Y/W,Z/W)(X,Y,Z,W)\to(X/W,\,Y/W,\,Z/W), W0W\neq 0.
  • Szenegraph: Kette von der Wurzel zum Blatt, Wurzel-Transformation steht links, z.B. T1T3T6PT_1\cdot T_3\cdot T_6\cdot P.

Kamera & Projektion (Kap. 7)

  • View-Matrix: V=RKameraT(c)V = R_{Kamera}\cdot T(-\vec{c}) (Rotation der Kameraachsen, dann Translation um -Kameraposition).
  • gluLookAt(eye, center, up): Augpunkt, Blickpunkt, Up-Vektor.
  • glm::perspective(fovy, aspect, zNear, zFar).
  • Strahlensatz (perspektivische Projektion auf near-Ebene nn): py=npypz\displaystyle p'_y = \frac{n\cdot p_y}{p_z} (analog pxp'_x).
  • Transformationskette: p=MProjVMModelpp' = M_{Proj}\cdot V \cdot M_{Model}\cdot p. NDC-Würfel: [1,1]3[-1,1]^3.

Hinweis: Die vollständige perspektivische Projektionsmatrix ist laut Vorlesung nicht klausurrelevant.

Rendering-Pipeline & Interpolation (Kap. 8)

  • Koordinatenräume: Local \to (ModelMatrix) \to World \to (ViewMatrix) \to Camera \to (ProjectionMatrix) \to Clip \to (Homogenisierung) \to NDC \to (Viewport) \to Fenster.
  • Lineare Interpolation (Kante): F(t)=(1t)F(0)+tF(1)F(t) = (1-t)\,F(0) + t\,F(1).
  • Baryzentrische Interpolation im Dreieck: c(p)=w1c1+w2c2+w3c3\vec{c}(p)=w_1\vec{c}_1+w_2\vec{c}_2+w_3\vec{c}_3 mit wi=Ai/Agesw_i=A_i/A_{ges} und w1+w2+w3=1w_1+w_2+w_3=1.
  • Dreiecksfläche: A=12x1(y2y3)+x2(y3y1)+x3(y1y2)A=\tfrac12\,|x_1(y_2-y_3)+x_2(y_3-y_1)+x_3(y_1-y_2)|.
  • Tiefentest: glEnable(GL_DEPTH_TEST), glDepthFunc(GL_LESS) (kleinerer z gewinnt), glClearDepth(1.0).

Beleuchtung nach Phong (Kap. 9)

Vektoren am Punkt P (normiert): N\vec{N} Normale, L\vec{L} Licht, R\vec{R} Reflexion, V\vec{V} Blick. α=(N,L)\alpha=\angle(\vec N,\vec L), β=(R,V)\beta=\angle(\vec R,\vec V).

Lo=MaLaambient+MdLicosαdiffus+MsLicoskβspekular+MeemissionL_o = \underbrace{M_a L_a}_{\text{ambient}} + \underbrace{M_d\,L_i\,\cos\alpha}_{\text{diffus}} + \underbrace{M_s\,L_i\,\cos^{k}\beta}_{\text{spekular}} + \underbrace{M_e}_{\text{emission}}
  • Diffus (Lambert): cosα=max(0, NL)\propto \cos\alpha = \max(0,\ \vec N\cdot\vec L).
  • Spekular: coskβ=max(0, RV)k\propto \cos^{k}\beta = \max(0,\ \vec R\cdot\vec V)^{k}; großes kk = kleiner, harter Glanzpunkt.

Farbräume (Kap. 3, 10)

  • RGB additiv; CMY subtraktiv; CMY=1RGB\text{CMY}=1-\text{RGB}.
  • HSV aus RGB (Werte in [0,1][0,1]): V=max(R,G,B)V=\max(R,G,B), S=maxminmax\displaystyle S=\frac{\max-\min}{\max} (bzw. 00 falls max=0\max=0), HH = Winkel auf dem Farbkreis (00^\circ Rot, 120120^\circ Grün, 240240^\circ Blau).
  • Grauwert-/Luma-Gewichtung ca. 0,3R+0,6G+0,1B0{,}3\,R + 0{,}6\,G + 0{,}1\,B.

Hinweis: Die konkreten YCbCr-Matrixkoeffizienten sind laut Vorlesung nicht klausurrelevant.

Bildbearbeitung: Punktoperatoren (Kap. 11)

  • Lineare Grauwerttransformation: g(i,j)=e(i,j)mult+addg'(i,j) = e(i,j)\cdot \text{mult} + \text{add}.
  • Kontrastspreizung von [emin,emax][e_{min},e_{max}] auf [gmin,gmax][g'_{min},g'_{max}]: mult=gmaxgminemaxemin\displaystyle \text{mult}=\frac{g'_{max}-g'_{min}}{e_{max}-e_{min}}, dann add=gminmultemin\text{add}=g'_{min}-\text{mult}\cdot e_{min}.
  • mult>1\text{mult}>1 = kontrastreicher (Histogramm gespreizt, Lücken); mult<1\text{mult}<1 = kontrastärmer.
  • Inversion: g=gmaxgg'=g_{max}-g. Gammakorrektur: g=gmax(g/gmax)1/γg'=g_{max}\,(g/g_{max})^{1/\gamma}.

Bildverarbeitung: lokale Operatoren (Kap. 12)

Faltung (3x3): g(i,j)=u,vK(u,v)g(i+u,j+v)\displaystyle g'(i,j)=\sum_{u,v} K(u,v)\cdot g(i+u,\,j+v). Kerngröße ungerade (eindeutiges Zentrum).

Mittelwert=19(111111111)Gauss=116(121242121)Laplace=(010141010)\text{Mittelwert}=\frac19\begin{pmatrix}1&1&1\\1&1&1\\1&1&1\end{pmatrix}\quad \text{Gauss}=\frac{1}{16}\begin{pmatrix}1&2&1\\2&4&2\\1&2&1\end{pmatrix}\quad \text{Laplace}=\begin{pmatrix}0&-1&0\\-1&4&-1\\0&-1&0\end{pmatrix} Sobelx=(101202101)Sobely=(121000121)\text{Sobel}_x=\begin{pmatrix}-1&0&1\\-2&0&2\\-1&0&1\end{pmatrix}\quad \text{Sobel}_y=\begin{pmatrix}-1&-2&-1\\0&0&0\\1&2&1\end{pmatrix}
  • Median (Rangordnung, nichtlinear): mittlerer Wert der sortierten Nachbarschaft; erzeugt keine neuen Grauwerte, erhält Kanten, entfernt Ausreißer.
  • ZHK (Zusammenhangskomponenten): N4 (4 direkte Nachbarn) vs N8 (zusätzlich Diagonalen). N8 verschmilzt diagonal berührende Pixel, ergibt also gleich viele oder weniger Komponenten als N4. Flood Fill = rekursives Fluten.

Siehe auch die kompakten Spickzettel (A4) und die vollständigen Kapitel.