Finish 2.1.2 exercise 4
This commit is contained in:
@@ -16,6 +16,10 @@ class InvisCloak (Algorithm):
|
||||
# Picture buffer
|
||||
self.picture_buffer = []
|
||||
|
||||
# Middle value image built of buffer images
|
||||
# Includes noice reduction and histogram spread
|
||||
self.middle_value_picture = None
|
||||
|
||||
|
||||
""" Processes the input image"""
|
||||
def process(self, img):
|
||||
@@ -81,6 +85,7 @@ class InvisCloak (Algorithm):
|
||||
# Reduce noise, return result image
|
||||
return np.mean(self.picture_buffer, axis=0).astype(np.uint8)
|
||||
|
||||
|
||||
def _212_HistogrammSpreizung(self, img):
|
||||
"""
|
||||
Hier steht Ihr Code zu Aufgabe 2.1.2 (Histogrammspreizung)
|
||||
@@ -88,8 +93,24 @@ class InvisCloak (Algorithm):
|
||||
- Histogrammspreizung berechnen
|
||||
- Transformation BGR
|
||||
"""
|
||||
# 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
|
||||
|
||||
return img
|
||||
|
||||
def _221_RGB(self, img):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user