0

I'm trying to translate coordinates from one picture (Res: 311, 271) to another picture (Res: 1920, 1080).

The coordinates don't need to be accurate in the 2nd picture, it just needs to be the same vector relative to the center of the images

Don't know if that makes sense...

Edit:

So far I've tried to calculate the difference between the center of the first image and the coordinates and then apply them to the bigger image. However this doesn't seem to work very consistently.

mituu
  • 11
  • 3

1 Answers1

0

You'll need to use trigonometry.

Say there's some object in the image you're trying to get the vector for. Given the x and y distances from the center of the original image, you can tabulate the angle and hypotenuse distance. Simply use the same angle and scale the hypotenuse distance with the new size image.

  • 1
    Doesn't this assume the original and new images have the same aspect ratio? – Scott Hunter May 10 '22 at 14:22
  • Well, it depends. OP wanted the "same vector" which to me implies the same angle and magnitude. These can't both be held proportionate if the new image is a diff aspect ratio. The method I prescribe keeps the angle constant, but the magnitude will be off if it's a new aspect ratio. The percentage method prescribed by @Ali Öztürk achieves something different, where the angle may change. – Robert Boscacci May 10 '22 at 14:29