Finish 2.1.1 exercise 1
This commit is contained in:
@@ -10,7 +10,12 @@ class InvisCloak (Algorithm):
|
|||||||
|
|
||||||
""" init function """
|
""" init function """
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
# Number of buffered images
|
||||||
|
self.n = 5
|
||||||
|
|
||||||
|
# Picture buffer
|
||||||
|
self.picture_buffer = []
|
||||||
|
|
||||||
|
|
||||||
""" Processes the input image"""
|
""" Processes the input image"""
|
||||||
def process(self, img):
|
def process(self, img):
|
||||||
@@ -64,9 +69,17 @@ class InvisCloak (Algorithm):
|
|||||||
Hier steht Ihr Code zu Aufgabe 2.1.1 (Rauschunterdrückung)
|
Hier steht Ihr Code zu Aufgabe 2.1.1 (Rauschunterdrückung)
|
||||||
- Implementierung Mittelwertbildung über N Frames
|
- Implementierung Mittelwertbildung über N Frames
|
||||||
"""
|
"""
|
||||||
|
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)
|
||||||
|
|
||||||
return img
|
# Reduce noise, return result image
|
||||||
|
return np.mean(self.picture_buffer, axis=0).astype(np.uint8)
|
||||||
|
|
||||||
def _212_HistogrammSpreizung(self, img):
|
def _212_HistogrammSpreizung(self, img):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user