我正在做关于人脸识别的项目。我正在研究如何在 Visual Studio 2019 中使用 C# 创建用户界面
我想知道如何将实时视频输出放到C#用户界面videoCapture.py
这是videoCapture.py
import numpy as np
import cv2
cap = 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 capture
cap.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));
}
如果我做错了什么,我提前很抱歉。这是我第一次在堆栈溢出中发帖
哔哔one
湖上湖
相关分类