Zum Inhalt springen

Faltungsmatrix

aus Wikipedia, der freien Enzyklopädie
Dies ist die aktuelle Version dieser Seite, zuletzt bearbeitet am 13. März 2026 um 12:25 Uhr durch imported>Abrev (Beispiele: ergänzt).
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Vorlage:Hinweisbaustein Faltungsmatrizen (auch Kern, Filterkern, Filteroperator, Filtermaske oder Faltungskern genannt, {{Modul:Vorlage:lang}} Modul:Vorlage:lang:103: attempt to index field 'wikibase' (a nil value)) werden in der digitalen Bildverarbeitung für Filter verwendet. Es handelt sich meist um quadratische Matrizen ungerader Abmessungen in unterschiedlichen Größen. Viele Bildverarbeitungsoperationen können als lineares System dargestellt werden, wobei eine diskrete Faltung, eine lineare Operation, angewandt wird. Für diskrete zweidimensionale Funktionen (digitale Bilder) ergibt sich folgende Berechnungsformel für die diskrete Faltung:

<math>

I^{*}(x,y) = \sum_{i=1}^{n} \sum_{j=1}^{n} I(x-i+a,\; y-j+a)k(i,j) </math>

<math>I^{*}(x,y)</math> ist hier das Ergebnispixel, <math>I</math> ist das Bild, auf welches der Filter angewandt wird, <math>a</math> ist die Koordinate des Mittelpunkts in der quadratischen Faltungsmatrix, und <math>k(i,j)</math> ist ein Element der Faltungsmatrix. Um den Mittelpunkt eindeutig definieren zu können, sind ungerade Abmessungen der Faltungsmatrizen notwendig.

Bei 3×3-Faltungsmatrizen ist <math>n = 3</math> und <math>a = 2</math>. Bei 5×5-Faltungsmatrizen ist <math>n = 5</math> und <math>a = 3</math>.

Beispiele

<math>
 \frac{1}{9}   \cdot
 \begin{pmatrix} 
   1   &   1   &   1 \\ 
   1   &   1   &   1 \\ 
   1   &   1   &   1 
 \end{pmatrix} 

</math>

  • Gauß Weichzeichner
<math>
 \frac{1}{16}   \cdot
 \begin{pmatrix} 
   1   &   2   &   1 \\ 
   2   &   4   &   2 \\ 
   1   &   2  &   1 
 \end{pmatrix} 

</math>

  • Schärfungsfilter
<math>
  \begin{pmatrix} 
   0   &   -1   &   0 \\ 
   -1   &   5   &  -1 \\ 
   0   &   -1   &   0 
 \end{pmatrix} 

</math>

  • Kantenfilter X (Sobel X)
<math>
  \begin{pmatrix} 
   -1   &   0   &   1 \\ 
   -2   &   0   &   2 \\ 
   -1   &   0   &   1 
 \end{pmatrix} 

</math>

  • Kantenfilter Y (Sobel Y)
<math>
  \begin{pmatrix} 
   1   &   2  &   1 \\ 
   0   &   0   &   0 \\ 
   -1   &  -2   &   -1
 \end{pmatrix} 

</math>

  • Kantenfilter, Laplace
<math>
  \begin{pmatrix} 
   0   &   1   &   0 \\ 
   1   &   -4  &   1 \\ 
   0    &   1    &  0 
 \end{pmatrix} 

</math>

  • Relieffilter
<math>
  \begin{pmatrix} 
   -2   &   -1   &   0 \\ 
   -1   &   1    &   1 \\ 
   0    &   1    &   2 
 \end{pmatrix} 

</math>

Faltungstheorem

Mithilfe des Faltungstheorems kann der Aufwand zur Berechnung einer diskreten Faltung von der Komplexitätsklasse <math> \mathcal{O}(n^2)</math> auf <math> \mathcal{O}(n \cdot \log n) </math> reduziert werden.

Literatur

  • Gary Bradski, Adrian Kaehler: Learning OpenCV: Computer Vision with the OpenCV Library. O’Reilly Media, ISBN 978-0-596-51613-0.

Siehe auch