Skip to content

How to get the box or shape real pixel about [x, y, w, h] and points [x, y]. #221

Open
@upcfeather

Description

@upcfeather

As mentioned above, I want to get the real px values of box and polygon, and the documentation doesn't show how to get them. I learned from the previous issue that I can use the following formula:

const [x, y, w, h] = image.regions[0];
const { pixelSize } = image; 
const real_px_w = pixelSize.w * w;
const real_px_h = pixelSize.h * h;
const real_px_x = pixelSize.w * w;
const real_px_y = pixelSize.w * h;

I would like to confirm with you whether the above formula is correct. If so, there will be an error of about 10px between the results calculated by the above formula and my actual measurement. Could you please inform box and polygon of the calculation formula of the real pixel?

image-20230814095904742

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions