From ee5e3a086a5dc145e7f5df3de32e0e072c183949 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期五, 06 六月 2025 15:19:40 +0800
Subject: [PATCH] 1
---
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/FaceAI/FaceLiveness.cs | 970 ++++++++++++++++++++++++++++----------------------------
1 files changed, 485 insertions(+), 485 deletions(-)
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/FaceAI/FaceLiveness.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/FaceAI/FaceLiveness.cs
index 0e83584..acc403b 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/FaceAI/FaceLiveness.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/FaceAI/FaceLiveness.cs
@@ -1,548 +1,548 @@
-锘縰sing System;
-using System.IO;
-using System.Threading;
-using System.Collections;
-using System.Runtime.InteropServices;
-using System.Collections.Generic;
-using OpenCvSharp;
+锘�//using System;
+//using System.IO;
+//using System.Threading;
+//using System.Collections;
+//using System.Runtime.InteropServices;
+//using System.Collections.Generic;
+//using OpenCvSharp;
-namespace FaceAI
-{
- [StructLayout(LayoutKind.Sequential, Pack = 1)]
- // 娲讳綋鍒嗗��
- struct BDLivenessScore
- {
- public float score; //鍒嗗��
- };
- // 娲讳綋妫�娴�
- class FaceLiveness
- {
- // 鍗曠洰RGB闈欓粯娲讳綋妫�娴�
- [DllImport("BaiduFaceApi.dll", EntryPoint = "rgb_liveness", CharSet = CharSet.Ansi
- , CallingConvention = CallingConvention.Cdecl)]
- public static extern int rgb_liveness(IntPtr ptr_boxinfo, IntPtr ptr_score, IntPtr mat);
+//namespace FaceAI
+//{
+// [StructLayout(LayoutKind.Sequential, Pack = 1)]
+// // 娲讳綋鍒嗗��
+// struct BDLivenessScore
+// {
+// public float score; //鍒嗗��
+// };
+// // 娲讳綋妫�娴�
+// class FaceLiveness
+// {
+// // 鍗曠洰RGB闈欓粯娲讳綋妫�娴�
+// [DllImport("BaiduFaceApi.dll", EntryPoint = "rgb_liveness", CharSet = CharSet.Ansi
+// , CallingConvention = CallingConvention.Cdecl)]
+// public static extern int rgb_liveness(IntPtr ptr_boxinfo, IntPtr ptr_score, IntPtr mat);
- // 鍗曠洰杩戠孩澶栭潤榛樻椿浣撴娴�
- [DllImport("BaiduFaceApi.dll", EntryPoint = "nir_liveness", CharSet = CharSet.Ansi
- , CallingConvention = CallingConvention.Cdecl)]
- public static extern int nir_liveness(IntPtr ptr_boxinfo, IntPtr ptr_score, IntPtr mat);
+// // 鍗曠洰杩戠孩澶栭潤榛樻椿浣撴娴�
+// [DllImport("BaiduFaceApi.dll", EntryPoint = "nir_liveness", CharSet = CharSet.Ansi
+// , CallingConvention = CallingConvention.Cdecl)]
+// public static extern int nir_liveness(IntPtr ptr_boxinfo, IntPtr ptr_score, IntPtr mat);
- // 鍙岀洰娣卞害闈欓粯娲讳綋妫�娴�
- [DllImport("BaiduFaceApi.dll", EntryPoint = "rgb_depth_liveness", CharSet = CharSet.Ansi
- , CallingConvention = CallingConvention.Cdecl)]
- public static extern int rgb_depth_liveness(IntPtr ptr_boxinfo, IntPtr ptr_rgbscore, IntPtr ptr_depthcore, IntPtr rgb_mat, IntPtr depth_mat);
+// // 鍙岀洰娣卞害闈欓粯娲讳綋妫�娴�
+// [DllImport("BaiduFaceApi.dll", EntryPoint = "rgb_depth_liveness", CharSet = CharSet.Ansi
+// , CallingConvention = CallingConvention.Cdecl)]
+// public static extern int rgb_depth_liveness(IntPtr ptr_boxinfo, IntPtr ptr_rgbscore, IntPtr ptr_depthcore, IntPtr rgb_mat, IntPtr depth_mat);
- public void test_liveness_by_image()
- {
- // rgb 娲讳綋妫�娴�
- string img_rgb = "../images/rgb.png";
- liveness_check(img_rgb, 0);
- // nir 娲讳綋妫�娴�
- string img_nir = "../images/nir.png";
- // liveness_check(img_nir, 1);
+// public void test_liveness_by_image()
+// {
+// // rgb 娲讳綋妫�娴�
+// string img_rgb = "../images/rgb.png";
+// liveness_check(img_rgb, 0);
+// // nir 娲讳綋妫�娴�
+// string img_nir = "../images/nir.png";
+// // liveness_check(img_nir, 1);
- }
+// }
- // 娴嬭瘯鍗曠洰RGB闈欓粯娲讳綋妫�娴嬶紙浼犲叆鍥剧墖鏂囦欢璺緞锛屾椿浣撶被鍨�)
- public void liveness_check(string img_path, int live_type)
- {
- Mat mat = Cv2.ImRead(img_path);
- int max_face_num = 1; // 娲讳綋浠呰繑鍥炰竴涓汉鑴革紝澶氫汉鍙栨渶澶т汉鑴�
+// // 娴嬭瘯鍗曠洰RGB闈欓粯娲讳綋妫�娴嬶紙浼犲叆鍥剧墖鏂囦欢璺緞锛屾椿浣撶被鍨�)
+// public void liveness_check(string img_path, int live_type)
+// {
+// Mat mat = Cv2.ImRead(img_path);
+// int max_face_num = 1; // 娲讳綋浠呰繑鍥炰竴涓汉鑴革紝澶氫汉鍙栨渶澶т汉鑴�
- BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
+// BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
- int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
- IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
+// int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
+// IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
- BDLivenessScore[] score_info = new BDLivenessScore[max_face_num];
- int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
- IntPtr ptS = Marshal.AllocHGlobal(sizeScore * max_face_num);
- // faceNum涓鸿繑鍥炵殑妫�娴嬪埌鐨勪汉鑴镐釜鏁�
- int faceNum = 0;
- if (live_type == 0)
- {
- faceNum = rgb_liveness(ptT, ptS, mat.CvPtr);
- }
- else if (live_type == 1)
- {
- faceNum = nir_liveness(ptT, ptS, mat.CvPtr);
- }
- mat.Release();
+// BDLivenessScore[] score_info = new BDLivenessScore[max_face_num];
+// int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
+// IntPtr ptS = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// // faceNum涓鸿繑鍥炵殑妫�娴嬪埌鐨勪汉鑴镐釜鏁�
+// int faceNum = 0;
+// if (live_type == 0)
+// {
+// faceNum = rgb_liveness(ptT, ptS, mat.CvPtr);
+// }
+// else if (live_type == 1)
+// {
+// faceNum = nir_liveness(ptT, ptS, mat.CvPtr);
+// }
+// mat.Release();
- Console.WriteLine("faceSize is:" + faceNum);
- for (int index = 0; index < faceNum; index++)
- {
+// Console.WriteLine("faceSize is:" + faceNum);
+// for (int index = 0; index < faceNum; index++)
+// {
- IntPtr ptr = new IntPtr();
- IntPtr ptrScore = new IntPtr();
- if (8 == IntPtr.Size)
- {
- ptr = (IntPtr)(ptT.ToInt64() + sizeBox * index);
- ptrScore = (IntPtr)(ptS.ToInt64() + sizeScore * index);
- }
- else if (4 == IntPtr.Size)
- {
- ptr = (IntPtr)(ptT.ToInt32() + sizeBox * index);
- ptrScore = (IntPtr)(ptS.ToInt32() + sizeScore * index);
- }
+// IntPtr ptr = new IntPtr();
+// IntPtr ptrScore = new IntPtr();
+// if (8 == IntPtr.Size)
+// {
+// ptr = (IntPtr)(ptT.ToInt64() + sizeBox * index);
+// ptrScore = (IntPtr)(ptS.ToInt64() + sizeScore * index);
+// }
+// else if (4 == IntPtr.Size)
+// {
+// ptr = (IntPtr)(ptT.ToInt32() + sizeBox * index);
+// ptrScore = (IntPtr)(ptS.ToInt32() + sizeScore * index);
+// }
- box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptr, typeof(BDFaceBBox));
+// box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptr, typeof(BDFaceBBox));
- score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrScore, typeof(BDLivenessScore));
+// score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrScore, typeof(BDLivenessScore));
- // 绱㈠紩鍊�
- Console.WriteLine("track index is:{0}", box_info[index].index);
- // 缃俊搴�
- Console.WriteLine("track score is:{0}", box_info[index].score);
- // 浜鸿劯瀹藉害
- Console.WriteLine("track mWidth is:{0}", box_info[index].width);
- // 涓績鐐筙,Y鍧愭爣
- Console.WriteLine("track mCenter_x is:{0}", box_info[index].center_x);
- Console.WriteLine("track mCenter_y is:{0}", box_info[index].center_y);
- // rgb 娲讳綋鍒嗗��
- Console.WriteLine("liveness score is:{0}", score_info[index].score);
+// // 绱㈠紩鍊�
+// Console.WriteLine("track index is:{0}", box_info[index].index);
+// // 缃俊搴�
+// Console.WriteLine("track score is:{0}", box_info[index].score);
+// // 浜鸿劯瀹藉害
+// Console.WriteLine("track mWidth is:{0}", box_info[index].width);
+// // 涓績鐐筙,Y鍧愭爣
+// Console.WriteLine("track mCenter_x is:{0}", box_info[index].center_x);
+// Console.WriteLine("track mCenter_y is:{0}", box_info[index].center_y);
+// // rgb 娲讳綋鍒嗗��
+// Console.WriteLine("liveness score is:{0}", score_info[index].score);
- }
- Marshal.FreeHGlobal(ptT);
- }
+// }
+// Marshal.FreeHGlobal(ptT);
+// }
- // 閫夋嫨usb瑙嗛鎽勫儚澶磇d,鏂规硶閲岄潰鏈夎幏鍙栬繛鎺ョ殑鎽勫儚澶村垪琛紝鍖呮嫭id锛屽悕绉板拰璺緞绛�
- public int select_usb_device_id()
- {
- ArrayList capDevs = new ArrayList();
- int device_id = 0;
- try
- {
- if (!File.Exists(Path.Combine(Environment.SystemDirectory, @"dpnhpast.dll")))
- {
- Console.WriteLine("DirectX NOT installed!");
- return - 1;
- }
- if (!DevEnum.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevs))
- {
- Console.WriteLine("No video capture devices found!");
- return -1;
- }
- if (capDevs.Count < 2)
- {
- Console.WriteLine("ir and rgb camera devices needed");
- return -1;
- }
- foreach (DsDevice d in capDevs) {
- Console.WriteLine("== VIDEO DEVICE (id:{0}) ==", d.id);
- Console.WriteLine("Name: {0}", d.Name);
- Console.WriteLine("Path: {0}", d.Path);
- }
+// // 閫夋嫨usb瑙嗛鎽勫儚澶磇d,鏂规硶閲岄潰鏈夎幏鍙栬繛鎺ョ殑鎽勫儚澶村垪琛紝鍖呮嫭id锛屽悕绉板拰璺緞绛�
+// public int select_usb_device_id()
+// {
+// ArrayList capDevs = new ArrayList();
+// int device_id = 0;
+// try
+// {
+// if (!File.Exists(Path.Combine(Environment.SystemDirectory, @"dpnhpast.dll")))
+// {
+// Console.WriteLine("DirectX NOT installed!");
+// return - 1;
+// }
+// if (!DevEnum.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevs))
+// {
+// Console.WriteLine("No video capture devices found!");
+// return -1;
+// }
+// if (capDevs.Count < 2)
+// {
+// Console.WriteLine("ir and rgb camera devices needed");
+// return -1;
+// }
+// foreach (DsDevice d in capDevs) {
+// Console.WriteLine("== VIDEO DEVICE (id:{0}) ==", d.id);
+// Console.WriteLine("Name: {0}", d.Name);
+// Console.WriteLine("Path: {0}", d.Path);
+// }
- if (capDevs.Count > 0)
- {
- device_id = ((DsDevice)capDevs[0]).id;
- Console.WriteLine("select device id is:{0}", device_id);
- }
- }
- catch(Exception)
- {
- if (capDevs != null)
- {
- foreach (DsDevice d in capDevs)
- d.Dispose();
- capDevs = null;
- }
- return -1;
- }
- return device_id;
- }
+// if (capDevs.Count > 0)
+// {
+// device_id = ((DsDevice)capDevs[0]).id;
+// Console.WriteLine("select device id is:{0}", device_id);
+// }
+// }
+// catch(Exception)
+// {
+// if (capDevs != null)
+// {
+// foreach (DsDevice d in capDevs)
+// d.Dispose();
+// capDevs = null;
+// }
+// return -1;
+// }
+// return device_id;
+// }
- // 鍙岀洰RGB鍜孖R闈欓粯娲讳綋妫�娴嬶紙鍙娇鐢ㄨ开濞佹嘲鎴栬娲惧皵绛塺gb+nir鍙岀洰鎽勫儚澶�),rgb鍜宯ir鐨勫垎鍊奸兘閫氳繃濡�0.8鎵嶇畻娲讳綋閫氳繃
- public bool rgb_ir_liveness_check_mat()
- {
- int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
- BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
- BDLivenessScore[] nir_score_info = new BDLivenessScore[max_face_num];
- int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
- IntPtr ptSRGB = Marshal.AllocHGlobal(sizeScore * max_face_num);
- IntPtr ptSNIR = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// // 鍙岀洰RGB鍜孖R闈欓粯娲讳綋妫�娴嬶紙鍙娇鐢ㄨ开濞佹嘲鎴栬娲惧皵绛塺gb+nir鍙岀洰鎽勫儚澶�),rgb鍜宯ir鐨勫垎鍊奸兘閫氳繃濡�0.8鎵嶇畻娲讳綋閫氳繃
+// public bool rgb_ir_liveness_check_mat()
+// {
+// int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
+// BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
+// BDLivenessScore[] nir_score_info = new BDLivenessScore[max_face_num];
+// int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
+// IntPtr ptSRGB = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// IntPtr ptSNIR = Marshal.AllocHGlobal(sizeScore * max_face_num);
- // 鍒濆鍖杛gb 杩斿洖鐨勪汉鑴告暟鎹�
- BDFaceBBox[] rgb_box_info = new BDFaceBBox[max_face_num];
+// // 鍒濆鍖杛gb 杩斿洖鐨勪汉鑴告暟鎹�
+// BDFaceBBox[] rgb_box_info = new BDFaceBBox[max_face_num];
- int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
- IntPtr ptTRGB = Marshal.AllocHGlobal(sizeBox * max_face_num);
+// int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
+// IntPtr ptTRGB = Marshal.AllocHGlobal(sizeBox * max_face_num);
- // 鍒濆鍖杗ir 杩斿洖鐨勪汉鑴告暟鎹�
- BDFaceBBox[] nir_box_info = new BDFaceBBox[max_face_num];
+// // 鍒濆鍖杗ir 杩斿洖鐨勪汉鑴告暟鎹�
+// BDFaceBBox[] nir_box_info = new BDFaceBBox[max_face_num];
- sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
- IntPtr ptTNIR = Marshal.AllocHGlobal(sizeBox * max_face_num);
+// sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
+// IntPtr ptTNIR = Marshal.AllocHGlobal(sizeBox * max_face_num);
- // 搴忓彿0涓虹數鑴戣瘑鍒殑usb鎽勫儚澶寸紪鍙凤紝鏈琩emo涓�0涓篿r绾㈠鎽勫儚澶�
- // 涓嶅悓鎽勫儚澶村拰鐢佃剳璇嗗埆鍙兘鏈夊尯鍒�
- // 缂栧彿涓�鑸粠0-10 */
- int device = select_usb_device_id();
- VideoCapture camera1 = VideoCapture.FromCamera(device);
- if(!camera1.IsOpened())
- {
- Console.WriteLine("camera1 open error");
- return false;
- }
+// // 搴忓彿0涓虹數鑴戣瘑鍒殑usb鎽勫儚澶寸紪鍙凤紝鏈琩emo涓�0涓篿r绾㈠鎽勫儚澶�
+// // 涓嶅悓鎽勫儚澶村拰鐢佃剳璇嗗埆鍙兘鏈夊尯鍒�
+// // 缂栧彿涓�鑸粠0-10 */
+// int device = select_usb_device_id();
+// VideoCapture camera1 = VideoCapture.FromCamera(device);
+// if(!camera1.IsOpened())
+// {
+// Console.WriteLine("camera1 open error");
+// return false;
+// }
- VideoCapture camera2 = VideoCapture.FromCamera(device+1);
- if (!camera2.IsOpened())
- {
- Console.WriteLine("camera2 open error");
- return false;
- }
+// VideoCapture camera2 = VideoCapture.FromCamera(device+1);
+// if (!camera2.IsOpened())
+// {
+// Console.WriteLine("camera2 open error");
+// return false;
+// }
- Mat frame1 = new Mat();
- Mat frame2 = new Mat();
- Mat rgb_mat = new Mat();
- Mat ir_mat = new Mat();
- var window_ir = new Window("ir_face");
- var window_rgb = new Window("rgb_face");
- while (true)
- {
- camera1.Read(frame1);
- camera2.Read(frame2);
- if(!frame1.Empty() && !frame2.Empty())
- {
- if (frame1.Channels() == 3)
- {
- rgb_mat = frame1;
- ir_mat = frame2;
- }
- else
- {
- rgb_mat = frame2;
- ir_mat = frame1;
- }
- float rgb_score = 0;
- float ir_score = 0;
+// Mat frame1 = new Mat();
+// Mat frame2 = new Mat();
+// Mat rgb_mat = new Mat();
+// Mat ir_mat = new Mat();
+// var window_ir = new Window("ir_face");
+// var window_rgb = new Window("rgb_face");
+// while (true)
+// {
+// camera1.Read(frame1);
+// camera2.Read(frame2);
+// if(!frame1.Empty() && !frame2.Empty())
+// {
+// if (frame1.Channels() == 3)
+// {
+// rgb_mat = frame1;
+// ir_mat = frame2;
+// }
+// else
+// {
+// rgb_mat = frame2;
+// ir_mat = frame1;
+// }
+// float rgb_score = 0;
+// float ir_score = 0;
- int face_size = 0;
- int nir_size = nir_liveness(ptTNIR, ptSNIR, ir_mat.CvPtr);
- int rgb_size = rgb_liveness(ptTRGB, ptSRGB, rgb_mat.CvPtr);
+// int face_size = 0;
+// int nir_size = nir_liveness(ptTNIR, ptSNIR, ir_mat.CvPtr);
+// int rgb_size = rgb_liveness(ptTRGB, ptSRGB, rgb_mat.CvPtr);
- face_size = nir_size <= rgb_size?nir_size:rgb_size;
- // 鑾峰彇鐨勪汉鑴告暟
- Console.WriteLine("faceNum is:{0}", face_size);
- for (int index = 0; index < face_size; index++)
- {
+// face_size = nir_size <= rgb_size?nir_size:rgb_size;
+// // 鑾峰彇鐨勪汉鑴告暟
+// Console.WriteLine("faceNum is:{0}", face_size);
+// for (int index = 0; index < face_size; index++)
+// {
- IntPtr ptrBox = new IntPtr();
- IntPtr ptrRGBScore = new IntPtr();
- IntPtr ptrNIRScore = new IntPtr();
- if (8 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptTRGB.ToInt64() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptSRGB.ToInt64() + sizeScore * index);
- ptrNIRScore = (IntPtr)(ptSNIR.ToInt64() + sizeScore * index);
- }
- else if (4 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptTRGB.ToInt32() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptSRGB.ToInt32() + sizeScore * index);
- ptrNIRScore = (IntPtr)(ptSNIR.ToInt32() + sizeScore * index);
- }
+// IntPtr ptrBox = new IntPtr();
+// IntPtr ptrRGBScore = new IntPtr();
+// IntPtr ptrNIRScore = new IntPtr();
+// if (8 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptTRGB.ToInt64() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptSRGB.ToInt64() + sizeScore * index);
+// ptrNIRScore = (IntPtr)(ptSNIR.ToInt64() + sizeScore * index);
+// }
+// else if (4 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptTRGB.ToInt32() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptSRGB.ToInt32() + sizeScore * index);
+// ptrNIRScore = (IntPtr)(ptSNIR.ToInt32() + sizeScore * index);
+// }
- rgb_box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
+// rgb_box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
- rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
- nir_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrNIRScore, typeof(BDLivenessScore));
- rgb_score = rgb_score_info[index].score;
- ir_score = nir_score_info[index].score;
- if (rgb_score <= 0.1f)
- {
- rgb_score = 0;
- }
- if (ir_score <= 0.1f)
- {
- ir_score = 0;
- }
- Console.WriteLine("demo ccccc");
- // 浜鸿劯瀹藉害
- Console.WriteLine("mWidth is:{0:f}", rgb_box_info[index].width);
- // 涓績鐐筙,Y鍧愭爣
- Console.WriteLine("mCenter_x is:{0:f}", rgb_box_info[index].center_x);
- Console.WriteLine("mCenter_y is:{0:f}", rgb_box_info[index].center_y);
+// rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
+// nir_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrNIRScore, typeof(BDLivenessScore));
+// rgb_score = rgb_score_info[index].score;
+// ir_score = nir_score_info[index].score;
+// if (rgb_score <= 0.1f)
+// {
+// rgb_score = 0;
+// }
+// if (ir_score <= 0.1f)
+// {
+// ir_score = 0;
+// }
+// Console.WriteLine("demo ccccc");
+// // 浜鸿劯瀹藉害
+// Console.WriteLine("mWidth is:{0:f}", rgb_box_info[index].width);
+// // 涓績鐐筙,Y鍧愭爣
+// Console.WriteLine("mCenter_x is:{0:f}", rgb_box_info[index].center_x);
+// Console.WriteLine("mCenter_y is:{0:f}", rgb_box_info[index].center_y);
- }
+// }
- string msg_depth = "ir score is:" + ir_score.ToString();
+// string msg_depth = "ir score is:" + ir_score.ToString();
- Cv2.PutText(ir_mat, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// Cv2.PutText(ir_mat, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- string msg_rgb = "rgb score is:" + rgb_score.ToString();
- Cv2.PutText(rgb_mat, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- if (face_size > 0)
- {
- // 鐢讳汉鑴告
- FaceDraw.draw_rects(ref rgb_mat, face_size, rgb_box_info);
- // 鐢诲叧閿偣
- // FaceDraw.draw_shape(ref rgb_mat, face_size, rgb_track_info);
- }
- window_rgb.ShowImage(rgb_mat);
- window_ir.ShowImage(ir_mat);
- Cv2.WaitKey(1);
- }
- }
- Marshal.FreeHGlobal(ptTRGB);
- Marshal.FreeHGlobal(ptTNIR);
- rgb_mat.Release();
- ir_mat.Release();
- frame1.Release();
- frame2.Release();
- Cv2.DestroyWindow("ir_face");
- Cv2.DestroyWindow("rgb_face");
- return true;
- }
- // 鍙岀洰鎽勫儚澶磋繘琛宺gb,depth娲讳綋妫�娴�(姝ゅ閫傞厤浜嗗崕鏉拌壘绫崇殑鍙岀洰鎽勫儚澶�)rgb鍜宒epth鐨勫垎鍊奸兘閫氳繃濡�0.8鎵嶇畻娲讳綋閫氳繃
- public bool rgb_depth_liveness_check_hjimi()
- {
- int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
+// string msg_rgb = "rgb score is:" + rgb_score.ToString();
+// Cv2.PutText(rgb_mat, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// if (face_size > 0)
+// {
+// // 鐢讳汉鑴告
+// FaceDraw.draw_rects(ref rgb_mat, face_size, rgb_box_info);
+// // 鐢诲叧閿偣
+// // FaceDraw.draw_shape(ref rgb_mat, face_size, rgb_track_info);
+// }
+// window_rgb.ShowImage(rgb_mat);
+// window_ir.ShowImage(ir_mat);
+// Cv2.WaitKey(1);
+// }
+// }
+// Marshal.FreeHGlobal(ptTRGB);
+// Marshal.FreeHGlobal(ptTNIR);
+// rgb_mat.Release();
+// ir_mat.Release();
+// frame1.Release();
+// frame2.Release();
+// Cv2.DestroyWindow("ir_face");
+// Cv2.DestroyWindow("rgb_face");
+// return true;
+// }
+// // 鍙岀洰鎽勫儚澶磋繘琛宺gb,depth娲讳綋妫�娴�(姝ゅ閫傞厤浜嗗崕鏉拌壘绫崇殑鍙岀洰鎽勫儚澶�)rgb鍜宒epth鐨勫垎鍊奸兘閫氳繃濡�0.8鎵嶇畻娲讳綋閫氳繃
+// public bool rgb_depth_liveness_check_hjimi()
+// {
+// int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
- BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
- BDLivenessScore[] depth_score_info = new BDLivenessScore[max_face_num];
- int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
- IntPtr ptRGBS = Marshal.AllocHGlobal(sizeScore * max_face_num);
- IntPtr ptDepthS = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
+// BDLivenessScore[] depth_score_info = new BDLivenessScore[max_face_num];
+// int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
+// IntPtr ptRGBS = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// IntPtr ptDepthS = Marshal.AllocHGlobal(sizeScore * max_face_num);
- BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
+// BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
- int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
- IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
- IntPtr phjimi = HjimiCamera.new_hjimi();
- var rgb_win = new Window("rgb", WindowMode.AutoSize);
- var depth_win = new Window("depth", WindowMode.Normal);
- float rgb_score = 0;
- float depth_score = 0;
- Mat cv_depth = new Mat();
- Mat cv_rgb = new Mat();
- while (true)
- {
- bool ok = HjimiCamera.open_hjimimat(phjimi, cv_rgb.CvPtr, cv_depth.CvPtr);
- if (!ok)
- {
- depth_score = 0;
- rgb_score = depth_score;
- Console.WriteLine("open camera faile");
- continue;
- }
- if(cv_rgb.Empty())
- {
- continue;
- }
- if (cv_depth.Empty())
- {
- continue;
- }
- // 杩斿洖浜鸿劯涓暟
- int face_size = rgb_depth_liveness(ptT, ptRGBS, ptDepthS, cv_rgb.CvPtr, cv_depth.CvPtr);
+// int sizeBox = Marshal.SizeOf(typeof(BDFaceBBox));
+// IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
+// IntPtr phjimi = HjimiCamera.new_hjimi();
+// var rgb_win = new Window("rgb", WindowMode.AutoSize);
+// var depth_win = new Window("depth", WindowMode.Normal);
+// float rgb_score = 0;
+// float depth_score = 0;
+// Mat cv_depth = new Mat();
+// Mat cv_rgb = new Mat();
+// while (true)
+// {
+// bool ok = HjimiCamera.open_hjimimat(phjimi, cv_rgb.CvPtr, cv_depth.CvPtr);
+// if (!ok)
+// {
+// depth_score = 0;
+// rgb_score = depth_score;
+// Console.WriteLine("open camera faile");
+// continue;
+// }
+// if(cv_rgb.Empty())
+// {
+// continue;
+// }
+// if (cv_depth.Empty())
+// {
+// continue;
+// }
+// // 杩斿洖浜鸿劯涓暟
+// int face_size = rgb_depth_liveness(ptT, ptRGBS, ptDepthS, cv_rgb.CvPtr, cv_depth.CvPtr);
- Console.WriteLine("res is:{0}", face_size);
- depth_score = 0;
- rgb_score = depth_score;
- for (int index = 0; index < face_size; index++)
- {
- IntPtr ptrBox = new IntPtr();
- IntPtr ptrRGBScore = new IntPtr();
- IntPtr ptrDepthScore = new IntPtr();
- if (8 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptT.ToInt64() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptRGBS.ToInt64() + sizeScore * index);
- ptrDepthScore = (IntPtr)(ptDepthS.ToInt64() + sizeScore * index);
- }
- else if (4 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptT.ToInt32() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptRGBS.ToInt32() + sizeScore * index);
- ptrDepthScore = (IntPtr)(ptDepthS.ToInt32() + sizeScore * index);
- }
+// Console.WriteLine("res is:{0}", face_size);
+// depth_score = 0;
+// rgb_score = depth_score;
+// for (int index = 0; index < face_size; index++)
+// {
+// IntPtr ptrBox = new IntPtr();
+// IntPtr ptrRGBScore = new IntPtr();
+// IntPtr ptrDepthScore = new IntPtr();
+// if (8 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptT.ToInt64() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptRGBS.ToInt64() + sizeScore * index);
+// ptrDepthScore = (IntPtr)(ptDepthS.ToInt64() + sizeScore * index);
+// }
+// else if (4 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptT.ToInt32() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptRGBS.ToInt32() + sizeScore * index);
+// ptrDepthScore = (IntPtr)(ptDepthS.ToInt32() + sizeScore * index);
+// }
- box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
+// box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
- rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
- rgb_score = rgb_score_info[index].score;
- depth_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrDepthScore, typeof(BDLivenessScore));
- depth_score = depth_score_info[index].score;
- // 鍒嗗�煎お浣庯紝浼氭樉绀哄皬鏁扮偣澶暱锛岀洿鎺ヨ祴鍊�0
- if (depth_score <= 0.1f)
- {
- depth_score = 0;
- }
- if (rgb_score <= 0.1f)
- {
- rgb_score = 0;
- }
- // 浜鸿劯瀹藉害
- Console.WriteLine("mWidth is:{0:f}", box_info[index].width);
- // 涓績鐐筙,Y鍧愭爣
- Console.WriteLine("mCenter_x is:{0:f}", box_info[index].center_x);
- Console.WriteLine("mCenter_y is:{0:f}", box_info[index].center_y);
+// rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
+// rgb_score = rgb_score_info[index].score;
+// depth_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrDepthScore, typeof(BDLivenessScore));
+// depth_score = depth_score_info[index].score;
+// // 鍒嗗�煎お浣庯紝浼氭樉绀哄皬鏁扮偣澶暱锛岀洿鎺ヨ祴鍊�0
+// if (depth_score <= 0.1f)
+// {
+// depth_score = 0;
+// }
+// if (rgb_score <= 0.1f)
+// {
+// rgb_score = 0;
+// }
+// // 浜鸿劯瀹藉害
+// Console.WriteLine("mWidth is:{0:f}", box_info[index].width);
+// // 涓績鐐筙,Y鍧愭爣
+// Console.WriteLine("mCenter_x is:{0:f}", box_info[index].center_x);
+// Console.WriteLine("mCenter_y is:{0:f}", box_info[index].center_y);
- }
+// }
- Mat depth_img = new Mat();
- cv_depth.ConvertTo(depth_img, MatType.CV_8UC1, 255.0 / 4500);
- string msg_depth = "depth score is:" + depth_score.ToString();
- Cv2.PutText(depth_img, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// Mat depth_img = new Mat();
+// cv_depth.ConvertTo(depth_img, MatType.CV_8UC1, 255.0 / 4500);
+// string msg_depth = "depth score is:" + depth_score.ToString();
+// Cv2.PutText(depth_img, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- string msg_rgb = "rgb score is:" + rgb_score.ToString();
- Cv2.PutText(cv_rgb, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- if (face_size > 0)
- {
- // 鐢讳汉鑴告
- FaceDraw.draw_rects(ref cv_rgb, face_size, box_info);
+// string msg_rgb = "rgb score is:" + rgb_score.ToString();
+// Cv2.PutText(cv_rgb, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// if (face_size > 0)
+// {
+// // 鐢讳汉鑴告
+// FaceDraw.draw_rects(ref cv_rgb, face_size, box_info);
- }
+// }
- rgb_win.ShowImage(cv_rgb);
- depth_win.ShowImage(depth_img);
- Cv2.WaitKey(1);
- depth_img.Release();
- }
- Marshal.FreeHGlobal(ptT);
- cv_rgb.Release();
- cv_depth.Release();
- Cv2.DestroyWindow("rgb");
- Cv2.DestroyWindow("depth");
- HjimiCamera.hjimi_release(phjimi);
- return true;
- }
- //鍙岀洰RGB鍜孌EPTH闈欓粯娲讳綋妫�娴嬶紙浼犲叆opencv瑙嗛甯�)閫傞厤濂ユ瘮涓厜娴风嚂绛夊弻鐩憚鍍忓ご
- public bool rgb_depth_liveness_check_orbe()
- {
- int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
+// rgb_win.ShowImage(cv_rgb);
+// depth_win.ShowImage(depth_img);
+// Cv2.WaitKey(1);
+// depth_img.Release();
+// }
+// Marshal.FreeHGlobal(ptT);
+// cv_rgb.Release();
+// cv_depth.Release();
+// Cv2.DestroyWindow("rgb");
+// Cv2.DestroyWindow("depth");
+// HjimiCamera.hjimi_release(phjimi);
+// return true;
+// }
+// //鍙岀洰RGB鍜孌EPTH闈欓粯娲讳綋妫�娴嬶紙浼犲叆opencv瑙嗛甯�)閫傞厤濂ユ瘮涓厜娴风嚂绛夊弻鐩憚鍍忓ご
+// public bool rgb_depth_liveness_check_orbe()
+// {
+// int max_face_num = 1;//鍙栨渶澶т汉鑴哥殑娲讳綋
- BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
- BDLivenessScore[] depth_score_info = new BDLivenessScore[max_face_num];
- int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
- IntPtr ptRGBS = Marshal.AllocHGlobal(sizeScore * max_face_num);
- IntPtr ptDepthS = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// BDLivenessScore[] rgb_score_info = new BDLivenessScore[max_face_num];
+// BDLivenessScore[] depth_score_info = new BDLivenessScore[max_face_num];
+// int sizeScore = Marshal.SizeOf(typeof(BDLivenessScore));
+// IntPtr ptRGBS = Marshal.AllocHGlobal(sizeScore * max_face_num);
+// IntPtr ptDepthS = Marshal.AllocHGlobal(sizeScore * max_face_num);
- BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
+// BDFaceBBox[] box_info = new BDFaceBBox[max_face_num];
- int sizeBox = Marshal.SizeOf(typeof(BDFaceTrackInfo));
- IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
+// int sizeBox = Marshal.SizeOf(typeof(BDFaceTrackInfo));
+// IntPtr ptT = Marshal.AllocHGlobal(sizeBox * max_face_num);
- IntPtr porbe = OrbeCamera.new_orbe();
- var rgb_win = new Window("rgb", WindowMode.AutoSize);
- var depth_win = new Window("depth", WindowMode.Normal);
- float rgb_score = 0;
- float depth_score = 0;
- Mat cv_depth = new Mat();
- Mat cv_rgb = new Mat();
- while (true)
- {
- int res_ok = OrbeCamera.open_orbe(porbe, cv_rgb.CvPtr, cv_depth.CvPtr);
- if (res_ok != 0)
- {
- depth_score = 0;
- rgb_score = depth_score;
- Console.WriteLine("open camera faile");
- continue;
- }
- if (cv_rgb.Empty())
- {
- continue;
- }
- if (cv_depth.Empty())
- {
- continue;
- }
- // 杩斿洖浜鸿劯涓暟
- int face_size = rgb_depth_liveness(ptT, ptRGBS, ptDepthS, cv_rgb.CvPtr, cv_depth.CvPtr);
+// IntPtr porbe = OrbeCamera.new_orbe();
+// var rgb_win = new Window("rgb", WindowMode.AutoSize);
+// var depth_win = new Window("depth", WindowMode.Normal);
+// float rgb_score = 0;
+// float depth_score = 0;
+// Mat cv_depth = new Mat();
+// Mat cv_rgb = new Mat();
+// while (true)
+// {
+// int res_ok = OrbeCamera.open_orbe(porbe, cv_rgb.CvPtr, cv_depth.CvPtr);
+// if (res_ok != 0)
+// {
+// depth_score = 0;
+// rgb_score = depth_score;
+// Console.WriteLine("open camera faile");
+// continue;
+// }
+// if (cv_rgb.Empty())
+// {
+// continue;
+// }
+// if (cv_depth.Empty())
+// {
+// continue;
+// }
+// // 杩斿洖浜鸿劯涓暟
+// int face_size = rgb_depth_liveness(ptT, ptRGBS, ptDepthS, cv_rgb.CvPtr, cv_depth.CvPtr);
- Console.WriteLine("res is:{0}", face_size);
- depth_score = 0;
- rgb_score = depth_score;
- for (int index = 0; index < face_size; index++)
- {
- IntPtr ptrBox = new IntPtr();
- IntPtr ptrRGBScore = new IntPtr();
- IntPtr ptrDepthScore = new IntPtr();
- if (8 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptT.ToInt64() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptRGBS.ToInt64() + sizeScore * index);
- ptrDepthScore = (IntPtr)(ptDepthS.ToInt64() + sizeScore * index);
- }
- else if (4 == IntPtr.Size)
- {
- ptrBox = (IntPtr)(ptT.ToInt32() + sizeBox * index);
- ptrRGBScore = (IntPtr)(ptRGBS.ToInt32() + sizeScore * index);
- ptrDepthScore = (IntPtr)(ptDepthS.ToInt32() + sizeScore * index);
- }
+// Console.WriteLine("res is:{0}", face_size);
+// depth_score = 0;
+// rgb_score = depth_score;
+// for (int index = 0; index < face_size; index++)
+// {
+// IntPtr ptrBox = new IntPtr();
+// IntPtr ptrRGBScore = new IntPtr();
+// IntPtr ptrDepthScore = new IntPtr();
+// if (8 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptT.ToInt64() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptRGBS.ToInt64() + sizeScore * index);
+// ptrDepthScore = (IntPtr)(ptDepthS.ToInt64() + sizeScore * index);
+// }
+// else if (4 == IntPtr.Size)
+// {
+// ptrBox = (IntPtr)(ptT.ToInt32() + sizeBox * index);
+// ptrRGBScore = (IntPtr)(ptRGBS.ToInt32() + sizeScore * index);
+// ptrDepthScore = (IntPtr)(ptDepthS.ToInt32() + sizeScore * index);
+// }
- box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
+// box_info[index] = (BDFaceBBox)Marshal.PtrToStructure(ptrBox, typeof(BDFaceBBox));
- rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
- rgb_score = rgb_score_info[index].score;
- depth_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrDepthScore, typeof(BDLivenessScore));
- depth_score = depth_score_info[index].score;
- // 鍒嗗�煎お浣庯紝浼氭樉绀哄皬鏁扮偣澶暱锛岀洿鎺ヨ祴鍊�0
- if (depth_score <= 0.1f)
- {
- depth_score = 0;
- }
- if (rgb_score <= 0.1f)
- {
- rgb_score = 0;
- }
- // 浜鸿劯瀹藉害
- Console.WriteLine("mWidth is:{0:f}", box_info[index].width);
- // 涓績鐐筙,Y鍧愭爣
- Console.WriteLine("mCenter_x is:{0:f}", box_info[index].center_x);
- Console.WriteLine("mCenter_y is:{0:f}", box_info[index].center_y);
+// rgb_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrRGBScore, typeof(BDLivenessScore));
+// rgb_score = rgb_score_info[index].score;
+// depth_score_info[index] = (BDLivenessScore)Marshal.PtrToStructure(ptrDepthScore, typeof(BDLivenessScore));
+// depth_score = depth_score_info[index].score;
+// // 鍒嗗�煎お浣庯紝浼氭樉绀哄皬鏁扮偣澶暱锛岀洿鎺ヨ祴鍊�0
+// if (depth_score <= 0.1f)
+// {
+// depth_score = 0;
+// }
+// if (rgb_score <= 0.1f)
+// {
+// rgb_score = 0;
+// }
+// // 浜鸿劯瀹藉害
+// Console.WriteLine("mWidth is:{0:f}", box_info[index].width);
+// // 涓績鐐筙,Y鍧愭爣
+// Console.WriteLine("mCenter_x is:{0:f}", box_info[index].center_x);
+// Console.WriteLine("mCenter_y is:{0:f}", box_info[index].center_y);
- }
+// }
- Mat depth_img = new Mat();
- cv_depth.ConvertTo(depth_img, MatType.CV_8UC1, 255.0 / 4500);
- string msg_depth = "depth score is:" + depth_score.ToString();
- Cv2.PutText(depth_img, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// Mat depth_img = new Mat();
+// cv_depth.ConvertTo(depth_img, MatType.CV_8UC1, 255.0 / 4500);
+// string msg_depth = "depth score is:" + depth_score.ToString();
+// Cv2.PutText(depth_img, msg_depth, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- string msg_rgb = "rgb score is:" + rgb_score.ToString();
- Cv2.PutText(cv_rgb, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
- if (face_size > 0)
- {
- // 鐢讳汉鑴告
- FaceDraw.draw_rects(ref cv_rgb, face_size, box_info);
- }
- rgb_win.ShowImage(cv_rgb);
- depth_win.ShowImage(depth_img);
- Cv2.WaitKey(1);
- depth_img.Release();
- }
- Marshal.FreeHGlobal(ptT);
- cv_rgb.Release();
- cv_depth.Release();
- Cv2.DestroyWindow("rgb");
- Cv2.DestroyWindow("depth");
- OrbeCamera.orbe_release(porbe);
- return true;
- }
+// string msg_rgb = "rgb score is:" + rgb_score.ToString();
+// Cv2.PutText(cv_rgb, msg_rgb, new Point(20, 50), HersheyFonts.HersheyComplex, 1, new Scalar(255, 100, 0));
+// if (face_size > 0)
+// {
+// // 鐢讳汉鑴告
+// FaceDraw.draw_rects(ref cv_rgb, face_size, box_info);
+// }
+// rgb_win.ShowImage(cv_rgb);
+// depth_win.ShowImage(depth_img);
+// Cv2.WaitKey(1);
+// depth_img.Release();
+// }
+// Marshal.FreeHGlobal(ptT);
+// cv_rgb.Release();
+// cv_depth.Release();
+// Cv2.DestroyWindow("rgb");
+// Cv2.DestroyWindow("depth");
+// OrbeCamera.orbe_release(porbe);
+// return true;
+// }
- public void test_rgb_ir_liveness_check_by_opencv()
- {
- rgb_ir_liveness_check_mat();
- }
+// public void test_rgb_ir_liveness_check_by_opencv()
+// {
+// rgb_ir_liveness_check_mat();
+// }
- // 鍙岀洰RGB鍜孌EPTH闈欓粯娲讳綋妫�娴�,閫傞厤濂ユ瘮涓厜娴风嚂绛夊弻鐩憚鍍忓ご
- public void test_rgb_depth_liveness_check_by_orbe()
- {
- rgb_depth_liveness_check_orbe();
- }
+// // 鍙岀洰RGB鍜孌EPTH闈欓粯娲讳綋妫�娴�,閫傞厤濂ユ瘮涓厜娴风嚂绛夊弻鐩憚鍍忓ご
+// public void test_rgb_depth_liveness_check_by_orbe()
+// {
+// rgb_depth_liveness_check_orbe();
+// }
- // 鍙岀洰鎽勫儚澶磋繘琛宺gb,depth娲讳綋妫�娴�(姝ゅ閫傞厤浜嗗崕鏉拌壘绫崇殑鍙岀洰鎽勫儚澶�)
- public void test_rgb_depth_liveness_check_by_hjimi()
- {
- rgb_depth_liveness_check_hjimi();
- }
- }
-}
+// // 鍙岀洰鎽勫儚澶磋繘琛宺gb,depth娲讳綋妫�娴�(姝ゅ閫傞厤浜嗗崕鏉拌壘绫崇殑鍙岀洰鎽勫儚澶�)
+// public void test_rgb_depth_liveness_check_by_hjimi()
+// {
+// rgb_depth_liveness_check_hjimi();
+// }
+// }
+//}
--
Gitblit v1.9.3