'Translating coordinates of two pictures

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Boscacci