Fixed-sized bounding box

Hi all,

We're building an image annotation tool that asks the users to apply fixed-sized square patches to the places they are interested in.
The Retool default setup allows the user to change the size of the regions when drawing the bounding boxes Is there a way to control the size so that every bounding boxes have the same height same width?

Thank you.
And happy holidays :christmas_tree:

Hey @doris.l!

It doesn't look like there's a built-in way to do this at the moment :confused: the closest thing I'm seeing is to fix the size of the boxes after the user has drawn them:

If that seems like it could work for you you can try the following setup -

fixBoundingBoxes JS query:

const height = 100;
const width = 100;
return boundingBox1.boundingBoxes.map(box => ({...box, height, width}));

boundingBox1 settings:

1 Like

Hi @Kabirdas,

Thanks for the response. It's very helpful!!
One follow-up question: Are the width and height calculated in pixels? If not, how to convert the values into pixels? Thank you!!!

Hey @doris.l!

The height and width should be calculated in pixels relative to the underlying image:

(Both components here are using the script linked above)

Is that what you're looking for, or would you like for them to have an absolute size in pixels?