加入人脸真实纹理
This commit is contained in:
@@ -17,6 +17,7 @@ package com.khronos.vulkan_samples
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
|
import android.graphics.BitmapFactory
|
||||||
import android.graphics.Matrix
|
import android.graphics.Matrix
|
||||||
import android.media.MediaMetadataRetriever
|
import android.media.MediaMetadataRetriever
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@@ -180,6 +181,9 @@ class FaceLandmarkerHelper(
|
|||||||
matrix, true
|
matrix, true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//val bitmap = BitmapFactory.decodeFile("/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/face480.png")
|
||||||
|
//val mpImage = BitmapImageBuilder(bitmap).build()
|
||||||
|
|
||||||
// Convert the input Bitmap object to an MPImage object to run inference
|
// Convert the input Bitmap object to an MPImage object to run inference
|
||||||
val mpImage = BitmapImageBuilder(rotatedBitmap).build()
|
val mpImage = BitmapImageBuilder(rotatedBitmap).build()
|
||||||
|
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
AssetsCopyUtil.copyAssetsToAppFiles(this, "assets");
|
//AssetsCopyUtil.copyAssetsToAppFiles(this, "assets");
|
||||||
AssetsCopyUtil.copyAssetsToAppFiles(this, "shaders");
|
//AssetsCopyUtil.copyAssetsToAppFiles(this, "shaders");
|
||||||
|
|
||||||
|
|
||||||
String native_lib_name = getResources().getString(R.string.native_lib_name);
|
String native_lib_name = getResources().getString(R.string.native_lib_name);
|
||||||
@@ -105,16 +105,16 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 初始化Runnable
|
// 初始化Runnable
|
||||||
cameraDataRunnable = new Runnable() {
|
// cameraDataRunnable = new Runnable() {
|
||||||
@Override
|
// @Override
|
||||||
public void run() {
|
// public void run() {
|
||||||
fetchCameraData();
|
// fetchCameraData();
|
||||||
handler.postDelayed(this, INTERVAL); // 再次调度
|
// handler.postDelayed(this, INTERVAL); // 再次调度
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 开始周期性调用
|
// 开始周期性调用
|
||||||
startPeriodicFetching();
|
// startPeriodicFetching();
|
||||||
|
|
||||||
|
|
||||||
Log.i("MainActivity", "onCreate: ");
|
Log.i("MainActivity", "onCreate: ");
|
||||||
@@ -325,8 +325,8 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// StringBuilder sb = new StringBuilder();
|
//StringBuilder sb = new StringBuilder();
|
||||||
// sb.append("[");
|
//sb.append("[");
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
// Iterate through each detected face
|
// Iterate through each detected face
|
||||||
@@ -337,7 +337,6 @@ public class MainActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
for (NormalizedLandmark p : faceLandmarks)
|
for (NormalizedLandmark p : faceLandmarks)
|
||||||
{
|
{
|
||||||
//sb.append("[");
|
//sb.append("[");
|
||||||
//Log.i(TAG, "Index" + index + " x:"+p.x() + " y:"+p.y() + " z:"+p.z());
|
|
||||||
points[arrayIndex++] = p.x();
|
points[arrayIndex++] = p.x();
|
||||||
//sb.append(""+p.x()+",");
|
//sb.append(""+p.x()+",");
|
||||||
points[arrayIndex++] = p.y();
|
points[arrayIndex++] = p.y();
|
||||||
|
|||||||
Reference in New Issue
Block a user