Skip to content

Commit

Permalink
This would return NaN if total is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
ivoflipse committed Jan 21, 2016
1 parent ce4bc59 commit 9689ed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion skimage/feature/_hoghistogram.pyx
Expand Up @@ -70,7 +70,9 @@ cdef float cell_hog(double[:, ::1] magnitude,

total += magnitude[cell_row_index, cell_column_index]

return total / (cell_rows * cell_columns)
if total:
return total / (cell_rows * cell_columns)
return 0.

def hog_histograms(double[:, ::1] gradient_columns,
double[:, ::1] gradient_rows,
Expand Down

0 comments on commit 9689ed2

Please sign in to comment.