Skip to content

Commit

Permalink
Fixed iteration through detection boxes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbjelonic committed Apr 26, 2018
1 parent c451234 commit a4a1759
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions darknet_ros/src/YoloObjectDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,9 @@ void *YoloObjectDetector::detectInThread()
draw_detections(display, dets, nboxes, demoThresh_, demoNames_, demoAlphabet_, demoClasses_);

// extract the bounding boxes and send them to ROS
int total = l.w * l.h * l.n;
int i, j;
int count = 0;
for (i = 0; i < total; ++i) {
for (i = 0; i < nboxes; ++i) {
float xmin = dets[i].bbox.x - dets[i].bbox.w / 2.;
float xmax = dets[i].bbox.x + dets[i].bbox.w / 2.;
float ymin = dets[i].bbox.y - dets[i].bbox.h / 2.;
Expand All @@ -369,7 +368,7 @@ void *YoloObjectDetector::detectInThread()
ymax = 1;

// iterate through possible boxes and collect the bounding boxes
for (j = 0; j < l.classes; ++j) {
for (j = 0; j < demoClasses_; ++j) {
if (dets[i].prob[j]) {
float x_center = (xmin + xmax) / 2;
float y_center = (ymin + ymax) / 2;
Expand Down

0 comments on commit a4a1759

Please sign in to comment.