Converting bounding boxes from labels.json file to pixel values

Yves Guena 20 Reputation points

How can I convert the bounding boxes from a labels.json file to pixel values? The file follows the schema at "". Here is an example bounding box from the file:

    "page": 1,
    "text": "1AJ",
    "boundingBoxes": [

I need to convert these bounding boxes to pixel values. Can you provide any guidance or resources on how to do this?

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,228 questions
0 comments No comments
{count} votes

Accepted answer
  1. dupammi 4,250 Reputation points Microsoft Vendor

    Hi @Yves Guena ,

    Thank you for using Microsoft Q&A. Form Recognizer does not have an inbuilt function to convert bounding boxes from a labels.json file to pixel values. However, you can use the formula pixel_value = bounding_box_value * image_size to calculate the pixel values for the bounding boxes.For example, if the image size is 1000x1000 pixels and the bounding box value is [0.6822429906542056,0.07027328499721137], you can calculate the pixel values as follows:

    x1 = 0.6822429906542056 * 1000 = 682.2429906542056
    y1 = 0.07027328499721137 * 1000 = 70.27328499721137

    To use this formula, you need to know the size of the image in pixels and the normalized coordinates for the bounding boxes from the labels.json file.

    You can then use the formula to calculate the pixel values for the bounding boxes. Hope this helps.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful