protected void DestroyCamera() { if (camera != null) { camera.Dispose(); } }
void InitializeCamera() { camWidth = cameraImage.WidthRequest; camHeight = cameraImage.HeightRequest; camera = new OpenCVCamera(1); if (!camera.IsOpen()) { camera.Dispose(); camera = new OpenCVCamera(0); } Title = "GTK-OpenCV Tech Demo"; if (camera.IsOpen()) { camWidth = camera.Width(); camHeight = camera.Height(); Title = Title + " [" + camera.Label() + "(" + camWidth + " x " + camHeight + ")]"; grabButton.Sensitive = true; stopButton.Sensitive = false; } OriginalImage = new Pixbuf(Colorspace.Rgb, false, 8, camWidth > 0 ? camWidth : cameraImage.WidthRequest, camHeight > 0 ? camHeight : cameraImage.HeightRequest); OriginalImage.Fill(0); cameraImage.Pixbuf = OriginalImage.ScaleSimple(cameraImage.WidthRequest, cameraImage.HeightRequest, InterpType.Bilinear); grabButton.Sensitive = true; stopButton.Sensitive = false; cameraFlipX.Active = false; cameraFlipY.Active = false; }