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

change contrast_points to np.array in BivariateSequence

parent 0926cc2f
......@@ -223,8 +223,7 @@ class BivariateSequence(View):
self._channel = 2 # TODO! Durch Klasse ersetzen
# TODO change mins and maxs to (0,2) np.array
maxs = []
mins = []
contrast_points = np.empty((0, 2), dtype=np.uint8)
# sofern kein oder nur ein Peak gefunden wird, man könnte dann auch
# noch einen Durchlauf mit geringeren thres und min_dist versuceh
......@@ -235,11 +234,8 @@ class BivariateSequence(View):
for frm_nr in range(self._frames.start, self._frames.end,
self._frame_step):
pwd = self._frames.folder + self._frames.prefix + str(frm_nr) + '.png'
img = cv2.imread(pwd)
img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV_FULL)
# BREAK: Funktioniert nicht
if method == 'bin':
hist_values = cv2.calcHist([img_hsv], [self._channel], None,
......@@ -300,22 +296,26 @@ class BivariateSequence(View):
# Abfangen von von nur 1 oder keinem Peak
if len(peaks) > 1:
lastmin = peaks[0]
mins.append(lastmin)
lastmax = peaks[-1]
maxs.append(lastmax)
contrast_points = np.vstack((contrast_points,
[lastmin, lastmax]))
elif len(peaks) == 1:
# je nachdem ob der neue peak dem alten min oder max wert
# näher liegt wird er dem einen oder Anderen zugeschlagen
if (lastmax - peaks[0]) < (peaks[0] - lastmin):
lastmax = peaks[0]
maxs.append(lastmax)
mins.append(lastmin)
contrast_points = np.vstack((contrast_points,
[lastmin, lastmax]))
else:
lastmin = peaks[0]
mins.append(lastmin)
maxs.append(lastmax)
contrast_points = np.vstack((contrast_points,
[lastmin, lastmax]))
else:
mins.append(lastmin)
maxs.append(lastmax)
contrast_points = np.vstack((contrast_points,
[lastmin, lastmax]))
return mins, maxs
contrast_points = np.asarray(contrast_points, np.uint8)
shape = contrast_points.shape
self.resize(shape, refcheck=False)
self[:, :] = contrast_points
contrast_points = None
Supports Markdown
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