private void dealRgb(byte[] data) { if (rgbData == null) { int[] argb = new int[PREFER_WIDTH * PERFER_HEIGH]; FaceSDK.GetARGBFromYUVimg(data, argb, PREFER_WIDTH, PERFER_HEIGH, 0, 0); rgbData = argb; checkData(); Bitmap bitmap = Bitmap.CreateBitmap(argb, PREFER_WIDTH, PERFER_HEIGH, Bitmap.Config.Argb8888); RunOnUiThread(new Runnable(() => { testIv.SetImageBitmap(bitmap); })); } }
private void dealIr(byte[] data) { if (irData == null) { // int[] argb = new int[640 * 480]; // FaceSDK.getARGBFromYUVimg(data, argb, 480, 640, 0, 0); niRargb = new int[PREFER_WIDTH * PERFER_HEIGH]; FaceSDK.GetARGBFromYUVimg(data, niRargb, PERFER_HEIGH, PREFER_WIDTH, 0, 0); byte[] ir = new byte[PREFER_WIDTH * PERFER_HEIGH]; System.Array.Copy(data, 0, ir, 0, PREFER_WIDTH * PERFER_HEIGH); irData = ir; checkData(); } }
/// <summary> /// yuv图片转换为相应的argb; /// </summary> /// <param name="yuv"> yuv_420p图片 </param> /// <param name="width"> 图片宽度 </param> /// <param name="height"> 图片高度 </param> /// <param name="argb"> 接收argb用得 int数组 </param> /// <param name="rotation"> yuv图片的旋转角度 </param> /// <param name="mirror"> 是否为镜像 </param> public static void yuvToARGB(byte[] yuv, int width, int height, int[] argb, int rotation, int mirror) { FaceSDK.GetARGBFromYUVimg(yuv, argb, width, height, rotation, mirror); }