OpenCvSharp 3.4 (VideoCapture.Read () получить предыдущее изображение, есть идеи, почему? - PullRequest
0 голосов
/ 16 апреля 2020

Тот же код в C ++ / CLR прекрасно работает! OpenCV 4, но не в C#. OpenCV 3 Так что никаких проблем с оборудованием.

    VideoCapture cap =  new VideoCapture(CaptureDevice.Any, index: 0);
    Mat frame = new Mat();
    int[] param = { 1, 90 };
    Bitmap bitmapImg = null;

        cap.Set(21, -1);
        if (!cap.IsOpened())
        {
            MessageBox.Show("Camera selected already opened.", "Information:");
            return;
        }
        cap.Read(frame);
        if (frame.Empty())
        {
            MessageBox.Show("No hay imagen.", "Mensaje de Error");
            return;
        }

        bitmapImg = frame.ToBitmap();
        picCamera.Image = bitmapImg;

        frame.SaveImage("c:\\pictures\\Test1.jpg", param);
...