Avoiding Divide By Zero Error

In line 104 `if ( full_neg_lst[i].cols >= box.width && full_neg_lst[i].rows >= box.height )` removed '=' as it causes divide By Zero Error in line 106 and 107 `box.x = rand() % ( full_neg_lst[i].cols - size_x );` when  full_neg_lst[i].cols = size_x or full_neg_lst[i].rows - size_y
pull/11265/head
Vishwa Prakash H V 7 years ago committed by GitHub
parent ade29fc6c9
commit 6b4fcd5f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      samples/cpp/train_HOG.cpp

@ -101,7 +101,7 @@ void sample_neg( const vector< Mat > & full_neg_lst, vector< Mat > & neg_lst, co
srand( (unsigned int)time( NULL ) );
for ( size_t i = 0; i < full_neg_lst.size(); i++ )
if ( full_neg_lst[i].cols >= box.width && full_neg_lst[i].rows >= box.height )
if ( full_neg_lst[i].cols > box.width && full_neg_lst[i].rows > box.height )
{
box.x = rand() % ( full_neg_lst[i].cols - size_x );
box.y = rand() % ( full_neg_lst[i].rows - size_y );

Loading…
Cancel
Save