Turn off camera in opencv
how to change this code, so when i click other button - CloseCamera_Button, then i can disable cam.
private void Camera_Button_Click(object sender, EventArgs e开发者_Python百科)
{
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());
}
}
}
}
And i need to remove CVwindow, so code should look like something like that:
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());
}
}
}
}
精彩评论