android - 相机人脸检测坐标到屏幕坐标

标签 android android-camera coordinates

我最近开始使用 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/

相关文章:

android - 如何在 Camera2 API Android 5.0 中获取单个预览帧?

delphi - 用Delphi获取文本边界的坐标

java - 滑行不下载图像

java - Firestore数据库注册失败权限被拒绝但实际上注册成功

android - 为什么 intent.getParcelableExtra 在 kotlin 中不返回可空类型?

android - 如何判断一个android设备是否支持 "android.hardware.camera.autofocus"?

android - 如何使用 Camera2 获取前置摄像头的 ID?

java - 判断坐标是否在线

svg viewbox缩放问题

android - 在 Android 上读取短信时不调用 ContentObserver 的 onChange 方法