问题描述
我最近开始使用Android的相机API.我正在使用人脸检测,它是回调setFaceDetectionListener
.我在尝试理解如何将faces[0].rect.centerX();
和faces[0].rect.centerY()
转换为我可以在屏幕上使用的东西方面遇到麻烦,例如围绕着以该点为中心的脸部移动图像.
i've recently started playing with Android's camera api. And i'm using face detection and it's callback setFaceDetectionListener
. I'm having trouble trying to understand how to convert the faces[0].rect.centerX();
and faces[0].rect.centerY()
to something i can use on screen like move a image around the face centered on that point.
任何人都可以帮助我了解如何从相机给出的坐标系转换为我可以用来在活动中设置元素的东西.
can anyone help me understand how to convert from the coord system given by the camera to something i can use to set elements on my activity.
推荐答案
来自文档
因此要输入屏幕坐标(伪代码):
So to put in to screen coords (pseudocode):
screenX = (coord.x +1000) * screen.width / 2000
screenY = (coord.y +1000) * screen.height / 2000
这篇关于相机面部检测坐标到屏幕坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!