我正在开发一个 C# windows 窗体应用程序。当我的网络摄像头检测到超过 2 个面孔时,我如何编辑我的代码。
更多信息:
当 "FaceDetectedLabel.Text = "检测到人脸:" + cam.facesdetected.ToString();" 变为Face Detected: 2 or more...
我该怎么做:
- 最小化除我的应用程序之外的所有程序运行。
这是我的代码:
namespace PBD
{
public partial class MainPage : Form
{
//declaring global variables
private Capture capture; //takes images from camera as image frames
public MainPage()
{
InitializeComponent();
}
private void ProcessFrame(object sender, EventArgs arg)
{
Wrapper cam = new Wrapper();
//show the image in the EmguCV ImageBox
WebcamPictureBox.Image = cam.start_cam(capture).Resize(390, 243, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC).ToBitmap();
FaceDetectedLabel.Text = "Faces Detected : " + cam.facesdetected.ToString();
}
private void MainPage_Load(object sender, EventArgs e)
{
#region if capture is not created, create it now
if (capture == null)
{
try
{
capture = new Capture();
}
catch (NullReferenceException excpt)
{
MessageBox.Show(excpt.Message);
}
}
#endregion
Application.Idle += ProcessFrame;
}