我正在做关于人脸识别的项目。我正在研究如何在 Visual Studio 2019 中使用 C# 创建用户界面我想知道如何将实时视频输出放到C#用户界面videoCapture.py这是videoCapture.pyimport numpy as npimport cv2cap = cv2.VideoCapture(0)while(True): # Capture frame-by-frame ret, frame = cap.read() # Our operations on the frame come here gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Display the resulting frame cv2.imshow('frame',gray) if cv2.waitKey(1) & 0xFF == ord('q'): break# When everything done, release the capturecap.release()cv2.destroyAllWindows()下面是 UI 的命名空间代码namespace DropDownMenu{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var menuReceptionist = new List<SubItem>(); menuReceptionist.Add(new SubItem("Profiles", new UserControlAdd())); var item0 = new ItemMenu("Receptionist", menuReceptionist, PackIconKind.ViewDashboard); var menuAdmin = new List<SubItem>(); menuAdmin.Add(new SubItem("Admins Profile", new UserControlAdmins())); menuAdmin.Add(new SubItem("Add Admin", new UserControlAdd())); var item1 = new ItemMenu("Administrations", menuAdmin, PackIconKind.FaceProfile); var menuPreprocess = new List<SubItem>(); menuPreprocess.Add(new SubItem("New Data", new UserControlAdmins())); var item2 = new ItemMenu("Data PreProcessing", menuPreprocess, PackIconKind.Schedule); Menu.Children.Add(new UserControlMenuItem(item0, this)); Menu.Children.Add(new UserControlMenuItem(item1, this)); Menu.Children.Add(new UserControlMenuItem(item2, this)); }如果我做错了什么,我提前很抱歉。这是我第一次在堆栈溢出中发帖
2 回答

湖上湖
TA贡献2003条经验 获得超2个赞
只是
//add library
using Emgu.CV;
// in your code
VideoCapture _videoCapture = new VideoCapture ();
// to process frames
Application.Idle += ProcessFrame ; // you should create this function
就是这样,我制作了一个视频,用简单的代码解释如何检测和识别人脸
您可以查看此视频 https://www.youtube.com/watch?v=KEpSdKoyhs0
添加回答
举报
0/150
提交
取消