Skip to content

Commit

Permalink
patch division by zero (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
qgeissmann authored Jul 14, 2020
1 parent 0d12148 commit d618f21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ethoscope/trackers/adaptive_bg_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ def _pre_process_input_minimal(self, img, mask, t, darker_fg=True):
#
mean = cv2.mean(self._buff_grey, mask)

scale = 128. / mean[0]
try:
scale = 128. / mean[0]
except ZeroDivisionError:
raise NoPositionError

cv2.multiply(self._buff_grey, scale, dst = self._buff_grey)

Expand Down Expand Up @@ -508,4 +511,4 @@ def _track(self, img, grey, mask,t):


self._previous_shape=np.copy(hull)
return [out]
return [out]

0 comments on commit d618f21

Please sign in to comment.