fix: cannot invert matrix if ROI is 0

This commit is contained in:
Martin Garbade 2022-01-24 12:36:42 +01:00
parent cf101e62a9
commit 228bb868ee

View File

@ -24,7 +24,8 @@ namespace mediapipe {
RotatedRect GetRoi(int input_width, int input_height, RotatedRect GetRoi(int input_width, int input_height,
absl::optional<mediapipe::NormalizedRect> norm_rect) { absl::optional<mediapipe::NormalizedRect> norm_rect) {
if (norm_rect) {
if (norm_rect && norm_rect->width() * input_width >= 2 && norm_rect->height() * input_height >= 2) {
return {/*center_x=*/norm_rect->x_center() * input_width, return {/*center_x=*/norm_rect->x_center() * input_width,
/*center_y =*/norm_rect->y_center() * input_height, /*center_y =*/norm_rect->y_center() * input_height,
/*width =*/norm_rect->width() * input_width, /*width =*/norm_rect->width() * input_width,