Can not get any non-empty frame

Summary of your issue

can not get any non-empty frame

Environment

windows 7 x64 + winform (.Net6) installed Framework4.8/4.6.1 installed nugetpackage OpenCvSharp4.Extensions OpenCvSharp4.runtime.win

What did you do when you faced the problem?

  • I added a usb camera device, the device is open, but I got empty frames(mat) always, and videoWriter is false at x64(any cpu work well)

  • At my develope machine(win10 + vs2022), my code work well, so What special requirements for opencv on windows7

Example code:

Task.Factory.StartNew(() =>
            {
                int index = 0;
                videoCapture = new VideoCapture(index);
                videoCapture.Set(VideoCaptureProperties.FrameWidth, 1920);
                videoCapture.Set(VideoCaptureProperties.FrameHeight, 1080);
                videoCapture.Set(VideoCaptureProperties.Fps, 25);
                if (!videoCapture.IsOpened()) return;
                string path = Path.Combine(AppContext.BaseDirectory, "temp", "out.avi");
                videoWriter = new VideoWriter(path, VideoWriter.FourCC(@"XVID"), videoCapture.Fps, new OpenCvSharp.Size(videoCapture.FrameWidth, videoCapture.FrameHeight), true);

                camera_running = true;
                while (camera_running)
                {
                    Mat camera = new Mat();
                    videoCapture.Read(camera);
                    if (camera.Empty()) continue;    // always empty
                    Mat image = new Mat();
                    camera.CopyTo(image);
                    videoWriter.Write(camera);

                    camera.Release();
                }
            }).ConfigureAwait(false);

Output:

No any exeception

What did you intend to be?

I want to know what is causeing this issue, and how to fix it.

Thanks!