Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
283 views
in Technique[技术] by (71.8m points)

python - Rescaling the bounding box annotations in a stitched image

I have two images stitched together just as shown below:

enter image description here

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:

enter image description here

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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...