Skip to content

Commit

Permalink
Correction of bounding box negative proportions
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennoCaldato committed Aug 13, 2020
1 parent 266bdc0 commit 1e10455
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/CVTracker.cpp
Expand Up @@ -124,6 +124,16 @@ bool CVTracker::initTracker(cv::Mat &frame, size_t frameId){
// Create new tracker object
tracker = selectTracker(trackerType);

// Correct if bounding box contains negative proportions (width and/or height < 0)
if(bbox.width < 0){
bbox.x = bbox.x - abs(bbox.width);
bbox.width = abs(bbox.width);
}
if(bbox.height < 0){
bbox.y = bbox.y - abs(bbox.height);
bbox.height = abs(bbox.height);
}

// Initialize tracker
tracker->init(frame, bbox);

Expand Down

0 comments on commit 1e10455

Please sign in to comment.