Initial commit with project files
This commit is contained in:
39
4_Farbrepräsentationen/ü6/README.md
Normal file
39
4_Farbrepräsentationen/ü6/README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Übung 6: Additive / Subtraktive Farbmischung
|
||||
|
||||
In dieser Übung soll die Additive und Subtraktive Farbmischung betrachtet werden.
|
||||
Es soll ein simples Bild mit der Auflösung 500x300 (BxH) erstellt und angezeigt werden, in der jeweils
|
||||
von oben aufsteigend jeweils 50 Pixel in der Farbe
|
||||
- rot
|
||||
- orange
|
||||
- gelb
|
||||
- grün
|
||||
- blau
|
||||
- lila
|
||||
|
||||
In dieser Übung haben Sie die beiden Farbrepräsentationen "Additiv BGR" und "Subtraktiv BGR" zur Verfügung.
|
||||
In der folgenden Tabelle sind beide Repräsentationen dargestellt:
|
||||
|
||||
| Additiv | Subtraktiv |
|
||||
| --- | --- |
|
||||
| | |
|
||||
|
||||
Bei der Additiven Farbmischung wird eine Farbe durch das Hinzufügen von Farbe zum Komplementär Schwarz erreicht.
|
||||
Auf dem Rechner entsprechen daher höhere Werte in einem Farbkanal einer stärkeren Präsenz der Farbe im resultierenden
|
||||
Pixel.
|
||||
|
||||
Bei der Subtraktiven Farbmischung wird eine Farbe durch das Abziehen von Farbe zum Komplementär Weiß erreicht.
|
||||
Auf dem Rechner entsprechen daher höhere Werte in einem Farbkanal einer geringeren Präsenz der Farbe im resultierenden
|
||||
Pixel.
|
||||
|
||||
|
||||
## Aufgabe a)
|
||||
|
||||
In der Datei [a.py](a.py) ist ein leeres Bild vordefiniert. Ergänzen Sie die Farben, um das Bild zu vervollständigen.
|
||||
In dieser Aufgabe wird eine Farbe im additiven BGR Farbraum dargestellt. Die Musterlösung findet sich in der Datei [l_a.py](l_a.py).
|
||||
|
||||
|
||||
## Aufgabe b)
|
||||
|
||||
In der Datei [b.py](b.py) ist ein leeres Bild vordefiniert. Ergänzen Sie die Farben, um das Bild zu vervollständigen.
|
||||
In dieser Aufgabe wird eine Farbe im subtraktiven BGR Farbraum dargestellt. Die Musterlösung findet sich in der Datei [l_b.py](l_b.py).
|
||||
|
||||
14
4_Farbrepräsentationen/ü6/a.py
Normal file
14
4_Farbrepräsentationen/ü6/a.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
|
||||
from color_code import additive_color_plot
|
||||
|
||||
img = np.zeros((300, 500, 3), dtype=np.uint8)
|
||||
|
||||
img[0:50, 0:500] = [0, 0, 0]
|
||||
img[50:100, 0:500] = [0, 0, 0]
|
||||
img[100:150, 0:500] = [0, 0, 0]
|
||||
img[150:200, 0:500] = [0, 0, 0]
|
||||
img[200:250, 0:500] = [0, 0, 0]
|
||||
img[250:300, 0:500] = [0, 0, 0]
|
||||
|
||||
additive_color_plot(img)
|
||||
14
4_Farbrepräsentationen/ü6/b.py
Normal file
14
4_Farbrepräsentationen/ü6/b.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
|
||||
from color_code import subtractive_color_plot
|
||||
|
||||
img = np.zeros((300, 500, 3), dtype=np.uint8)
|
||||
|
||||
img[0:50, 0:500] = [0, 0, 0]
|
||||
img[50:100, 0:500] = [0, 0, 0]
|
||||
img[100:150, 0:500] = [0, 0, 0]
|
||||
img[150:200, 0:500] = [0, 0, 0]
|
||||
img[200:250, 0:500] = [0, 0, 0]
|
||||
img[250:300, 0:500] = [0, 0, 0]
|
||||
|
||||
subtractive_color_plot(img)
|
||||
12
4_Farbrepräsentationen/ü6/color_code.py
Normal file
12
4_Farbrepräsentationen/ü6/color_code.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import cv2
|
||||
|
||||
|
||||
def additive_color_plot(img):
|
||||
cv2.imshow("Additive", img)
|
||||
cv2.waitKey(0)
|
||||
|
||||
|
||||
def subtractive_color_plot(img):
|
||||
img = 255 - img
|
||||
cv2.imshow("Subtractive", img)
|
||||
cv2.waitKey(0)
|
||||
BIN
4_Farbrepräsentationen/ü6/data/add.png
Normal file
BIN
4_Farbrepräsentationen/ü6/data/add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
4_Farbrepräsentationen/ü6/data/sub.png
Normal file
BIN
4_Farbrepräsentationen/ü6/data/sub.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
14
4_Farbrepräsentationen/ü6/l_a.py
Normal file
14
4_Farbrepräsentationen/ü6/l_a.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
|
||||
from color_code import additive_color_plot
|
||||
|
||||
img = np.zeros((300, 500, 3), dtype=np.uint8)
|
||||
|
||||
img[0:50, 0:500] = [0, 0, 255]
|
||||
img[50:100, 0:500] = [0, 136, 255]
|
||||
img[100:150, 0:500] = [0, 255, 255]
|
||||
img[150:200, 0:500] = [0, 255, 0]
|
||||
img[200:250, 0:500] = [255, 0, 0]
|
||||
img[250:300, 0:500] = [255, 0, 136]
|
||||
|
||||
additive_color_plot(img)
|
||||
14
4_Farbrepräsentationen/ü6/l_b.py
Normal file
14
4_Farbrepräsentationen/ü6/l_b.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import numpy as np
|
||||
|
||||
from color_code import subtractive_color_plot
|
||||
|
||||
img = np.zeros((300, 500, 3), dtype=np.uint8)
|
||||
|
||||
img[0:50, 0:500] = [255, 255, 0]
|
||||
img[50:100, 0:500] = [255, 119, 0]
|
||||
img[100:150, 0:500] = [255, 0, 0]
|
||||
img[150:200, 0:500] = [255, 0, 255]
|
||||
img[200:250, 0:500] = [0, 255, 255]
|
||||
img[250:300, 0:500] = [0, 255, 119]
|
||||
|
||||
subtractive_color_plot(img)
|
||||
Reference in New Issue
Block a user