From 7e666302d5eadb1e84b70cae27e8ec6108d7a135 Mon Sep 17 00:00:00 2001 From: Matthias Bisping Date: Mon, 25 Apr 2022 11:52:51 +0200 Subject: [PATCH] added alpha channel check result to response --- README.md | 1 + image_prediction/transformer/transformers/response.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1bffd8c..6280f91 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ An image metadata record (entry in `"data"` field of a response body) looks like "width": 57.44999999999999, "height": 31.149999999999977 }, + "alpha": false, "filters": { "geometry": { "imageSize": { diff --git a/image_prediction/transformer/transformers/response.py b/image_prediction/transformer/transformers/response.py index 9c10944..ca8ce99 100644 --- a/image_prediction/transformer/transformers/response.py +++ b/image_prediction/transformer/transformers/response.py @@ -20,8 +20,8 @@ def build_image_info(data: dict) -> dict: image_area_sqrt = math.sqrt(abs(x2 - x1) * abs(y2 - y1)) return image_area_sqrt / page_area_sqrt - page_width, page_height, x1, x2, y1, y2, width, height = itemgetter( - "page_width", "page_height", "x1", "x2", "y1", "y2", "width", "height" + page_width, page_height, x1, x2, y1, y2, width, height, alpha = itemgetter( + "page_width", "page_height", "x1", "x2", "y1", "y2", "width", "height", "alpha" )(data) quotient = round(compute_geometric_quotient(), 4) @@ -43,6 +43,7 @@ def build_image_info(data: dict) -> dict: "classification": classification, "position": {"x1": x1, "x2": x2, "y1": y1, "y2": y2, "pageNumber": data["page_idx"] + 1}, "geometry": {"width": width, "height": height}, + "alpha": alpha, "filters": { "geometry": { "imageSize": {