我最近开始使用 Android 的相机 API。我正在使用人脸检测及其回调 setFaceDetectionListener
。我无法理解如何将 faces[0].rect.centerX();
和 faces[0].rect.centerY()
转换为某些东西我可以在屏幕上使用,例如以该点为中心在脸部周围移动图像。
任何人都可以帮助我了解如何将相机提供的坐标系转换为我可以用来设置 Activity 元素的坐标系。
最佳答案
来自 docs
(-1000, -1000) represents the top-left of the camera field of view, and (1000, 1000) represents the bottom-right of the field of view.
所以输入屏幕坐标(伪代码):
screenX = (coord.x +1000) * screen.width / 2000
screenY = (coord.y +1000) * screen.height / 2000
关于android - 相机人脸检测坐标到屏幕坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22102503/