From 228bb868ee769287ce500ae9a837141658a9dd13 Mon Sep 17 00:00:00 2001 From: Martin Garbade Date: Mon, 24 Jan 2022 12:36:42 +0100 Subject: [PATCH] fix: cannot invert matrix if ROI is 0 --- mediapipe/calculators/tensor/image_to_tensor_utils.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mediapipe/calculators/tensor/image_to_tensor_utils.cc b/mediapipe/calculators/tensor/image_to_tensor_utils.cc index 6b3bf08cd..d1802f0be 100644 --- a/mediapipe/calculators/tensor/image_to_tensor_utils.cc +++ b/mediapipe/calculators/tensor/image_to_tensor_utils.cc @@ -24,7 +24,8 @@ namespace mediapipe { RotatedRect GetRoi(int input_width, int input_height, absl::optional 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, /*center_y =*/norm_rect->y_center() * input_height, /*width =*/norm_rect->width() * input_width,