added alpha channel check result to response

This commit is contained in:
Matthias Bisping 2022-04-25 11:52:51 +02:00
parent a6b9f64b51
commit 7e666302d5
2 changed files with 4 additions and 2 deletions

View File

@ -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": {

View File

@ -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": {