UniversalDataTool / react-image-annotate

Create image annotations. Classify, tag images with polygons, bounding boxes or points.
MIT License
397 stars 176 forks source link

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

Open upcfeather opened 1 year ago

upcfeather commented 1 year ago

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

FrontDream commented 8 months ago

大佬最后解决了嘛

FrontDream commented 8 months ago

大佬,能联系一下吗,有偿