Commit adb31e62 authored by Niels-Oliver Walkowski's avatar Niels-Oliver Walkowski
Browse files

create general contrast class and subclass lightdark

parent bf4b3934
......@@ -12,6 +12,8 @@ from copy import deepcopy
# Vorgehen: https://docs.scipy.org/doc/numpy/user/basics.subclassing.html
# resize Probleme https://sourceforge.net/p/numpy/mailman/message/12594801/
# andere ownership Probleme könne angeblich mit out= gelöst werden
# "Use __new__ when you need to control the creation of a new instance.
# Use __init__ when you need to control initialization of a new instance."
class Contrast(np.ndarray):
"""Core class for a color contrast in a movie
......@@ -43,6 +45,11 @@ class Contrast(np.ndarray):
def __array_wrap__(self, out_arr, context=None):
return np.ndarray.__array_wrap__(self, out_arr, context)
class LightDark(Contrast):
def __init__(self, arg):
super(LightDark, self).__init__()
# TODO jetzt ausschließlich mit self numpy rechnen statt mit contrast_points liste
def hist_vstack(self):
contrast_points = []
......@@ -69,6 +76,6 @@ class Contrast(np.ndarray):
contrast_points = np.asarray(contrast_points, np.uint8)
shape = contrast_points.shape
self.resize(shape, refcheck=False)
self[:,:] = contrast_points
self[:, :] = contrast_points
return deepcopy(self) # TODO does not create a new object
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment