コード例 #1
0
ファイル: MainWindow.cs プロジェクト: daelsepara/CameraApp
 protected void DestroyCamera()
 {
     if (camera != null)
     {
         camera.Dispose();
     }
 }
コード例 #2
0
ファイル: MainWindow.cs プロジェクト: daelsepara/CameraApp
    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;
    }