Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoCapture Dispose long time. #1705

Open
simphonydeveloper opened this issue Sep 16, 2024 · 1 comment
Open

VideoCapture Dispose long time. #1705

simphonydeveloper opened this issue Sep 16, 2024 · 1 comment

Comments

@simphonydeveloper
Copy link

simphonydeveloper commented Sep 16, 2024

Summary of your issue

I dispose VideoCapture on my own computer is very fast, but it closes very slowly on a surface computer. Usually takes 6-7 seconds

Environment

.NET Version:4.8

NUGET:

  <package id="OpenCvSharp4" version="4.10.0.20240616" targetFramework="net48" />
  <package id="OpenCvSharp4.Extensions" version="4.10.0.20240616" targetFramework="net48" />
  <package id="OpenCvSharp4.runtime.win" version="4.10.0.20240616" targetFramework="net48" />
  <package id="OpenCvSharp4.WpfExtensions" version="4.10.0.20240616" targetFramework="net48" />

My PC:
WIN10
CPU:Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.59 GHz

Surface GO:
WIN10
CPU:Intel(R)N200 1.00 GHZ

What did you do when you faced the problem?

I use task.factory.startnew(()=>{}) to dispose it. but this will cause my content to go white at some point.

Example code:

System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();

//capture.Release();
Task.Factory.StartNew(() =>
{
    capture.Dispose();
});
sw.Stop();
Console.WriteLine("capture" + sw.Elapsed.TotalSeconds);
logger.Info("capture" + sw.Elapsed.TotalSeconds);

Output:

StopCamera Info capture7.7534943

What did you intend to be?

@simphonydeveloper
Copy link
Author

Find a possible reason, the Windows Camera Frame Server will occupy CPU 100% when opening the camera, and then VideoCapture Dispose will take a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant