mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
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
This commit is contained in:
parent
ade29fc6c9
commit
6b4fcd5f73
@ -101,7 +101,7 @@ void sample_neg( const vector< Mat > & full_neg_lst, vector< Mat > & neg_lst, co
|
|||||||
srand( (unsigned int)time( NULL ) );
|
srand( (unsigned int)time( NULL ) );
|
||||||
|
|
||||||
for ( size_t i = 0; i < full_neg_lst.size(); i++ )
|
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.x = rand() % ( full_neg_lst[i].cols - size_x );
|
||||||
box.y = rand() % ( full_neg_lst[i].rows - size_y );
|
box.y = rand() % ( full_neg_lst[i].rows - size_y );
|
||||||
|
Loading…
Reference in New Issue
Block a user