简体   繁体   中英

find new coordinates after joining the images

I have 25 images with the coordinates (x,y) and images are of size 128*128 . SO I am joining the images and new the image size would be 640 * 640 . I want to find out the new coordinates of (x,y)

I tried something like

#w,h of the new image i.e 640 , 640
#imw,imh of the old image i.e 128*128
#x,y old coordinates
  
newx = int(( w * x )/ imw)
newy = int(( h * y )/ imh)

Small image (i, j) to large image:

X = 128 i + x, 
Y = 128 j + y

Large image to small:

i = X / 128,
j = Y / 128,
x = X mod 128,
y = Y mod 128

(with integer division).

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