Skip to content

Commit 0da8dc4

Browse files
authored
fix (#230)
1 parent 1222eef commit 0da8dc4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

model_api/cpp/models/include/models/results.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ static inline std::vector<SegmentedObjectWithRects> add_rotated_rects(std::vecto
230230
for (size_t i = 0; i < contours.size(); i++) {
231231
contour.insert(contour.end(), contours[i].begin(), contours[i].end());
232232
}
233-
std::vector<cv::Point> hull;
234-
cv::convexHull(contour, hull);
235-
objects_with_rects.back().rotated_rect = cv::minAreaRect(hull);
233+
if (contour.size() > 0) {
234+
std::vector<cv::Point> hull;
235+
cv::convexHull(contour, hull);
236+
objects_with_rects.back().rotated_rect = cv::minAreaRect(hull);
237+
}
236238
}
237239
return objects_with_rects;
238240
}

0 commit comments

Comments
 (0)