From 91d53cd181ea0537df282082b745dd09f6603261 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Thu, 2 Mar 2023 17:11:04 -0800 Subject: [PATCH] Make image preprocessing support RGBA image. PiperOrigin-RevId: 513680594 --- mediapipe/tasks/cc/vision/utils/image_tensor_specs.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mediapipe/tasks/cc/vision/utils/image_tensor_specs.cc b/mediapipe/tasks/cc/vision/utils/image_tensor_specs.cc index 6b67047c5..4d3d2cb96 100644 --- a/mediapipe/tasks/cc/vision/utils/image_tensor_specs.cc +++ b/mediapipe/tasks/cc/vision/utils/image_tensor_specs.cc @@ -182,11 +182,11 @@ absl::StatusOr BuildInputImageTensorSpecs( "Only RGB color space is supported for now.", MediaPipeTasksStatus::kInvalidArgumentError); } - if (batch != 1 || depth != 3) { + if (batch != 1 || (depth != 3 && depth != 4)) { return CreateStatusWithPayload( StatusCode::kInvalidArgument, absl::StrCat("The input tensor should have dimensions 1 x height x " - "width x 3. Got ", + "width x depth, where depth = 3 or 4. Got ", batch, " x ", height, " x ", width, " x ", depth, "."), MediaPipeTasksStatus::kInvalidInputTensorDimensionsError); }