Commit 9e012a2d authored by Julien Michel's avatar Julien Michel

ENH: Avoid possible division by zero

parent 584a1d9e
......@@ -47,6 +47,12 @@ public:
const cv::Mat& missing =
cv::Mat()) const
{
// Sanity check (division by ntrees later on)
if(ntrees == 0)
{
return 0.;
}
std::vector<unsigned int> classVotes(nclasses);
for( int k = 0; k < ntrees; k++ )
{
......
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