Initial commit with project files
This commit is contained in:
22
4_Farbrepräsentationen/ü3/README.md
Normal file
22
4_Farbrepräsentationen/ü3/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Übung 3: Binärbild Repräsentationen
|
||||
|
||||
In dieser Übung werden Darstellungsformen von Binärbildern betrachtet. Sie lernen Binär und Quaternärbäume kennen.
|
||||
|
||||
|
||||
## Aufgabe a) Binärbaum
|
||||
Gegeben ist folgender Binärbaum:
|
||||
|
||||

|
||||
|
||||
Rekonstruieren Sie die Bildzeile, die durch den Binärbaum dargestellt wird.
|
||||
Sie können die Aufgabe mit Papier und Stift erledigen. Die Lösung wird in dem Skript *l_a.py* visualisiert.
|
||||
|
||||
## Aufgabe b) Quaternärbaum
|
||||
Gegeben ist folgender Quaternärbaum (Quadtree) mit einer Zuordnung der vier Quadranten:
|
||||

|
||||
|
||||
Rekonstruieren Sie das Binärbild, die durch den Quaternärbaum dargestellt wird.
|
||||
Sie können die Aufgabe mit Papier und Stift erledigen. Die Lösung wird in dem Skript *l_b.py* visualisiert.
|
||||
|
||||
|
||||
|
||||
BIN
4_Farbrepräsentationen/ü3/data/binary_tree.png
Normal file
BIN
4_Farbrepräsentationen/ü3/data/binary_tree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
BIN
4_Farbrepräsentationen/ü3/data/quad_tree.png
Normal file
BIN
4_Farbrepräsentationen/ü3/data/quad_tree.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
16
4_Farbrepräsentationen/ü3/l_a.py
Normal file
16
4_Farbrepräsentationen/ü3/l_a.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
line = np.asarray(
|
||||
[[1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1]],
|
||||
)
|
||||
# Resize image
|
||||
line = np.repeat(line, 50, axis=1)
|
||||
line = np.repeat(line, 50, axis=0)
|
||||
# Add seperators
|
||||
line[0::2, ::50] = 1
|
||||
line[1::2, ::50] = 0
|
||||
# Show image
|
||||
line = line.astype(np.float64)
|
||||
cv2.imshow("Binaerbaum", line)
|
||||
cv2.waitKey(0)
|
||||
32
4_Farbrepräsentationen/ü3/l_b.py
Normal file
32
4_Farbrepräsentationen/ü3/l_b.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
line = np.asarray(
|
||||
[
|
||||
[1,1, 1,1, 1,1, 1,1],
|
||||
[0,0, 1,1, 1,1, 1,1],
|
||||
|
||||
[0,0, 1,1, 0,0, 0,1],
|
||||
[0,0, 1,0, 0,0, 1,1],
|
||||
|
||||
[0,0, 0,0, 0,0, 1,1],
|
||||
[0,0, 0,0, 0,0, 1,1],
|
||||
|
||||
[0,0, 0,0, 1,0, 1,1],
|
||||
[0,0, 0,0, 1,1, 1,1],
|
||||
],
|
||||
)
|
||||
# Resize image
|
||||
line = np.repeat(line, 50, axis=1)
|
||||
line = np.repeat(line, 50, axis=0)
|
||||
|
||||
# Add seperators
|
||||
line[0::2, ::50] = 1
|
||||
line[1::2, ::50] = 0
|
||||
line[::50, 0::2] = 1
|
||||
line[::50, 1::2] = 0
|
||||
|
||||
# Show image
|
||||
line = line.astype(np.float64)
|
||||
cv2.imshow("Quadtree", line)
|
||||
cv2.waitKey(0)
|
||||
Reference in New Issue
Block a user