Skip to content
Snippets Groups Projects
Commit 07dd7746 authored by Axel Farrugia's avatar Axel Farrugia
Browse files

[Fix] The normalize function was dividing by 0 when min == max

parent 0a5b7034
No related branches found
No related tags found
No related merge requests found
......@@ -215,6 +215,8 @@ def normalize(array):
"""
Normalize an input image between -1 and 1
"""
if array.max() == array.min():
return array/array.max()
array = (array - array.min()) / (array.max() - array.min())
return 2 * array - 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment