void GetOSDPos(float& x, float& y) { // 获取当前OSD实际的坐标 int pox = 0; int poy = 0; getpos(&pox, &poy); // 获取分辨率 int width = 0; int height = 0; getsolution(&width, &height);
// 转换为ONVIF的相对坐标 -> x y x = ((float)(pox - (int)res.width/2))/(float)(res.width/2); y = ((float)(poy - (int)res.height/2))/(float)(res.height/2); if (y != 0) y = -y; // 注:浮点数最好不要这样判断