Comments (3)
If still relevant. I have Inherited the Capture class (v3.1.0.1 the Capture class still had not been renamed to VideoCapture, version from nuget), and I have overrided the Grab function. That is what I've got.
public class VideoCapture : Capture
{
public new event EventHandler ImageGrabbed;
public event EventHandler GrabFailed;
public VideoCapture(string inputString) : base(inputString) { }
[HandleProcessCorruptedStateExceptions]
public override bool Grab()
{
try
{
if (_ptr == IntPtr.Zero)
return false;
bool grabbed = cveVideoCaptureGrab(Ptr);
if (grabbed)
ImageGrabbed?.Invoke(this, new EventArgs());
else
GrabFailed?.Invoke(this, new EventArgs());
return grabbed;
}
catch
{
Thread.Yield();
GrabFailed?.Invoke(this, new EventArgs());
return false;
}
}
/// <summary>
/// Grab a frame
/// </summary>
/// <param name="capture">Video capturing structure</param>
/// <returns>True on success</returns>
[DllImport("cvextern", CallingConvention = CvInvoke.CvCallingConvention)]
[return: MarshalAs(CvInvoke.BoolToIntMarshalType)]
internal static extern bool cveVideoCaptureGrab(IntPtr capture);
}
Sometimes _capture.GrabFailed += ReconnectCamera works, but sometimes it steps into grub, but doesn't reach the GrabFailed?.Invoke(this, new EventArgs());. And stays somwhere in bool grabbed = cveVideoCaptureGrab(Ptr);
from emgucv.
I don't think this problem has been fixed up till now, when I read the source code, there's no exception handling for Grab
, Retrieve
and QueryFrame
. I'm using the *.dll
directly, so I can't simply override that one function. It is really inconvenient, please consider fix it right away.
from emgucv.
After we get an decoding error like:
h264: cabac decode of qscale diff failed at error decoding
This line:
bool grabbed = CvInvoke.cveVideoCaptureGrab(Ptr);
will always return false because the Ptr
will point to null, so cveVideoCaptureGrab
will not grab any frames successfully. How I fix this problem right now is every time the decoding error pops up, I'll just restart the capture. But I think EmguCV should handle this problem on your side.
from emgucv.
Related Issues (20)
- VideoCapture class not reading video with EMGUCV - 4.5.5.4823 , Dotnet Core - 6.0.414 and Ubuntu - 20.04 HOT 1
- [BUG] "The input Mat is empty" caused by incorrect argument test HOT 1
- [BUG]
- VideoCapture opens wrong camera
- [EXCEPTION] Exception using CudaORBDetector DetectAndCompute HOT 2
- Rtsp Player High memory, cpu usage HOT 1
- RTSP CPU, Memory usage HOT 1
- [BUG] Missing binding to cvtColorTwoPlane HOT 4
- Create GpuMat from Existing Cuda Pointer HOT 2
- [BUG]System.TypeInitializationException HOT 3
- [Error] The library is compiled without DNN support HOT 4
- System.DllNotFoundException: Unable to load shared library 'cvextern' or one of its dependencies. In order to help diagnose loading problems HOT 10
- [BUG]Maui Video Surveillance is not working HOT 8
- [BUG] VideoCapture does not release unmanaged resources on dispose - Memory Leak. HOT 3
- Image.Data and GetSubRect not compatible HOT 3
- [BUG] Wrong documentation of angle direction in RotatedRect HOT 5
- Wrongly converted parameter arguments for process method in AlignExposures class HOT 1
- [Feature] Add getter/setter in Feature2D algorithms
- Missing custom Aruco board definition
- [BUG] An error occurs when the file path contains Chinese characters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emgucv.