简体   繁体   中英

Translating a Rectangle from Larger Image to Smaller One

我需要对大图像文件进行冗长的处理,因此在处理之前我会对其进行大小调整。在处理结束时,将返回调整后大小的图像内矩形的坐标。我如何将此矩形/矩形坐标转换为矩形在未调整大小的原尺寸图片中?

Resizing is linear transformation, so new coordinate of some point is calculated as

 X_New = Ax * X_Old + Bx

To get it back, just use reverse transform

 X_Old = (X_New - Bx) / Ax

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