Skip to content

Commit 1dcafba

Browse files
authored
Merge pull request #6 from Kuluum/inf-cycle-fix
Fix negative track size
2 parents 887c0fd + fd47a25 commit 1dcafba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/track.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ Eigen::VectorXd Track::ConvertBboxToObservation(const cv::Rect& bbox) const{
130130
*/
131131
cv::Rect Track::ConvertStateToBbox(const Eigen::VectorXd &state) const {
132132
// state - center_x, center_y, width, height, v_cx, v_cy, v_width, v_height
133-
auto width = static_cast<int>(state[2]);
134-
auto height = static_cast<int>(state[3]);
133+
auto width = std::max(0, static_cast<int>(state[2]));
134+
auto height = std::max(0, static_cast<int>(state[3]));
135135
auto tl_x = static_cast<int>(state[0] - width / 2.0);
136136
auto tl_y = static_cast<int>(state[1] - height / 2.0);
137137
cv::Rect rect(cv::Point(tl_x, tl_y), cv::Size(width, height));

0 commit comments

Comments
 (0)