简体   繁体   中英

Rescaling the bounding box annotations in a stitched image

I have two images stitched together just as shown below:

在此处输入图像描述

Each image is of resolution 1024 x 1024. This infers the total dimension on the stitched image is 2048 x 1024. The bounding box annotations on the images are given by:

在此处输入图像描述

For the first sub-part of the stitched image, I can directly use the annotations. For the second part of the stitched image that spans from 1025-2048 pixels in the 'X'-axis direction, I have to rescale the coordinates so that I get the annotations in the 1-1024 pixel regime. How should I rescale/modify the second part of the annotation to get the pixel values in the X direction to get them in the 1-1024 pixel regime?

If your stitched image is always a horizontal stack, then you can subtract the width of the first image from the x-position of the bounding box. In this example, if you see a bounding box that has an x-pos greater than 1024 you can assume it's on the right side picture so you can subtract 1024 to put it back in the [1, 1024] range.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM