您可以使用应用于图像的相同变换矩阵来获取该点.您希望将屏幕坐标系之间的点转换为图像的坐标系,从而反转原始矩阵的效果.
具体来说,您希望使用用于将图像转换到屏幕上的矩阵的反转,将用户在屏幕上单击的x,y坐标转换为原始图像中的对应点.
假设矩阵包含应用于图像的变换的一些伪代码:
// pretend user clicked the screen at {20.0,15.0}
float x = 20.0;
float y = 15.0;
float[] pts[2];
pts[0] = x;
pts[1] = y;
// get the inverse of the transformation matrix
// (a matrix that transforms back from destination to source)
Matrix inverse = new Matrix();
if(matrix.invert(inverse)) {
// apply the inverse transformation to the points
inverse.mapPoints(pts);
// now pts[0] is x relative to image left
// pts[1] is y relative to image top
}@H_502_28@