diff --git a/Abgabe/DigBV_Aufgabe.aux b/Abgabe/DigBV_Aufgabe.aux index 5997459..9e521c8 100644 --- a/Abgabe/DigBV_Aufgabe.aux +++ b/Abgabe/DigBV_Aufgabe.aux @@ -17,15 +17,15 @@ \@input{sections/a2.aux} \@input{sections/a3.aux} \@input{sections/conclusion.aux} -\newlabel{LastPage}{{}{17}{}{page.17}{}} +\newlabel{LastPage}{{}{29}{}{page.29}{}} \pagesLTS@ifcounter{pagesLTS.arabic.1.local.cnt} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} -\gdef\pagesLTS.lastpage{17} -\setcounter{pagesLTS.pagenr}{17} -\newlabel{VeryLastPage}{{}{17}{}{page.17}{}} -\newlabel{pagesLTS.arabic.1}{{}{17}{}{page.17}{}} -\newlabel{pagesLTS.arabic.1.local}{{}{17}{}{page.17}{}} -\newlabel{pagesLTS.arabic}{{}{17}{}{page.17}{}} -\newlabel{pagesLTS.arabic.local}{{}{17}{}{page.17}{}} -\newlabel{LastPages}{{}{17}{}{page.17}{}} -\gdef \@abspage@last{17} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} +\gdef\pagesLTS.lastpage{29} +\setcounter{pagesLTS.pagenr}{29} +\newlabel{VeryLastPage}{{}{29}{}{page.29}{}} +\newlabel{pagesLTS.arabic.1}{{}{29}{}{page.29}{}} +\newlabel{pagesLTS.arabic.1.local}{{}{29}{}{page.29}{}} +\newlabel{pagesLTS.arabic}{{}{29}{}{page.29}{}} +\newlabel{pagesLTS.arabic.local}{{}{29}{}{page.29}{}} +\newlabel{LastPages}{{}{29}{}{page.29}{}} +\gdef \@abspage@last{29} diff --git a/Abgabe/DigBV_Aufgabe.log b/Abgabe/DigBV_Aufgabe.log index 9df0db4..b94ce52 100644 --- a/Abgabe/DigBV_Aufgabe.log +++ b/Abgabe/DigBV_Aufgabe.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.8.22) 3 JUL 2025 09:29 +This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian) (preloaded format=pdflatex 2024.8.22) 3 JUL 2025 22:46 entering extended mode \write18 enabled. %&-line parsing enabled. @@ -955,37 +955,169 @@ nput line 94. ]) [9] \openout2 = `sections/a1.aux'. - (./sections/a1.tex + (./sections/a1.tex [10 + + + +] LaTeX Font Info: Font shape `OT1/pcr/m/it' in size <8> not available -(Font) Font shape `OT1/pcr/m/sl' tried instead on input line 33. - [10 - - - -]) [11] +(Font) Font shape `OT1/pcr/m/sl' tried instead on input line 38. + [11] [12]) [13] \openout2 = `sections/a2.aux'. -(./sections/a2.tex [12 +(./sections/a2.tex [14 -]) [13] +] + +File: fig/hist_b_1.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_b_1.png used on input line 58. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/hist_b_2.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_b_2.png used on input line 65. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [15 <./fig/hist_b_1.png>] + +File: fig/hist_g_1.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_g_1.png used on input line 72. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/hist_g_2.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_g_2.png used on input line 79. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [16 <./fig/hist_b_2.png> <./fig/hist_g_1.png>] + +File: fig/hist_r_1.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_r_1.png used on input line 86. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/hist_r_2.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_r_2.png used on input line 93. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [17 <./fig/hist_g_2.png> <./fig/hist_r_1.png>] + +File: fig/screenshot_1.png Graphic file (type png) + +Package pdftex.def Info: fig/screenshot_1.png used on input line 100. +(pdftex.def) Requested size: 284.52756pt x 213.39682pt. + +File: fig/screenshot_2.png Graphic file (type png) + +Package pdftex.def Info: fig/screenshot_2.png used on input line 107. +(pdftex.def) Requested size: 284.52756pt x 213.39682pt. + [18 <./fig/hist_r_2.png> <./fig/screenshot_1.png (PNG copy)>] + +File: fig/hist_hsv_H_20250630-190409.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_H_20250630-190409.png used on input line + 130. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [19 <./fig/screenshot_2.png (PNG copy)>] + +File: fig/hist_hsv_H_20250630-190511.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_H_20250630-190511.png used on input line + 137. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/hist_hsv_S_20250630-190409.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_S_20250630-190409.png used on input line + 144. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [20 <./fig/hist_hsv_H_20250630-190409.png> <./fig/hist_hsv_H_20250630-190511.p +ng>] + +File: fig/hist_hsv_S_20250630-190511.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_S_20250630-190511.png used on input line + 151. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/hist_hsv_V_20250630-190409.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_V_20250630-190409.png used on input line + 158. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + [21 <./fig/hist_hsv_S_20250630-190409.png> <./fig/hist_hsv_S_20250630-190511.p +ng>] + +File: fig/hist_hsv_V_20250630-190511.png Graphic file (type png) + +Package pdftex.def Info: fig/hist_hsv_V_20250630-190511.png used on input line + 165. +(pdftex.def) Requested size: 284.52756pt x 213.40593pt. + +File: fig/screenshot_20250630-190409.png Graphic file (type png) + +Package pdftex.def Info: fig/screenshot_20250630-190409.png used on input line + 172. +(pdftex.def) Requested size: 284.52756pt x 213.39682pt. + [22 <./fig/hist_hsv_V_20250630-190409.png> <./fig/hist_hsv_V_20250630-190511.p +ng>] + +File: fig/screenshot_20250630-190511.png Graphic file (type png) + +Package pdftex.def Info: fig/screenshot_20250630-190511.png used on input line + 179. +(pdftex.def) Requested size: 284.52756pt x 213.39682pt. + [23 <./fig/screenshot_20250630-190409.png (PNG copy)> <./fig/screenshot_202506 +30-190511.png (PNG copy)>]) [24] \openout2 = `sections/a3.aux'. - (./sections/a3.tex [14 + (./sections/a3.tex +Overfull \hbox (10.20361pt too wide) in paragraph at lines 34--35 +[][][][][][][][][][][][][][][][][][][][][] + [] + +[25 -] [15]) [16] +] +Overfull \hbox (10.20361pt too wide) in paragraph at lines 72--73 +[][][][][][][][][][][][][][][][][][][][][] + [] + + +Overfull \hbox (19.80371pt too wide) in paragraph at lines 82--84 +[][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [] + + +Overfull \hbox (0.60352pt too wide) in paragraph at lines 87--88 +[][][][][][][][][][][][][][][][][][][][][][][][][][][][][] + [] + +[26] +Overfull \hbox (10.20361pt too wide) in paragraph at lines 118--119 +[][][][][][][][][][][][][][][][][][][][][] + [] + +[27] + +File: fig/Endergebnis.png Graphic file (type png) + +Package pdftex.def Info: fig/Endergebnis.png used on input line 144. +(pdftex.def) Requested size: 284.52756pt x 224.46758pt. +) [28 <./fig/Endergebnis.png>] \openout2 = `sections/conclusion.aux'. - -(./sections/conclusion.tex) [17 + (./sections/conclusion.tex) [29 -] +] + AED: pageslts setting LastPage \c@pagesLTS.arabic.1.local.count=\count330 @@ -1012,13 +1144,13 @@ Package rerunfilecheck Info: File `DigBV_Aufgabe.out' has not changed. (rerunfilecheck) Checksum: DCF2557CC60B5764E6ECAA8E00123F7E;2019. ) Here is how much of TeX's memory you used: - 27039 strings out of 474222 - 525296 string characters out of 5748733 - 1949975 words of memory out of 5000000 - 48619 multiletter control sequences out of 15000+600000 + 27362 strings out of 474222 + 532006 string characters out of 5748733 + 1974975 words of memory out of 5000000 + 48816 multiletter control sequences out of 15000+600000 580882 words of font info for 74 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 - 125i,9n,121p,883b,1265s stack positions out of 10000i,1000n,20000p,200000b,200000s + 125i,9n,121p,883b,1999s stack positions out of 10000i,1000n,20000p,200000b,200000s -Output written on DigBV_Aufgabe.pdf (17 pages, 912185 bytes). +Output written on DigBV_Aufgabe.pdf (29 pages, 3410833 bytes). PDF statistics: - 391 PDF objects out of 1000 (max. 8388607) - 335 compressed objects within 4 object streams - 134 named destinations out of 1000 (max. 500000) - 153 words of extra memory for PDF output out of 10000 (max. 10000000) + 614 PDF objects out of 1000 (max. 8388607) + 514 compressed objects within 6 object streams + 260 named destinations out of 1000 (max. 500000) + 238 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/Abgabe/DigBV_Aufgabe.pdf b/Abgabe/DigBV_Aufgabe.pdf index ce36ce3..39b0309 100644 Binary files a/Abgabe/DigBV_Aufgabe.pdf and b/Abgabe/DigBV_Aufgabe.pdf differ diff --git a/Abgabe/DigBV_Aufgabe.synctex.gz b/Abgabe/DigBV_Aufgabe.synctex.gz index 2071494..d79f2ce 100644 Binary files a/Abgabe/DigBV_Aufgabe.synctex.gz and b/Abgabe/DigBV_Aufgabe.synctex.gz differ diff --git a/Abgabe/DigBV_Aufgabe.toc b/Abgabe/DigBV_Aufgabe.toc index f91ef1c..ede4944 100644 --- a/Abgabe/DigBV_Aufgabe.toc +++ b/Abgabe/DigBV_Aufgabe.toc @@ -5,12 +5,12 @@ \contentsline {section}{\numberline {2}Aufgabe}{8}{section.2}% \contentsline {subsection}{\numberline {2.1}Vorverarbeitung}{10}{subsection.2.1}% \contentsline {subsubsection}{\numberline {2.1.1}Rauschreduktion}{10}{subsubsection.2.1.1}% -\contentsline {subsubsection}{\numberline {2.1.2}Histogramm Spreizung}{11}{subsubsection.2.1.2}% -\contentsline {subsection}{\numberline {2.2}Farbanalyse}{12}{subsection.2.2}% -\contentsline {subsubsection}{\numberline {2.2.1}RGB}{12}{subsubsection.2.2.1}% -\contentsline {subsubsection}{\numberline {2.2.2}HSV}{13}{subsubsection.2.2.2}% -\contentsline {subsection}{\numberline {2.3}Segmentierung und Bildmodifizierung}{14}{subsection.2.3}% -\contentsline {subsubsection}{\numberline {2.3.1}Statisches Schwellwertverfahren}{14}{subsubsection.2.3.1}% -\contentsline {subsubsection}{\numberline {2.3.2}Bin\"armaske}{15}{subsubsection.2.3.2}% -\contentsline {subsubsection}{\numberline {2.3.3}Bildmodifizierung}{15}{subsubsection.2.3.3}% -\contentsline {section}{\numberline {3}Zusammenfassung}{17}{section.3}% +\contentsline {subsubsection}{\numberline {2.1.2}Histogramm Spreizung}{12}{subsubsection.2.1.2}% +\contentsline {subsection}{\numberline {2.2}Farbanalyse}{14}{subsection.2.2}% +\contentsline {subsubsection}{\numberline {2.2.1}RGB}{14}{subsubsection.2.2.1}% +\contentsline {subsubsection}{\numberline {2.2.2}HSV}{19}{subsubsection.2.2.2}% +\contentsline {subsection}{\numberline {2.3}Segmentierung und Bildmodifizierung}{25}{subsection.2.3}% +\contentsline {subsubsection}{\numberline {2.3.1}Statisches Schwellwertverfahren}{25}{subsubsection.2.3.1}% +\contentsline {subsubsection}{\numberline {2.3.2}Bin\"armaske}{26}{subsubsection.2.3.2}% +\contentsline {subsubsection}{\numberline {2.3.3}Bildmodifizierung}{27}{subsubsection.2.3.3}% +\contentsline {section}{\numberline {3}Zusammenfassung}{29}{section.3}% diff --git a/Abgabe/fig/Endergebnis.png b/Abgabe/fig/Endergebnis.png new file mode 100644 index 0000000..a8c49fc Binary files /dev/null and b/Abgabe/fig/Endergebnis.png differ diff --git a/Abgabe/fig/hist_b_1.png b/Abgabe/fig/hist_b_1.png new file mode 100644 index 0000000..75b44eb Binary files /dev/null and b/Abgabe/fig/hist_b_1.png differ diff --git a/Abgabe/fig/hist_b_2.png b/Abgabe/fig/hist_b_2.png new file mode 100644 index 0000000..098034a Binary files /dev/null and b/Abgabe/fig/hist_b_2.png differ diff --git a/Abgabe/fig/hist_g_1.png b/Abgabe/fig/hist_g_1.png new file mode 100644 index 0000000..5b903f9 Binary files /dev/null and b/Abgabe/fig/hist_g_1.png differ diff --git a/Abgabe/fig/hist_g_2.png b/Abgabe/fig/hist_g_2.png new file mode 100644 index 0000000..f0282a0 Binary files /dev/null and b/Abgabe/fig/hist_g_2.png differ diff --git a/Abgabe/fig/hist_hsv_H_20250630-190409.png b/Abgabe/fig/hist_hsv_H_20250630-190409.png new file mode 100644 index 0000000..c851bd0 Binary files /dev/null and b/Abgabe/fig/hist_hsv_H_20250630-190409.png differ diff --git a/Abgabe/fig/hist_hsv_H_20250630-190511.png b/Abgabe/fig/hist_hsv_H_20250630-190511.png new file mode 100644 index 0000000..cc4368c Binary files /dev/null and b/Abgabe/fig/hist_hsv_H_20250630-190511.png differ diff --git a/Abgabe/fig/hist_hsv_S_20250630-190409.png b/Abgabe/fig/hist_hsv_S_20250630-190409.png new file mode 100644 index 0000000..44e1ed0 Binary files /dev/null and b/Abgabe/fig/hist_hsv_S_20250630-190409.png differ diff --git a/Abgabe/fig/hist_hsv_S_20250630-190511.png b/Abgabe/fig/hist_hsv_S_20250630-190511.png new file mode 100644 index 0000000..1c0a841 Binary files /dev/null and b/Abgabe/fig/hist_hsv_S_20250630-190511.png differ diff --git a/Abgabe/fig/hist_hsv_V_20250630-190409.png b/Abgabe/fig/hist_hsv_V_20250630-190409.png new file mode 100644 index 0000000..31e68df Binary files /dev/null and b/Abgabe/fig/hist_hsv_V_20250630-190409.png differ diff --git a/Abgabe/fig/hist_hsv_V_20250630-190511.png b/Abgabe/fig/hist_hsv_V_20250630-190511.png new file mode 100644 index 0000000..15d7ea0 Binary files /dev/null and b/Abgabe/fig/hist_hsv_V_20250630-190511.png differ diff --git a/Abgabe/fig/hist_r_1.png b/Abgabe/fig/hist_r_1.png new file mode 100644 index 0000000..68233e6 Binary files /dev/null and b/Abgabe/fig/hist_r_1.png differ diff --git a/Abgabe/fig/hist_r_2.png b/Abgabe/fig/hist_r_2.png new file mode 100644 index 0000000..b11e11d Binary files /dev/null and b/Abgabe/fig/hist_r_2.png differ diff --git a/Abgabe/fig/screenshot_1.png b/Abgabe/fig/screenshot_1.png new file mode 100644 index 0000000..0502860 Binary files /dev/null and b/Abgabe/fig/screenshot_1.png differ diff --git a/Abgabe/fig/screenshot_2.png b/Abgabe/fig/screenshot_2.png new file mode 100644 index 0000000..275567f Binary files /dev/null and b/Abgabe/fig/screenshot_2.png differ diff --git a/Abgabe/fig/screenshot_20250630-190409.png b/Abgabe/fig/screenshot_20250630-190409.png new file mode 100644 index 0000000..496e9a9 Binary files /dev/null and b/Abgabe/fig/screenshot_20250630-190409.png differ diff --git a/Abgabe/fig/screenshot_20250630-190511.png b/Abgabe/fig/screenshot_20250630-190511.png new file mode 100644 index 0000000..742deba Binary files /dev/null and b/Abgabe/fig/screenshot_20250630-190511.png differ diff --git a/Abgabe/sections/a.aux b/Abgabe/sections/a.aux index d2c16ec..7a13229 100644 --- a/Abgabe/sections/a.aux +++ b/Abgabe/sections/a.aux @@ -23,7 +23,7 @@ \setcounter{table}{1} \setcounter{currfiledepth}{0} \setcounter{CurrentPage}{10} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{1} @@ -31,7 +31,7 @@ \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{4} \setcounter{lstnumber}{10} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{2} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1} diff --git a/Abgabe/sections/a1.aux b/Abgabe/sections/a1.aux index 0b975bf..746f606 100644 --- a/Abgabe/sections/a1.aux +++ b/Abgabe/sections/a1.aux @@ -2,14 +2,14 @@ \providecommand\hyper@newdestlabel[2]{} \@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Vorverarbeitung}{10}{subsection.2.1}\protected@file@percent } \@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Rauschreduktion}{10}{subsubsection.2.1.1}\protected@file@percent } -\newlabel{lst:code1}{{3}{10}{Vorverarbeitung, Aufgabe 1}{lstlisting.3}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Vorverarbeitung, Aufgabe 1}{10}{lstlisting.3}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.2}Histogramm Spreizung}{11}{subsubsection.2.1.2}\protected@file@percent } -\newlabel{equ:histogramm-equalization}{{3}{11}{Histogramm Spreizung}{equation.2.3}{}} -\newlabel{lst:code1}{{4}{11}{Vorverarbeitung, Aufgabe 4}{lstlisting.4}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}Vorverarbeitung, Aufgabe 4}{11}{lstlisting.4}\protected@file@percent } +\newlabel{lst:code1}{{3}{11}{Vorverarbeitung, Aufgabe 1}{lstlisting.3}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {3}Vorverarbeitung, Aufgabe 1}{11}{lstlisting.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.2}Histogramm Spreizung}{12}{subsubsection.2.1.2}\protected@file@percent } +\newlabel{equ:histogramm-equalization}{{3}{12}{Histogramm Spreizung}{equation.2.3}{}} +\newlabel{lst:code1}{{4}{12}{Vorverarbeitung, Aufgabe 4}{lstlisting.4}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {4}Vorverarbeitung, Aufgabe 4}{12}{lstlisting.4}\protected@file@percent } \@setckpt{sections/a1}{ -\setcounter{page}{12} +\setcounter{page}{14} \setcounter{equation}{3} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -27,18 +27,18 @@ \setcounter{figure}{5} \setcounter{table}{1} \setcounter{currfiledepth}{0} -\setcounter{CurrentPage}{12} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{CurrentPage}{14} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{3} \setcounter{Item}{0} \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{7} -\setcounter{lstnumber}{2} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{lstnumber}{20} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{4} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1} -\setcounter{pagesLTS.current.local.arabic}{12} +\setcounter{pagesLTS.current.local.arabic}{14} } diff --git a/Abgabe/sections/a1.tex b/Abgabe/sections/a1.tex index 8694c7d..77fd6d9 100644 --- a/Abgabe/sections/a1.tex +++ b/Abgabe/sections/a1.tex @@ -25,20 +25,75 @@ Implementieren Sie die Mittelwertbildung mit einer variablem Bildreihe $N$ (defa Um zu prüfen wie das Bild auf Pixelebene arbeitet, kann die Variable \textit{plotNoise} in der Funktion \textit{process()} auf \textit{True} gesetzt werden. Es werden zwei zusätzliche Plots ausgegeben, in der ein Bildausschnitt des Zentrums vor- und nach der Rauschunterdrückung vergrößert dargestellt werden. +\pagebreak \paragraph*{Aufgabe 1} Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Bereiche an! \lstset{caption={Vorverarbeitung, Aufgabe 1}} \begin{lstlisting} -# Your code! +def _211_Rauschreduktion(self, img): + self.picture_buffer.append(img) + + if len(self.picture_buffer) < self.n: + # If number of buffered images < defined buffer size n, + # return current image + return img + elif len(self.picture_buffer) > self.n: + # If number of buffered images > defined buffer size n, + # remove oldest image + self.picture_buffer.pop(0) + + # Reduce noise, return result image + return np.mean(self.picture_buffer, axis=0).astype(np.uint8) \end{lstlisting} \paragraph*{Aufgabe 2} Nennen Sie Vor und Nachteile, wenn $N$ vergrößert werden würde. Sollte $N$ in dieser Anwendung vergrößert werden? +\color{blue} +Vorteile: + +\begin{itemize} + \item Je größer die Anzahl der Bilder N, desto besser kann das Rauschen verringert werden + \item Gut für statische Szenen +\end{itemize} + +Nachteile: + +\begin{itemize} + \item Höherer Speicheraufwand + \item Höheres N folgt in mehr zeit um den Mittelwert zu berechnen + \item Bewegungen werden verschmiert +\end{itemize} + +\color{black} + \paragraph*{Aufgabe 3} Beschreiben Sie eine weitere Methode zur Rauschreduktion. Diskutieren Sie dabei Vor- oder Nachteile! +\color{blue} + +Wiener-Filter + +Vorteile: + +\begin{itemize} + \item Bessere Ergebnisse als ein Mittelwert-Filter + \item Bewegungen werden nicht verschmiert, da nur ein Bild benötigt wird +\end{itemize} + + +Nachteile: + +\begin{itemize} + \item Mathematisch aufwendiger + \item Abhängig von Annahme der Rauschart +\end{itemize} + + +\color{black} + + \subsubsection{Histogramm Spreizung} Pixel können in unserer Anwendung Werte von $I_k(x,y) \in \{ 0, \ldots , 255 \}$ annehmen. Dieser Wertebereich wird nicht zwangsläufig ausgenutzt. Um das zu ändern, soll eine Histogramm Spreizung auf den Helligkeitsinformationen der Pixel durchgeführt werden. @@ -56,8 +111,33 @@ I_V^{\textnormal{new}}(x,y) = \frac{I_{V}(x,y) - \min I_{V}}{\max I_{V} - \min I Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Bereiche an! \lstset{caption={Vorverarbeitung, Aufgabe 4}} \begin{lstlisting} -# Your code! +def _212_HistogrammSpreizung(self, img): + # Convert brg image to hsv image + hsv_image = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) + + # Get hsv parts + h, s, v = cv2.split(hsv_image) + + # Calc histogram spread + v = cv2.equalizeHist(v) + + # Merge histogram spread to image + hsv_stretched = cv2.merge([h, s, v]) + + # Convert hsv image to brg and store result to member variable + self.middle_value_picture = cv2.cvtColor(hsv_stretched, + cv2.COLOR_HSV2BGR) + + # Return brg result image + return self.middle_value_picture \end{lstlisting} \paragraph*{Aufgabe 5} -Warum ist es sinnvoll, den gesamten Wertebereich für die Darstellung von Videos in Multimedia-Anwendungen auszunutzen? \ No newline at end of file +Warum ist es sinnvoll, den gesamten Wertebereich für die Darstellung von Videos in Multimedia-Anwendungen auszunutzen? + +\color{blue} + +Damit wird der Kontrast des Bildes verbessert. Das kann eine Hilfe beim +Schwellwertverfahren sein. + +\color{black} \ No newline at end of file diff --git a/Abgabe/sections/a2.aux b/Abgabe/sections/a2.aux index f87e3ed..e175ca1 100644 --- a/Abgabe/sections/a2.aux +++ b/Abgabe/sections/a2.aux @@ -1,15 +1,47 @@ \relax \providecommand\hyper@newdestlabel[2]{} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Farbanalyse}{12}{subsection.2.2}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.1}RGB}{12}{subsubsection.2.2.1}\protected@file@percent } -\newlabel{lst:Histogramm}{{5}{12}{Histogrammberechnung mit \textit {matplotlib}}{lstlisting.5}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}Histogrammberechnung mit \textit {matplotlib}}{12}{lstlisting.5}\protected@file@percent } -\newlabel{lst:code1}{{6}{13}{Farbanalyse, Aufgabe 1}{lstlisting.6}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}Farbanalyse, Aufgabe 1}{13}{lstlisting.6}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.2}HSV}{13}{subsubsection.2.2.2}\protected@file@percent } -\newlabel{equ:segrule}{{5}{13}{Aufgabe 5}{equation.2.5}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Farbanalyse}{14}{subsection.2.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.1}RGB}{14}{subsubsection.2.2.1}\protected@file@percent } +\newlabel{lst:Histogramm}{{5}{14}{Histogrammberechnung mit \textit {matplotlib}}{lstlisting.5}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {5}Histogrammberechnung mit \textit {matplotlib}}{14}{lstlisting.5}\protected@file@percent } +\newlabel{lst:code1}{{6}{15}{Farbanalyse, Aufgabe 1}{lstlisting.6}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {6}Farbanalyse, Aufgabe 1}{15}{lstlisting.6}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {6}{\ignorespaces Histogram B-Kanal ohne Umhang}}{15}{figure.6}\protected@file@percent } +\newlabel{fig:histogram-b-kanal-ohne}{{6}{15}{Histogram B-Kanal ohne Umhang}{figure.6}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {7}{\ignorespaces Histogram B-Kanal mit Umhang}}{16}{figure.7}\protected@file@percent } +\newlabel{fig:histogram-b-kanal-mit}{{7}{16}{Histogram B-Kanal mit Umhang}{figure.7}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {8}{\ignorespaces Histogram G-Kanal ohne Umhang}}{16}{figure.8}\protected@file@percent } +\newlabel{fig:histogram-g-kanal-ohne}{{8}{16}{Histogram G-Kanal ohne Umhang}{figure.8}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {9}{\ignorespaces Histogram G-Kanal mit Umhang}}{17}{figure.9}\protected@file@percent } +\newlabel{fig:histogram-g-kanal-mit}{{9}{17}{Histogram G-Kanal mit Umhang}{figure.9}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {10}{\ignorespaces Histogram R-Kanal ohne Umhang}}{17}{figure.10}\protected@file@percent } +\newlabel{fig:histogram-r-kanal-ohne}{{10}{17}{Histogram R-Kanal ohne Umhang}{figure.10}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {11}{\ignorespaces Histogram R-Kanal mit Umhang}}{18}{figure.11}\protected@file@percent } +\newlabel{fig:histogram-r-kanal-mit}{{11}{18}{Histogram R-Kanal mit Umhang}{figure.11}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {12}{\ignorespaces Foto ohne Umhang}}{18}{figure.12}\protected@file@percent } +\newlabel{fig:histogram-foto-ohne-umhang}{{12}{18}{Foto ohne Umhang}{figure.12}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {13}{\ignorespaces Foto mit Umhang}}{19}{figure.13}\protected@file@percent } +\newlabel{fig:histogram-foto-mit-umhang}{{13}{19}{Foto mit Umhang}{figure.13}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.2.2}HSV}{19}{subsubsection.2.2.2}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {14}{\ignorespaces Histogram H-Kanal ohne Umhang}}{20}{figure.14}\protected@file@percent } +\newlabel{fig:histogram-h-kanal-ohne}{{14}{20}{Histogram H-Kanal ohne Umhang}{figure.14}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {15}{\ignorespaces Histogram H-Kanal mit Umhang}}{20}{figure.15}\protected@file@percent } +\newlabel{fig:histogram-h-kanal-mit}{{15}{20}{Histogram H-Kanal mit Umhang}{figure.15}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {16}{\ignorespaces Histogram S-Kanal ohne Umhang}}{21}{figure.16}\protected@file@percent } +\newlabel{fig:histogram-s-kanal-ohne}{{16}{21}{Histogram S-Kanal ohne Umhang}{figure.16}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {17}{\ignorespaces Histogram S-Kanal mit Umhang}}{21}{figure.17}\protected@file@percent } +\newlabel{fig:histogram-s-kanal-mit}{{17}{21}{Histogram S-Kanal mit Umhang}{figure.17}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {18}{\ignorespaces Histogram V-Kanal ohne Umhang}}{22}{figure.18}\protected@file@percent } +\newlabel{fig:histogram-v-kanal-ohne}{{18}{22}{Histogram V-Kanal ohne Umhang}{figure.18}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {19}{\ignorespaces Histogram V-Kanal mit Umhang}}{22}{figure.19}\protected@file@percent } +\newlabel{fig:histogram-v-kanal-mit}{{19}{22}{Histogram V-Kanal mit Umhang}{figure.19}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {20}{\ignorespaces Foto ohne Umhang}}{23}{figure.20}\protected@file@percent } +\newlabel{fig:histogram-foto-ohne-umhang2}{{20}{23}{Foto ohne Umhang}{figure.20}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {21}{\ignorespaces Foto mit Umhang}}{23}{figure.21}\protected@file@percent } +\newlabel{fig:histogram-foto-mit-umhang2}{{21}{23}{Foto mit Umhang}{figure.21}{}} +\newlabel{equ:segrule}{{5}{24}{Aufgabe 5}{equation.2.5}{}} \@setckpt{sections/a2}{ -\setcounter{page}{14} +\setcounter{page}{25} \setcounter{equation}{5} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -24,21 +56,21 @@ \setcounter{subsubsection}{2} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} -\setcounter{figure}{5} +\setcounter{figure}{21} \setcounter{table}{1} \setcounter{currfiledepth}{0} -\setcounter{CurrentPage}{14} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{CurrentPage}{25} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{3} \setcounter{Item}{0} \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{10} -\setcounter{lstnumber}{2} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{lstnumber}{15} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{6} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1} -\setcounter{pagesLTS.current.local.arabic}{14} +\setcounter{pagesLTS.current.local.arabic}{25} } diff --git a/Abgabe/sections/a2.tex b/Abgabe/sections/a2.tex index c61bf5e..a5a8e23 100644 --- a/Abgabe/sections/a2.tex +++ b/Abgabe/sections/a2.tex @@ -37,21 +37,160 @@ Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Be \lstset{caption={Farbanalyse, Aufgabe 1}} \begin{lstlisting} -# Your code! +def _221_RGB(self, img, colorspectrum = "bgr"): + # Names of the colors in histogram + channels = ["b", "g", "r"] + + # Calc histogram + for index, channel_name in enumerate(channels): + hist = cv2.calcHist([img], [index], None, [256], [0, 256]) + plt.plot(hist, color=channel_name) + plt.xlim([0, 256]) + + # Save histogram, clear cache + plt.savefig(f"results/{datetime.datetime.now() + .strftime('%Y-%m-%d_%H:%M:%S')}_histogram_{colorspectrum}.png") + plt.clf() \end{lstlisting} +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_b_1.png} + \caption{Histogram B-Kanal ohne Umhang} + \label{fig:histogram-b-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_b_2.png} + \caption{Histogram B-Kanal mit Umhang} + \label{fig:histogram-b-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_g_1.png} + \caption{Histogram G-Kanal ohne Umhang} + \label{fig:histogram-g-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_g_2.png} + \caption{Histogram G-Kanal mit Umhang} + \label{fig:histogram-g-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_r_1.png} + \caption{Histogram R-Kanal ohne Umhang} + \label{fig:histogram-r-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_r_2.png} + \caption{Histogram R-Kanal mit Umhang} + \label{fig:histogram-r-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/screenshot_1.png} + \caption{Foto ohne Umhang} + \label{fig:histogram-foto-ohne-umhang} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/screenshot_2.png} + \caption{Foto mit Umhang} + \label{fig:histogram-foto-mit-umhang} +\end{figure} + \paragraph*{Aufgabe 2} Interpretieren Sie die Veränderungen zwischen den Histogrammen mit und ohne \glqq magischen Umhang\grqq . Verhalten sich die einzelnen Kanäle gleich? Lassen sich Bereiche in den Histogrammen herausstellen, die dem Umhang zuzuordnen sind? Diskutieren Sie Ihre Beobachtungen. +\color{blue} + +Im Bild mit dem Umhang ist im Vergleich zu dem Bild ohne Umhang ein leichter Blaustich zu erkennen. Das könnte den Anstieg der Anzahl der grünen und blauen Intensitäten im Bereich 50 bis 100 erklären. Im Histogramm der Farbe rot lässt sich ein Bereich zwischen 200 und 250 erkennen, der der Umhang sein könnte. Ansonsten sehen Histogramme mit und ohne Umhang sehr ähnlich aus, +was auch zu erwarten war und erwünscht ist. + +\color{black} + \subsubsection{HSV} Erweitern Sie ihren vorherigen Code um eine Farbkonvertierung in den HSV-Farbraum. Führen Sie die Konvertierung vor Erstellung der Histogramme durch und wiederholen Sie die Schritte aus dem vorherigen Aufgabenteil. \paragraph*{Aufgabe 3} Geben sie die aufgenommenen Bilder und die erstellten Histogramme an. +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_H_20250630-190409.png} + \caption{Histogram H-Kanal ohne Umhang} + \label{fig:histogram-h-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_H_20250630-190511.png} + \caption{Histogram H-Kanal mit Umhang} + \label{fig:histogram-h-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_S_20250630-190409.png} + \caption{Histogram S-Kanal ohne Umhang} + \label{fig:histogram-s-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_S_20250630-190511.png} + \caption{Histogram S-Kanal mit Umhang} + \label{fig:histogram-s-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_V_20250630-190409.png} + \caption{Histogram V-Kanal ohne Umhang} + \label{fig:histogram-v-kanal-ohne} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/hist_hsv_V_20250630-190511.png} + \caption{Histogram V-Kanal mit Umhang} + \label{fig:histogram-v-kanal-mit} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/screenshot_20250630-190409.png} + \caption{Foto ohne Umhang} + \label{fig:histogram-foto-ohne-umhang2} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/screenshot_20250630-190511.png} + \caption{Foto mit Umhang} + \label{fig:histogram-foto-mit-umhang2} +\end{figure} + \paragraph*{Aufgabe 4} Interpretieren Sie die Veränderungen zwischen den Histogrammen mit und ohne \glqq magischen Umhang\grqq . Verhalten sich die einzelnen Kanäle gleich? Lassen sich Bereiche in den Histogrammen herausstellen, die dem Umhang zuzuordnen sind? Diskutieren Sie Ihre Beobachtungen. +\color{blue} + +Im H-Kanal ist ein guter Spike um den Wert 175 zu erkennen, nach Verwendung des Umhangs, was etwa 350 Grad entspricht und somit der +Farbe rot-orangener Bereich. Auch ein Anstieg im Bereich 0 Grad ist zu erkennen was dem reinen rot entspricht. Die Farbe rot bzw. der Umhang lässt sich also im Farbwertkanal gut erkennen. Der Sättigungs- und Helligkeitskanal sind in dieser Aufgabe eher irrelevant, da es nur um die Farbe geht. + +\color{black} + \paragraph*{Aufgabe 5} Versuchen Sie mit den gegebenen Histogrammen Wertebereiche zu finden, mit denen Sie den \glqq magischen Umhang\grqq\ segmentieren könnten. Formulieren Sie eine Regel in dem Format \begin{equation} @@ -60,5 +199,18 @@ Versuchen Sie mit den gegebenen Histogrammen Wertebereiche zu finden, mit denen \end{equation} wobei $S_\textnormal{Umhang}$ die Binärmaske beschreibt und $R_\textnormal{min}$ und $R_\textnormal{max}$ beispielhafte Schwellwerte für den Rot-Kanal sind. +\color{blue} +Für den RGB-Raum wäre das 200-250 für den Rot-Kanal + + +Für den HSV-Raum wäre das 160-200 für den H-Kanal + +\color{black} + \paragraph*{Aufgabe 6} -Worauf muss geachtet werden, wenn mit dem H-Kanal des HSV-Farbraums gearbeitet wird? \ No newline at end of file +Worauf muss geachtet werden, wenn mit dem H-Kanal des HSV-Farbraums gearbeitet wird? + +\color{blue} +H (Hue) ist zirkulär: Rot ist bei 0 und 360 Grad! + +\color{black} \ No newline at end of file diff --git a/Abgabe/sections/a3.aux b/Abgabe/sections/a3.aux index 0902b3e..7f48823 100644 --- a/Abgabe/sections/a3.aux +++ b/Abgabe/sections/a3.aux @@ -1,21 +1,23 @@ \relax \providecommand\hyper@newdestlabel[2]{} -\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Segmentierung und Bildmodifizierung}{14}{subsection.2.3}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.1}Statisches Schwellwertverfahren}{14}{subsubsection.2.3.1}\protected@file@percent } -\newlabel{lst:conditions}{{7}{14}{Benutzung von Randbedingungen mit \textit {numpy}}{lstlisting.7}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {7}Benutzung von Randbedingungen mit \textit {numpy}}{14}{lstlisting.7}\protected@file@percent } -\newlabel{lst:code1}{{8}{14}{Segmentierung und Bildmodifizierung, Aufgabe 1}{lstlisting.8}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {8}Segmentierung und Bildmodifizierung, Aufgabe 1}{14}{lstlisting.8}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.2}Bin\"armaske}{15}{subsubsection.2.3.2}\protected@file@percent } -\newlabel{lst:contours}{{9}{15}{Konturfindung}{lstlisting.9}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {9}Konturfindung}{15}{lstlisting.9}\protected@file@percent } -\newlabel{lst:contours}{{10}{15}{Segmentierung und Bildmodifizierung, Aufgabe 2}{lstlisting.10}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {10}Segmentierung und Bildmodifizierung, Aufgabe 2}{15}{lstlisting.10}\protected@file@percent } -\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.3}Bildmodifizierung}{15}{subsubsection.2.3.3}\protected@file@percent } -\newlabel{lst:contours}{{11}{16}{Segmentierung und Bildmodifizierung, Aufgabe 4}{lstlisting.11}{}} -\@writefile{lol}{\contentsline {lstlisting}{\numberline {11}Segmentierung und Bildmodifizierung, Aufgabe 4}{16}{lstlisting.11}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Segmentierung und Bildmodifizierung}{25}{subsection.2.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.1}Statisches Schwellwertverfahren}{25}{subsubsection.2.3.1}\protected@file@percent } +\newlabel{lst:conditions}{{7}{25}{Benutzung von Randbedingungen mit \textit {numpy}}{lstlisting.7}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {7}Benutzung von Randbedingungen mit \textit {numpy}}{25}{lstlisting.7}\protected@file@percent } +\newlabel{lst:code1}{{8}{25}{Segmentierung und Bildmodifizierung, Aufgabe 1}{lstlisting.8}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {8}Segmentierung und Bildmodifizierung, Aufgabe 1}{25}{lstlisting.8}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.2}Bin\"armaske}{26}{subsubsection.2.3.2}\protected@file@percent } +\newlabel{lst:contours}{{9}{26}{Konturfindung}{lstlisting.9}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {9}Konturfindung}{26}{lstlisting.9}\protected@file@percent } +\newlabel{lst:contours}{{10}{26}{Segmentierung und Bildmodifizierung, Aufgabe 2}{lstlisting.10}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {10}Segmentierung und Bildmodifizierung, Aufgabe 2}{26}{lstlisting.10}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.3.3}Bildmodifizierung}{27}{subsubsection.2.3.3}\protected@file@percent } +\newlabel{lst:contours}{{11}{27}{Segmentierung und Bildmodifizierung, Aufgabe 4}{lstlisting.11}{}} +\@writefile{lol}{\contentsline {lstlisting}{\numberline {11}Segmentierung und Bildmodifizierung, Aufgabe 4}{27}{lstlisting.11}\protected@file@percent } +\@writefile{lof}{\contentsline {figure}{\numberline {22}{\ignorespaces Endergebnis}}{28}{figure.22}\protected@file@percent } +\newlabel{fig:histogram-endergebnis}{{22}{28}{Endergebnis}{figure.22}{}} \@setckpt{sections/a3}{ -\setcounter{page}{17} +\setcounter{page}{29} \setcounter{equation}{5} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -30,21 +32,21 @@ \setcounter{subsubsection}{3} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} -\setcounter{figure}{5} +\setcounter{figure}{22} \setcounter{table}{1} \setcounter{currfiledepth}{0} -\setcounter{CurrentPage}{17} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{CurrentPage}{29} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{3} \setcounter{Item}{0} \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{14} -\setcounter{lstnumber}{2} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{lstnumber}{20} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{11} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1} -\setcounter{pagesLTS.current.local.arabic}{17} +\setcounter{pagesLTS.current.local.arabic}{29} } diff --git a/Abgabe/sections/a3.tex b/Abgabe/sections/a3.tex index 5f5106b..1ef6d37 100644 --- a/Abgabe/sections/a3.tex +++ b/Abgabe/sections/a3.tex @@ -31,7 +31,24 @@ Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Be \lstset{caption={Segmentierung und Bildmodifizierung, Aufgabe 1}} \begin{lstlisting} -# Your code! +def _23_SegmentUndBildmodifizierung (self, img, save_binary_mask = False): + # Convert BGR -> HSV + hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) + + # Area 1: H = 0-10 (strong Rot) + lower_red1 = np.array([0, 100, 50]) + upper_red1 = np.array([0, 255, 255]) + + # Area 2: H = 169-179 (red-violet) + lower_red2 = np.array([171, 100, 50]) + upper_red2 = np.array([179, 255, 255]) + + # Create binary mask for both red areas + mask1 = cv2.inRange(hsv, lower_red1, upper_red1) + mask2 = cv2.inRange(hsv, lower_red2, upper_red2) + + # Combine both masks + mask = cv2.bitwise_or(mask1, mask2) \end{lstlisting} \subsubsection{Binärmaske} @@ -52,12 +69,36 @@ img = cv2.drawContours(img, [c], -1, color=255, -1) Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Bereiche an! \lstset{caption={Segmentierung und Bildmodifizierung, Aufgabe 2}} \begin{lstlisting} -# Your code! +def _23_SegmentUndBildmodifizierung (self, img, save_binary_mask = False): + # ... + + # Optimizing mask with opening and closing + kernel = np.ones((5, 5), np.uint8) + + mask = cv2.morphologyEx(mask, cv2.MORPH_OPEN, kernel) + mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel) + + # Select biggest connected area + cnts, _ = cv2.findContours(mask, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) + + if cnts: + c = max(cnts, key=cv2.contourArea) + new_mask = np.zeros_like(mask) + cv2.drawContours(new_mask, [c], -1, color = 255, thickness = -1) + mask = new_mask + else: + mask = np.zeros_like(mask) \end{lstlisting} \paragraph*{Aufgabe 3} Welche Probleme oder Fehler können in der Binärmaske vorkommen, die mit den Maßnahmen beseitigt werden sollen? +\color{blue} + +Durch das Opening und Closing können sich zwei Bereiche miteinander verbinden, die jedoch nicht zusammengehören. Die Wahl des größten zusammenhängenden Segments kann relevante Bereiche auch einfach auslassen, wenn das Opening und Closing diesen nicht zu größten Bereich zusammengeführt hat. + +\color{black} + \subsubsection{Bildmodifizierung} Nach dem Fertigstellen der vorherigen Aufgabenstellungen sollten Sie nun eine Binärmaske erhalten, welche den \glqq magischen Umhang\grqq\ segmentiert. Die letzte Aufgabe befasst sich mit der Bildmodifizierung, welche den Eindruck verschwindender Objekte vermittelt. @@ -74,8 +115,33 @@ Solange kein Bild in der Variable gespeichert ist, soll das Eingangsbild direkt Geben Sie Ihren Code an und beschreiben Sie ihn. Geben Sie nur relevante Code Bereiche an! \lstset{caption={Segmentierung und Bildmodifizierung, Aufgabe 4}} \begin{lstlisting} -# Your code! +def _23_SegmentUndBildmodifizierung (self, img, save_binary_mask = False): + # ... + + # Return image if no background is set + if self.background is None: + return img + + # 3-channel mask for binary operations + mask_3ch = cv2.cvtColor(mask, cv2.COLOR_GRAY2BGR) + + # Background are: Get from save background image + background_part = cv2.bitwise_and(self.background, mask_3ch) + + # Foreground area: Extract from current image + foreground_part = cv2.bitwise_and(img, cv2.bitwise_not(mask_3ch)) + + # Merge both areas + output = cv2.add(background_part, foreground_part) + return output \end{lstlisting} \paragraph*{Aufgabe 5} -Geben Sie ein Bild (z.B. Screenshot) an, in dem die Funktion Ihres \glqq magischen Umhangs\grqq\ gezeigt wird! \ No newline at end of file +Geben Sie ein Bild (z.B. Screenshot) an, in dem die Funktion Ihres \glqq magischen Umhangs\grqq\ gezeigt wird! + +\begin{figure} + \centering + \includegraphics[width=10cm]{fig/Endergebnis.png} + \caption{Endergebnis} + \label{fig:histogram-endergebnis} +\end{figure} \ No newline at end of file diff --git a/Abgabe/sections/conclusion.aux b/Abgabe/sections/conclusion.aux index 9546804..c49aa58 100644 --- a/Abgabe/sections/conclusion.aux +++ b/Abgabe/sections/conclusion.aux @@ -1,8 +1,8 @@ \relax \providecommand\hyper@newdestlabel[2]{} -\@writefile{toc}{\contentsline {section}{\numberline {3}Zusammenfassung}{17}{section.3}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}Zusammenfassung}{29}{section.3}\protected@file@percent } \@setckpt{sections/conclusion}{ -\setcounter{page}{18} +\setcounter{page}{30} \setcounter{equation}{5} \setcounter{enumi}{0} \setcounter{enumii}{0} @@ -17,21 +17,21 @@ \setcounter{subsubsection}{0} \setcounter{paragraph}{0} \setcounter{subparagraph}{0} -\setcounter{figure}{5} +\setcounter{figure}{22} \setcounter{table}{1} \setcounter{currfiledepth}{0} -\setcounter{CurrentPage}{18} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{CurrentPage}{30} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{1} \setcounter{Item}{0} \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{15} -\setcounter{lstnumber}{2} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{lstnumber}{20} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{11} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1} -\setcounter{pagesLTS.current.local.arabic}{18} +\setcounter{pagesLTS.current.local.arabic}{30} } diff --git a/Abgabe/sections/overview.aux b/Abgabe/sections/overview.aux index 1152be7..3e143ef 100644 --- a/Abgabe/sections/overview.aux +++ b/Abgabe/sections/overview.aux @@ -38,7 +38,7 @@ \setcounter{table}{1} \setcounter{currfiledepth}{0} \setcounter{CurrentPage}{8} -\setcounter{pagesLTS.pagenr}{17} +\setcounter{pagesLTS.pagenr}{29} \setcounter{pagesLTS.current.local.0}{1} \setcounter{pagesLTS.pnc.0}{0} \setcounter{section@level}{2} @@ -46,7 +46,7 @@ \setcounter{Hfootnote}{2} \setcounter{bookmark@seq@number}{3} \setcounter{lstnumber}{10} -\setcounter{pagesLTS.arabic.1.local.cnt}{17} +\setcounter{pagesLTS.arabic.1.local.cnt}{29} \setcounter{lstlisting}{2} \setcounter{pagesLTS.pnc.arabic}{1} \setcounter{pagesLTS.double.arabic}{1}