From 7a4b450c501ca14f2a34dc6d2810361d7424e03d Mon Sep 17 00:00:00 2001 From: Jiuqiang Tang Date: Tue, 17 Jan 2023 10:51:04 -0800 Subject: [PATCH] Resolve the error "call to 'abs' is ambiguous". PiperOrigin-RevId: 502630518 --- mediapipe/tasks/cc/components/containers/rect.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mediapipe/tasks/cc/components/containers/rect.h b/mediapipe/tasks/cc/components/containers/rect.h index 551d9158..72c7a8ac 100644 --- a/mediapipe/tasks/cc/components/containers/rect.h +++ b/mediapipe/tasks/cc/components/containers/rect.h @@ -16,6 +16,7 @@ limitations under the License. #ifndef MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_RECT_H_ #define MEDIAPIPE_TASKS_CC_COMPONENTS_CONTAINERS_RECT_H_ +#include #include namespace mediapipe::tasks::components::containers { @@ -48,10 +49,10 @@ struct RectF { }; inline bool operator==(const RectF& lhs, const RectF& rhs) { - return abs(lhs.left - rhs.left) < kRectFTolerance && - abs(lhs.top - rhs.top) < kRectFTolerance && - abs(lhs.right - rhs.right) < kRectFTolerance && - abs(lhs.bottom - rhs.bottom) < kRectFTolerance; + return std::fabs(lhs.left - rhs.left) < kRectFTolerance && + std::fabs(lhs.top - rhs.top) < kRectFTolerance && + std::fabs(lhs.right - rhs.right) < kRectFTolerance && + std::fabs(lhs.bottom - rhs.bottom) < kRectFTolerance; } RectF ToRectF(const Rect& rect, int image_height, int image_width);