删除video检测的代码,添加延时输出的代码。
This commit is contained in:
@@ -6,6 +6,7 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
@@ -182,6 +183,12 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
||||
@Override
|
||||
public void analyze(@NonNull ImageProxy image) {
|
||||
try {
|
||||
long analyzeTime = SystemClock.elapsedRealtimeNanos();
|
||||
long captureTime = image.getImageInfo().getTimestamp();
|
||||
long latencyNs = analyzeTime - captureTime;
|
||||
double latencyMs = latencyNs / 1_000_000.0;
|
||||
|
||||
Log.d("CameraLatency", String.format("Image capture to analyze latency: %.2f ms", latencyMs));
|
||||
//Log.d("Camera", "Received image: " + image.getWidth() + "x" + image.getHeight());
|
||||
processImageForVulkan(image);
|
||||
detectFace(image);
|
||||
@@ -315,7 +322,7 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
||||
nativeBuffer.order(ByteOrder.nativeOrder());
|
||||
}
|
||||
|
||||
|
||||
long start_time = System.currentTimeMillis();
|
||||
|
||||
// ArrayList<Vector> vertexs = new ArrayList<>();
|
||||
// ArrayList<Integer> triangle_index = new ArrayList<>();
|
||||
@@ -358,7 +365,10 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
||||
FloatBuffer floatBuffer = nativeBuffer.asFloatBuffer();
|
||||
floatBuffer.put(points);
|
||||
floatBuffer.position(0);
|
||||
long cur_time = System.currentTimeMillis();
|
||||
Log.i("TimeLatency","Result Data ProcessTime:" + (cur_time-start_time));
|
||||
passDataToNative(nativeBuffer, index, width, height);
|
||||
Log.i("TimeLatency","passDataToNative ProcessTime:" + (System.currentTimeMillis() - cur_time));
|
||||
}
|
||||
|
||||
public float z_rate = -1.0f;
|
||||
|
||||
Reference in New Issue
Block a user