开发者

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());
                        }
                    }
                }
            }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜