Commit 793a8a51 authored by Davis King's avatar Davis King

Fixed a potential divide by zero in draw_fhog()

parent c6d778ea
...@@ -847,7 +847,10 @@ namespace dlib ...@@ -847,7 +847,10 @@ namespace dlib
} }
const double thresh = mean(himg) + 4*stddev(himg); const double thresh = mean(himg) + 4*stddev(himg);
if (thresh != 0)
return matrix_cast<unsigned char>(upperbound(round(himg*255/thresh),255)); return matrix_cast<unsigned char>(upperbound(round(himg*255/thresh),255));
else
return matrix_cast<unsigned char>(himg);
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -927,7 +930,10 @@ namespace dlib ...@@ -927,7 +930,10 @@ namespace dlib
} }
const double thresh = mean(himg) + 4*stddev(himg); const double thresh = mean(himg) + 4*stddev(himg);
if (thresh != 0)
return matrix_cast<unsigned char>(upperbound(round(himg*255/thresh),255)); return matrix_cast<unsigned char>(upperbound(round(himg*255/thresh),255));
else
return matrix_cast<unsigned char>(himg);
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
Markdown is supported
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