如何更改此代码,所以当我点击其他按钮 - CloseCamera_Button时,我可以禁用cam。
private void Camera_Button_Click(object sender, EventArgs e)
{
using (CvCapture cap = CvCapture.FromCamera(0))
using (CvWindow w = new CvWindow("Edges"))
{
while (CvWindow.WaitKey(10) < 0)
{
using (IplImage src = cap.QueryFrame())
{
StreamingWindow.Image = BitmapConverter.ToBitmap(cap.QueryFrame());
}
}
}
}
我需要删除CVwindow,所以代码看起来应该是这样的:
private void Camera_Button_Click(object sender, EventArgs e)
{
using (CvCapture cap = CvCapture.FromCamera(0))
{
while (!CloseCamera_Button pressed)
{
using (IplImage src = cap.QueryFrame())
{
StreamingWindow.Image = BitmapConverter.ToBitmap(cap.QueryFrame());
}
}
}
}