Resize image and it's bounding box in x,y,w,h format

Question:

I have an image of width 1980 and height 1080 having x =759 ,y = 786, w = 369,h = 100. I want to convert this image into width = 640 and height = 480. How can I convert bounding box according to new image format?

I was trying something similar to

newX = (newW/W) * x
Asked By: DholuBholu

||

Answers:

As you know the actual (W,H) and new image format (newW,newH) then

newX = (newW/W) * x

and do the same for other value…

Edit:

newY = (newH/H) * y

And the same for other value.

Answered By: Loris