mirror of
https://github.com/EyeTrackVR/EyeTrackVR.git
synced 2025-11-04 14:39:42 +08:00
fix: Division by zero
This commit is contained in:
parent
30b8ac46ce
commit
bfbcc9ca6d
@ -350,12 +350,10 @@ class EllipseBasedPupilDilation:
|
||||
minp = float(self.maxval)
|
||||
|
||||
try:
|
||||
if maxp != 0 and not (np.isnan(pupil_area) or np.isnan(maxp)):
|
||||
eyedilation = (pupil_area - maxp) / (
|
||||
minp - maxp
|
||||
)
|
||||
else:
|
||||
if not np.isfinite(pupil_area) or not np.isfinite(maxp) or not np.isfinite(minp) or (minp - maxp) == 0:
|
||||
eyedilation = 0.5
|
||||
else:
|
||||
eyedilation = (pupil_area - maxp) / (minp - maxp)
|
||||
except:
|
||||
eyedilation = 0.5
|
||||
eyedilation = 1 - eyedilation
|
||||
|
||||
Loading…
Reference in New Issue
Block a user