私はAndroidで顔検出にGoogle Visionを使用しています。現在、私のコード:検出された顔の座標を正面カメラから正しく翻訳する方法
public void onPreviewFrame(byte[] data, Camera camera) {
// creating Google Vision frame from a camera frame for face recognition
com.google.android.gms.vision.Frame frame = new com.google.android.gms.vision.Frame.Builder()
.setImageData(ByteBuffer.wrap(data), previewWidth,
previewHeight, ImageFormat.NV21)
.setId(frameId++)
.setRotation(com.google.android.gms.vision.Frame.ROTATION_270)
.setTimestampMillis(lastTimestamp).build();
// recognize the face in the frame
SparseArray<Face> faces = detector.detect(frame);
// wrong coordinates
float x = faces.valueAt(0).getPosition().x;
float y = faces.valueAt(0).getPosition().y;
}
問題がx
とy
は時々正しいとしてもマイナスではないということです。私はそれが何とか回転する必要がありますが、正確な座標を得ることを知っているが、正確にどのように?
http://stackoverflow.com/questions/39281320/how-to-detect-the-corners-center-xy-coordinates-using-googles-:これはここで行われている方法の例を参照してください。 face-apiこれは理にかなっています。 – bvk256